github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/chain/core/vm/interface.go (about) 1 package vm 2 3 import ( 4 "math/big" 5 6 "github.com/neatlab/neatio/chain/core/types" 7 "github.com/neatlab/neatio/utilities/common" 8 ) 9 10 type StateDB interface { 11 CreateAccount(common.Address) 12 13 SubBalance(common.Address, *big.Int) 14 AddBalance(common.Address, *big.Int) 15 GetBalance(common.Address) *big.Int 16 17 GetNonce(common.Address) uint64 18 SetNonce(common.Address, uint64) 19 20 GetCodeHash(common.Address) common.Hash 21 GetCode(common.Address) []byte 22 SetCode(common.Address, []byte) 23 GetCodeSize(common.Address) int 24 25 AddRefund(uint64) 26 SubRefund(uint64) 27 GetRefund() uint64 28 29 GetCommittedState(common.Address, common.Hash) common.Hash 30 GetState(common.Address, common.Hash) common.Hash 31 SetState(common.Address, common.Hash, common.Hash) 32 33 Suicide(common.Address) bool 34 HasSuicided(common.Address) bool 35 36 Exist(common.Address) bool 37 38 Empty(common.Address) bool 39 40 RevertToSnapshot(int) 41 Snapshot() int 42 43 AddLog(*types.Log) 44 AddPreimage(common.Hash, []byte) 45 46 ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) error 47 } 48 49 type CallContext interface { 50 Call(env *EVM, me ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error) 51 52 CallCode(env *EVM, me ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error) 53 54 DelegateCall(env *EVM, me ContractRef, addr common.Address, data []byte, gas *big.Int) ([]byte, error) 55 56 Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, common.Address, error) 57 }