-
Notifications
You must be signed in to change notification settings - Fork 73
/
interface.go
33 lines (29 loc) · 1.31 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package states
import (
"github.com/artela-network/artela-evm/vm"
cosmos "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/common"
)
// ExtStateDB defines an extension to the interface provided by the go-ethereum
// codebase to support additional states transition functionalities. In particular
// it supports appending a new entry to the states journal through
// AppendJournalEntry so that the states can be reverted after running
// stateful precompiled contracts.
type ExtStateDB interface {
vm.StateDB
AppendJournalEntry(JournalEntry)
}
// Keeper provide underlying storage of StateDB
type Keeper interface {
// Read methods
GetAccount(ctx cosmos.Context, addr common.Address) *StateAccount
GetState(ctx cosmos.Context, addr common.Address, key common.Hash) common.Hash
GetCode(ctx cosmos.Context, codeHash common.Hash) []byte
// the callback returns false to break early
ForEachStorage(ctx cosmos.Context, addr common.Address, cb func(key, value common.Hash) bool)
// Write methods, only called by `StateDB.Commit()`
SetAccount(ctx cosmos.Context, addr common.Address, account StateAccount) error
SetState(ctx cosmos.Context, addr common.Address, key common.Hash, value []byte)
SetCode(ctx cosmos.Context, codeHash []byte, code []byte)
DeleteAccount(ctx cosmos.Context, addr common.Address) error
}