laconicd/x/evm/statedb/interfaces.go
yihuang ade84319e6
evm: refactor statedb implementation (#729)
* initial statedb module

unit tests

unit tests

keeper implementation

extract TxConfig

remove unused code

* keeper integration

* fix unit tests

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* fixup! initial statedb module

* changelog

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
2022-01-05 08:28:27 +01:00

23 lines
863 B
Go

package statedb
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
)
// Keeper provide underlying storage of StateDB
type Keeper interface {
// Read methods
GetAccount(ctx sdk.Context, addr common.Address) (*Account, error)
GetState(ctx sdk.Context, addr common.Address, key common.Hash) common.Hash
GetCode(ctx sdk.Context, codeHash common.Hash) []byte
// the callback returns false to break early
ForEachStorage(ctx sdk.Context, addr common.Address, cb func(key, value common.Hash) bool)
// Write methods, only called by `StateDB.Commit()`
SetAccount(ctx sdk.Context, addr common.Address, account Account) error
SetState(ctx sdk.Context, addr common.Address, key common.Hash, value []byte)
SetCode(ctx sdk.Context, codeHash []byte, code []byte)
DeleteAccount(ctx sdk.Context, addr common.Address) error
}