Documentation ¶
Index ¶
- func CanTransfer(db vm.StateDB, addr common.Address, amount *big.Int) bool
- func GetHashFn() func(n uint64) common.Hash
- func NewEVMContext(from common.Address, blockNum, timeStamp, difficulty int64) vm.Context
- func Transfer(db vm.StateDB, sender, recipient common.Address, amount *big.Int)
- type AccountState
- func (accSt *AccountState) AddBalance(addr common.Address, amount *big.Int)
- func (accSt *AccountState) AddLog(log *types.Log)
- func (accSt *AccountState) AddPreimage(common.Hash, []byte)
- func (accSt *AccountState) AddRefund(uint64)
- func (accSt *AccountState) Commit() error
- func (accSt *AccountState) CreateAccount(addr common.Address)
- func (accSt *AccountState) Empty(addr common.Address) bool
- func (accSt *AccountState) Exist(addr common.Address) bool
- func (accSt *AccountState) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool)
- func (accSt *AccountState) GetBalance(addr common.Address) *big.Int
- func (accSt *AccountState) GetCode(addr common.Address) []byte
- func (accSt *AccountState) GetCodeHash(addr common.Address) common.Hash
- func (accSt *AccountState) GetCodeSize(addr common.Address) int
- func (accSt *AccountState) GetNonce(addr common.Address) uint64
- func (accSt *AccountState) GetRefund() uint64
- func (accSt *AccountState) GetState(addr common.Address, key common.Hash) common.Hash
- func (accSt *AccountState) HasSuicided(common.Address) bool
- func (accSt *AccountState) RevertToSnapshot(int)
- func (accSt *AccountState) SetCode(addr common.Address, code []byte)
- func (accSt *AccountState) SetNonce(addr common.Address, nonce uint64)
- func (accSt *AccountState) SetState(addr common.Address, key common.Hash, value common.Hash)
- func (accSt *AccountState) Snapshot() int
- func (accSt *AccountState) SubBalance(addr common.Address, amount *big.Int)
- func (accSt *AccountState) Suicide(common.Address) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanTransfer ¶
CanTransfer checks wether 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.
func GetHashFn ¶
GetHashFn returns a GetHashFunc which retrieves header hashes by number 获取块号码对于的块hash
func NewEVMContext ¶
NewEVMContext creates a new context for use in the EVM.
Types ¶
type AccountState ¶
AccountState 实现vm的StateDB的接口 用于进行测试
func TryLoadFromDisk ¶
func TryLoadFromDisk() (*AccountState, error)
TryLoadFromDisk 尝试从磁盘加载AccountState
func (*AccountState) AddBalance ¶
func (accSt *AccountState) AddBalance(addr common.Address, amount *big.Int)
AddBalance 增加某个账户的余额
func (*AccountState) AddPreimage ¶
func (accSt *AccountState) AddPreimage(common.Hash, []byte)
AddPreimage 暂时没搞清楚这个是干嘛用的
func (*AccountState) CreateAccount ¶
func (accSt *AccountState) CreateAccount(addr common.Address)
CreateAccount 创建一个新的合约账户
func (*AccountState) Empty ¶
func (accSt *AccountState) Empty(addr common.Address) bool
Empty 是否是空账户
func (*AccountState) Exist ¶
func (accSt *AccountState) Exist(addr common.Address) bool
Exist 检查账户是否存在
func (*AccountState) ForEachStorage ¶
ForEachStorage 暂时没发现vm调用这个接口
func (*AccountState) GetBalance ¶
func (accSt *AccountState) GetBalance(addr common.Address) *big.Int
GetBalance 获取某个账户的余额
func (*AccountState) GetCode ¶
func (accSt *AccountState) GetCode(addr common.Address) []byte
GetCode 获取智能合约的代码
func (*AccountState) GetCodeHash ¶
func (accSt *AccountState) GetCodeHash(addr common.Address) common.Hash
GetCodeHash 获取代码的hash值
func (*AccountState) GetCodeSize ¶
func (accSt *AccountState) GetCodeSize(addr common.Address) int
GetCodeSize 获取code的大小
func (*AccountState) GetNonce ¶
func (accSt *AccountState) GetNonce(addr common.Address) uint64
GetNonce 获取nonce
func (*AccountState) HasSuicided ¶
func (accSt *AccountState) HasSuicided(common.Address) bool
HasSuicided ...
func (*AccountState) RevertToSnapshot ¶
func (accSt *AccountState) RevertToSnapshot(int)
RevertToSnapshot ...
func (*AccountState) SetCode ¶
func (accSt *AccountState) SetCode(addr common.Address, code []byte)
SetCode 设置智能合约的code
func (*AccountState) SetNonce ¶
func (accSt *AccountState) SetNonce(addr common.Address, nonce uint64)
SetNonce 设置nonce
func (*AccountState) SubBalance ¶
func (accSt *AccountState) SubBalance(addr common.Address, amount *big.Int)
SubBalance 减去某个账户的余额
Directories ¶
Path | Synopsis |
---|---|
Package abi implements the Ethereum ABI (Application Binary Interface).
|
Package abi implements the Ethereum ABI (Application Binary Interface). |
Package common contains various helper functions.
|
Package common contains various helper functions. |
bitutil
Package bitutil implements fast bitwise operations.
|
Package bitutil implements fast bitwise operations. |
compiler
Package compiler wraps the Solidity compiler executable (solc).
|
Package compiler wraps the Solidity compiler executable (solc). |
hexutil
Package hexutil implements hex encoding with 0x prefix.
|
Package hexutil implements hex encoding with 0x prefix. |
math
Package math provides integer math utilities.
|
Package math provides integer math utilities. |
Package vm implements the Ethereum Virtual Machine.
|
Package vm implements the Ethereum Virtual Machine. |
runtime
Package runtime provides a basic execution model for executing EVM code.
|
Package runtime provides a basic execution model for executing EVM code. |