vmcontext

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 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 IsGoldTokenAddress added in v1.8.0

func IsGoldTokenAddress(evm *vm.EVM, addr common.Address) (bool, error)

func NewBlockContext added in v1.5.0

func NewBlockContext(header *types.Header, chain chainContext, txFeeRecipient *common.Address) vm.BlockContext

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) ExecuteAndDiscardChanges added in v1.8.2

func (sev *SharedEVMRunner) ExecuteAndDiscardChanges(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