Documentation
¶
Overview ¶
Copyright 2023 The N42 Authors This file is part of the N42 library.
The N42 library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The N42 library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the N42 library. If not, see <http://www.gnu.org/licenses/>. Package runtime provides a basic execution model for executing EVM code.
Index ¶
- func Call(address types.Address, input []byte, cfg *Config) ([]byte, uint64, error)
- func Create(input []byte, cfg *Config, blockNr uint64) ([]byte, types.Address, uint64, error)
- func Execute(code, input []byte, cfg *Config, bn uint64) ([]byte, *state.IntraBlockState, error)
- func NewEnv(cfg *Config) *vm.EVM
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Call ¶
Call executes the code given by the contract's address. It will return the EVM's return value or an error if it failed.
Call, unlike Execute, requires a config and also requires the State field to be set.
func Execute ¶
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.
Types ¶
type Config ¶
type Config struct { ChainConfig *params.ChainConfig Difficulty *big.Int Origin types.Address Coinbase types.Address BlockNumber *big.Int Time *big.Int GasLimit uint64 GasPrice *uint256.Int Value *uint256.Int Debug bool EVMConfig vm2.Config BaseFee *uint256.Int State *state.IntraBlockState GetHashFn func(n uint64) types.Hash // contains filtered or unexported fields }
Config is a basic type specifying certain configuration flags for running the EVM.