aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/evm/interface.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/vm/evm/interface.go')
-rw-r--r--core/vm/evm/interface.go53
1 files changed, 5 insertions, 48 deletions
diff --git a/core/vm/evm/interface.go b/core/vm/evm/interface.go
index 20e5f34a9..2e751597a 100644
--- a/core/vm/evm/interface.go
+++ b/core/vm/evm/interface.go
@@ -20,61 +20,18 @@ import (
"math/big"
"github.com/dexon-foundation/dexon/common"
- "github.com/dexon-foundation/dexon/core/types"
+ "github.com/dexon-foundation/dexon/core/vm"
)
-// StateDB is an EVM database for full state querying.
-type StateDB interface {
- CreateAccount(common.Address)
-
- SubBalance(common.Address, *big.Int)
- AddBalance(common.Address, *big.Int)
- GetBalance(common.Address) *big.Int
-
- GetNonce(common.Address) uint64
- SetNonce(common.Address, uint64)
-
- GetCodeHash(common.Address) common.Hash
- GetCode(common.Address) []byte
- SetCode(common.Address, []byte)
- GetCodeSize(common.Address) int
-
- AddRefund(uint64)
- SubRefund(uint64)
- GetRefund() uint64
-
- GetCommittedState(common.Address, common.Hash) common.Hash
- GetState(common.Address, common.Hash) common.Hash
- SetState(common.Address, common.Hash, common.Hash)
-
- Suicide(common.Address) bool
- HasSuicided(common.Address) bool
-
- // Exist reports whether the given account exists in state.
- // Notably this should also return true for suicided accounts.
- Exist(common.Address) bool
- // Empty returns whether the given account is empty. Empty
- // is defined according to EIP161 (balance = nonce = code = 0).
- Empty(common.Address) bool
-
- RevertToSnapshot(int)
- Snapshot() int
-
- AddLog(*types.Log)
- AddPreimage(common.Hash, []byte)
-
- ForEachStorage(common.Address, func(common.Hash, common.Hash) bool)
-}
-
// CallContext provides a basic interface for the EVM calling conventions. The EVM
// depends on this context being implemented for doing subcalls and initialising new EVM contracts.
type CallContext interface {
// Call another contract
- Call(env *EVM, me ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error)
+ Call(env *EVM, me vm.ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error)
// Take another's contract code and execute within our own context
- CallCode(env *EVM, me ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error)
+ CallCode(env *EVM, me vm.ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error)
// Same as CallCode except sender and value is propagated from parent to child scope
- DelegateCall(env *EVM, me ContractRef, addr common.Address, data []byte, gas *big.Int) ([]byte, error)
+ DelegateCall(env *EVM, me vm.ContractRef, addr common.Address, data []byte, gas *big.Int) ([]byte, error)
// Create a new contract
- Create(env *EVM, me ContractRef, data []byte, gas, value *big.Int) ([]byte, common.Address, error)
+ Create(env *EVM, me vm.ContractRef, data []byte, gas, value *big.Int) ([]byte, common.Address, error)
}