contract_storage

package
v0.0.0-...-7b0d77e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stor_k_1

func Stor_k_1(parts ...[]byte) *common.Hash

func Stor_k_2

func Stor_k_2(parts ...[]byte) common.Hash

Types

type AddressesIMap

type AddressesIMap struct {
	AddressesIMapReader
	// contains filtered or unexported fields
}

AccountsIMap is a IterableMap wrapper for storing account addresses

func (*AddressesIMap) CreateAccount

func (self *AddressesIMap) CreateAccount(account *common.Address) bool

Creates account from iterable map

func (*AddressesIMap) GetAllAccounts

func (self *AddressesIMap) GetAllAccounts() []common.Address

func (*AddressesIMap) Init

func (self *AddressesIMap) Init(stor *StorageWrapper, prefix []byte)

Inits iterable map with prefix, so multiple iterable maps can coexists thanks to different prefixes

func (*AddressesIMap) RemoveAccount

func (self *AddressesIMap) RemoveAccount(account *common.Address) uint32

Removes account from iterable map, returns number of left accounts in the iterable map

type AddressesIMapReader

type AddressesIMapReader struct {
	// contains filtered or unexported fields
}

func (*AddressesIMapReader) AccountExists

func (self *AddressesIMapReader) AccountExists(account *common.Address) bool

Checks is account exists in iterable map

func (*AddressesIMapReader) GetAccounts

func (self *AddressesIMapReader) GetAccounts(batch uint32, count uint32) (result []common.Address, end bool)

func (*AddressesIMapReader) GetCount

func (self *AddressesIMapReader) GetCount() (count uint32)

Returns number of stored items

func (*AddressesIMapReader) Init

func (self *AddressesIMapReader) Init(stor *StorageReaderWrapper, prefix []byte)

Inits iterable map with prefix, so multiple iterable maps can coexists thanks to different prefixes

type EVMStateStorage

type EVMStateStorage struct{ *state_evm.EVMState }

func (EVMStateStorage) AddBalance

func (self EVMStateStorage) AddBalance(address *common.Address, b *big.Int)

func (EVMStateStorage) GetAccountStorage

func (self EVMStateStorage) GetAccountStorage(address *common.Address, k *common.Hash, cb func([]byte))

func (EVMStateStorage) GetNonce

func (self EVMStateStorage) GetNonce(address *common.Address) *big.Int

func (EVMStateStorage) IncrementNonce

func (self EVMStateStorage) IncrementNonce(address *common.Address)

func (EVMStateStorage) Put

func (self EVMStateStorage) Put(address *common.Address, k *common.Hash, v []byte)

func (EVMStateStorage) SubBalance

func (self EVMStateStorage) SubBalance(address *common.Address, b *big.Int) bool

type IterableMap

type IterableMap struct {
	IterableMapReader
	// contains filtered or unexported fields
}

IterableMap storage wrapper

func (*IterableMap) CreateItem

func (self *IterableMap) CreateItem(item []byte) bool

Creates item from iterable map

func (*IterableMap) Init

func (self *IterableMap) Init(stor *StorageWrapper, prefix []byte)

Inits iterable map with prefix, so multiple iterbale maps can coexists thanks to different prefixes

func (*IterableMap) RemoveItem

func (self *IterableMap) RemoveItem(item []byte) uint32

Removes item from iterable map, returns number of left items in the iterbale map

type IterableMapReader

type IterableMapReader struct {
	// contains filtered or unexported fields
}

func (*IterableMapReader) GetCount

func (self *IterableMapReader) GetCount() (count uint32)

Returns number of stored items

func (*IterableMapReader) GetItems

func (self *IterableMapReader) GetItems(batch uint32, count uint32) (result [][]byte, end bool)

func (*IterableMapReader) Init

func (self *IterableMapReader) Init(stor *StorageReaderWrapper, prefix []byte)

Inits iterable map with prefix, so multiple iterbale maps can coexists thanks to different prefixes

func (*IterableMapReader) ItemExists

func (self *IterableMapReader) ItemExists(item []byte) bool

Checks is item exists in iterable map

type Storage

type Storage interface {
	StorageReader
	StorageWriter
}

type StorageReader

type StorageReader interface {
	GetAccountStorage(addr *common.Address, key *common.Hash, cb func([]byte))
}

type StorageReaderWrapper

type StorageReaderWrapper struct {
	StorageReader
	// contains filtered or unexported fields
}

func (*StorageReaderWrapper) ClearCache

func (self *StorageReaderWrapper) ClearCache()

func (*StorageReaderWrapper) Get

func (self *StorageReaderWrapper) Get(k *common.Hash, cb func([]byte))

func (*StorageReaderWrapper) Init

func (self *StorageReaderWrapper) Init(contract_address *common.Address, backend StorageReader) *StorageReaderWrapper

func (*StorageReaderWrapper) ListForEach

func (self *StorageReaderWrapper) ListForEach(prefix []byte, cb func([]byte))

func (*StorageReaderWrapper) ListPrint

func (self *StorageReaderWrapper) ListPrint(prefix []byte)

debug-only

type StorageWrapper

type StorageWrapper struct {
	StorageReaderWrapper
	StorageWriter
	// contains filtered or unexported fields
}

func (*StorageWrapper) Init

func (self *StorageWrapper) Init(contract_address *common.Address, storage Storage) *StorageWrapper

func (*StorageWrapper) ListAppend

func (self *StorageWrapper) ListAppend(prefix []byte, val []byte) (pos uint64)

func (*StorageWrapper) ListRemove

func (self *StorageWrapper) ListRemove(prefix []byte, pos uint64) (last_element []byte)

func (*StorageWrapper) Put

func (self *StorageWrapper) Put(k *common.Hash, v []byte)

type StorageWriter

type StorageWriter interface {
	SubBalance(*common.Address, *big.Int) bool
	AddBalance(*common.Address, *big.Int)
	Put(*common.Address, *common.Hash, []byte)
	GetNonce(address *common.Address) *big.Int
	IncrementNonce(address *common.Address)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL