Documentation
¶
Index ¶
- func CanTransfer(db vm.StateDB, addr common.Address, amount *uint256.Int) bool
- func NewEnv(cfg *Config, stateDB *state.StateDB, record *vm.RecordToInitiateState) *vm.EVM
- func SetDefaults(cfg *Config)
- func Transfer(db vm.StateDB, sender, recipient common.Address, amount *uint256.Int)
- type Config
- type ExecutionResult
- type RecordToInitiateState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanTransfer ¶
CanTransfer checks whether there are enough funds in the address' account to make a transfer. This does not take the necessary gas in to account to make the transfer valid.
Types ¶
type Config ¶
type Config struct { ChainConfig *params.ChainConfig Difficulty *big.Int Origin common.Address Coinbase common.Address BlockNumber *big.Int Time uint64 GasLimit uint64 GasPrice *big.Int Value *big.Int Debug bool EVMConfig vm.Config BaseFee *big.Int BlobBaseFee *big.Int BlobHashes []common.Hash BlobFeeCap *big.Int Random *common.Hash RPCEndpoint string ErrorRatio float64 GetHashFn func(n uint64) common.Hash }
Config is a basic type specifying certain configuration flags for running the EVM.
type ExecutionResult ¶
type ExecutionResult struct { Ret []byte GasUsed uint64 Refund uint64 IntrinsicGas uint64 Record *RecordToInitiateState }
func Execute ¶
func Execute( address common.Address, originBalance *big.Int, code, input []byte, cfg *Config, state *state.StateDB, recordToInit *ourVm.RecordToInitiateState, ) (*ExecutionResult, error)
Execute executes the code using the input as call data during the execution. It returns the EVM's return value, the new state and an error if it failed.
Execute sets up an in-memory, temporary, environment for the execution of the given code. It makes sure that it's restored to its original state afterwards. In order to get an appropiate gas estimation, this should be run twice one for generating the access lists, take a look to Simulate from simulator package