storage

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeResultCache

func MergeResultCache(src *ResultCache, to *ResultCache)

Types

type BalanceCache

type BalanceCache map[string]*balance

func (BalanceCache) Clone added in v0.2.2

func (b BalanceCache) Clone() BalanceCache

func (BalanceCache) Merge added in v0.2.3

func (b BalanceCache) Merge(cache BalanceCache)

type Cache

type Cache map[string]*evmInt256.Int

func (Cache) Clone added in v0.2.2

func (c Cache) Clone() Cache

func (Cache) Merge added in v0.2.3

func (c Cache) Merge(cache Cache)

type CacheUnderNamespace

type CacheUnderNamespace map[string]Cache

func (CacheUnderNamespace) Clone added in v0.2.2

func (CacheUnderNamespace) Get

func (c CacheUnderNamespace) Get(namespace string, key string) *evmInt256.Int

func (CacheUnderNamespace) Merge added in v0.2.3

func (CacheUnderNamespace) Set

func (c CacheUnderNamespace) Set(namespace string, key string, v *evmInt256.Int)

type CodeCache

type CodeCache map[string][]byte

type IExternalStorage

type IExternalStorage interface {
	GetBalance(address *evmInt256.Int) (*evmInt256.Int, error)
	GetCode(address *evmInt256.Int) ([]byte, error)
	GetCodeSize(address *evmInt256.Int) (*evmInt256.Int, error)
	GetCodeHash(address *evmInt256.Int) (*evmInt256.Int, error)
	GetBlockHash(block *evmInt256.Int) (*evmInt256.Int, error)

	CreateAddress(caller *evmInt256.Int, tx environment.Transaction) *evmInt256.Int
	CreateFixedAddress(caller *evmInt256.Int, salt *evmInt256.Int, tx environment.Transaction) *evmInt256.Int

	CanTransfer(from *evmInt256.Int, to *evmInt256.Int, amount *evmInt256.Int) bool

	Load(n string, k string) (*evmInt256.Int, error)
	TLoad(n string, k string) (*evmInt256.Int, error)

	NewContract(n string, code []byte) error
}

type Log

type Log struct {
	Address *evmInt256.Int
	Topics  [][]byte
	Data    []byte
}

func (Log) Clone added in v0.2.2

func (l Log) Clone() Log

type LogCache

type LogCache []Log

func (LogCache) Clone added in v0.2.2

func (l LogCache) Clone() LogCache

type ResultCache

type ResultCache struct {
	OriginalData CacheUnderNamespace
	CachedData   CacheUnderNamespace

	TOriginalData CacheUnderNamespace
	TCachedData   CacheUnderNamespace

	Balance   BalanceCache
	Logs      *LogCache
	Destructs Cache
}

func NewResultCache added in v0.2.2

func NewResultCache() ResultCache

func (*ResultCache) Clone added in v0.2.2

func (r *ResultCache) Clone() ResultCache

func (*ResultCache) XCachedLoad added in v0.2.0

func (r *ResultCache) XCachedLoad(namespace string, key string, t TypeOfStorage) *evmInt256.Int

func (*ResultCache) XCachedStore added in v0.2.0

func (r *ResultCache) XCachedStore(namespace string, key string, v *evmInt256.Int, t TypeOfStorage)

func (*ResultCache) XOriginalLoad added in v0.2.0

func (r *ResultCache) XOriginalLoad(namespace string, key string, t TypeOfStorage) *evmInt256.Int

func (*ResultCache) XOriginalStore added in v0.2.0

func (r *ResultCache) XOriginalStore(namespace string, key string, v *evmInt256.Int, t TypeOfStorage)

type Storage

type Storage struct {
	ResultCache ResultCache
	// contains filtered or unexported fields
}

func New

func New(extStorage IExternalStorage) *Storage

func (*Storage) Balance

func (s *Storage) Balance(address *evmInt256.Int) (*evmInt256.Int, error)

func (*Storage) BalanceModify

func (s *Storage) BalanceModify(address *evmInt256.Int, value *evmInt256.Int, neg bool)

func (*Storage) CanTransfer

func (s *Storage) CanTransfer(from *evmInt256.Int, to *evmInt256.Int, amount *evmInt256.Int) bool

func (*Storage) ClearCache added in v0.2.2

func (s *Storage) ClearCache()

func (*Storage) Clone added in v0.2.2

func (s *Storage) Clone() *Storage

func (*Storage) CreateAddress added in v0.2.2

func (s *Storage) CreateAddress(caller *evmInt256.Int, tx environment.Transaction) *evmInt256.Int

func (*Storage) CreateFixedAddress added in v0.2.2

func (s *Storage) CreateFixedAddress(caller *evmInt256.Int, salt *evmInt256.Int, tx environment.Transaction) *evmInt256.Int

func (*Storage) Destruct

func (s *Storage) Destruct(address *evmInt256.Int)

func (*Storage) GetBlockHash

func (s *Storage) GetBlockHash(block *evmInt256.Int) (*evmInt256.Int, error)

func (*Storage) GetCode

func (s *Storage) GetCode(address *evmInt256.Int) ([]byte, error)

func (*Storage) GetCodeHash

func (s *Storage) GetCodeHash(address *evmInt256.Int) (*evmInt256.Int, error)

func (*Storage) GetCodeSize

func (s *Storage) GetCodeSize(address *evmInt256.Int) (*evmInt256.Int, error)

func (*Storage) GetExternalStorage added in v0.2.2

func (s *Storage) GetExternalStorage() IExternalStorage

func (*Storage) Log

func (s *Storage) Log(address *evmInt256.Int, topics [][]byte, data []byte, context environment.Context)

func (*Storage) NewContract

func (s *Storage) NewContract(address *evmInt256.Int, code []byte) error

func (*Storage) XLoad added in v0.2.0

func (s *Storage) XLoad(n *evmInt256.Int, k *evmInt256.Int, t TypeOfStorage) (*evmInt256.Int, error)

func (*Storage) XStore added in v0.2.0

func (s *Storage) XStore(n *evmInt256.Int, k *evmInt256.Int, v *evmInt256.Int, t TypeOfStorage)

type TypeOfStorage added in v0.2.0

type TypeOfStorage int
const (
	SStorage TypeOfStorage = 1
	TStorage TypeOfStorage = 2
)

Jump to

Keyboard shortcuts

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