vmcontext

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VMAddress = common.ZeroAddress

VMAddress is the address the VM uses to make internal calls to contracts

Functions

func CanTransfer

func CanTransfer(db vm.StateDB, addr common.Address, amount *big.Int) bool

CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas into account to make the transfer valid.

func GetHashFn

func GetHashFn(ref *types.Header, chain chainContext) func(uint64) common.Hash

GetHashFn returns a GetHashFunc which retrieves header hashes by number

func GetRegisteredAddress

func GetRegisteredAddress(evm *vm.EVM, registryId common.Hash) (common.Address, error)

func New

func New(from common.Address, gasPrice *big.Int, header *types.Header, chain chainContext, txFeeRecipient *common.Address) vm.Context

New creates a new context for use in the EVM.

func NewEVMRunner

func NewEVMRunner(chain evmRunnerContext, header *types.Header, state vm.StateDB) vm.EVMRunner

func TobinTransfer

func TobinTransfer(evm *vm.EVM, sender, recipient common.Address, amount *big.Int)

TobinTransfer performs a transfer that may take a tax from the sent amount and give it to the reserve. If the calculation or transfer of the tax amount fails for any reason, the regular transfer goes ahead. NB: Gas is not charged or accounted for this calculation.

func Transfer

func Transfer(db vm.StateDB, sender, recipient common.Address, amount *big.Int)

Transfer subtracts amount from sender and adds amount to recipient using the given Db

func VerifySealFn

func VerifySealFn(ref *types.Header, chain chainContext) func(*types.Header) bool

VerifySealFn returns a function which returns true when the given header has a verifiable seal.

Types

type SharedEVMRunner

type SharedEVMRunner struct{ *vm.EVM }

SharedEVMRunner is an evm runner that REUSES an evm This MUST NOT BE USED, but it's here for backward compatibility purposes

func (*SharedEVMRunner) Execute

func (sev *SharedEVMRunner) Execute(recipient common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, err error)

func (*SharedEVMRunner) ExecuteFrom

func (sev *SharedEVMRunner) ExecuteFrom(sender, recipient common.Address, input []byte, gas uint64, value *big.Int) (ret []byte, err error)

func (*SharedEVMRunner) Query

func (sev *SharedEVMRunner) Query(recipient common.Address, input []byte, gas uint64) (ret []byte, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL