storage

package
v0.0.0-...-d4bb699 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

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

type Cache

type Cache map[string]*evmutils.Int

type CacheUnderAddress

type CacheUnderAddress map[string]Cache

func (CacheUnderAddress) Get

func (c CacheUnderAddress) Get(address string, key string) *evmutils.Int

func (CacheUnderAddress) Set

func (c CacheUnderAddress) Set(address string, key string, v *evmutils.Int)

type CodeCache

type CodeCache map[string][]byte

type ContractStorage

type ContractStorage struct {
	ResultCache     ResultCache
	ExternalStorage IExternalStorage

	Ctx       protocol.TxSimContext
	BlockHash *evmutils.Int
	// contains filtered or unexported fields
}

func NewStorage

func NewStorage(extStorage IExternalStorage) *ContractStorage

func (*ContractStorage) CanTransfer

func (c *ContractStorage) CanTransfer(from, to, val *evmutils.Int) bool

func (*ContractStorage) CreateAddress

func (c *ContractStorage) CreateAddress(caller *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int

func (*ContractStorage) CreateFixedAddress

func (c *ContractStorage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int

func (*ContractStorage) GetBalance

func (c *ContractStorage) GetBalance(address *evmutils.Int) (*evmutils.Int, error)

func (*ContractStorage) GetBlockHash

func (c *ContractStorage) GetBlockHash(block *evmutils.Int) (*evmutils.Int, error)

func (*ContractStorage) GetCode

func (c *ContractStorage) GetCode(address *evmutils.Int) (code []byte, err error)

func (*ContractStorage) GetCodeHash

func (c *ContractStorage) GetCodeHash(address *evmutils.Int) (codeHase *evmutils.Int, err error)

func (*ContractStorage) GetCodeSize

func (c *ContractStorage) GetCodeSize(address *evmutils.Int) (size *evmutils.Int, err error)

func (*ContractStorage) GetCurrentBlockVersion

func (c *ContractStorage) GetCurrentBlockVersion() uint32

func (*ContractStorage) Load

func (c *ContractStorage) Load(n string, k string) (*evmutils.Int, error)

func (ContractStorage) Store

func (c ContractStorage) Store(address string, key string, val []byte)

type IExternalStorage

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

	CreateAddress(caller *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int
	CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int

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

	Load(n string, k string) (*evmutils.Int, error)
	Store(address string, key string, val []byte)
}

Teh External Storage,provding a Storage for touching out of current evm

type Log

type Log struct {
	Topics  [][]byte
	Data    []byte
	Context environment.Context
}

type LogCache

type LogCache map[string][]Log

type ResultCache

type ResultCache struct {
	//OriginalData CacheUnderAddress
	CachedData CacheUnderAddress

	Balance   BalanceCache
	Logs      LogCache
	Destructs Cache
}

type Storage

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

func New

func New(extStorage IExternalStorage) *Storage

func (*Storage) Balance

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

func (*Storage) BalanceModify

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

func (*Storage) CreateAddress

func (s *Storage) CreateAddress(caller *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int

func (*Storage) CreateFixedAddress

func (s *Storage) CreateFixedAddress(caller *evmutils.Int, salt *evmutils.Int, tx environment.Transaction, addrType int32) *evmutils.Int

func (*Storage) Destruct

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

func (*Storage) GetBlockHash

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

func (*Storage) GetCode

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

func (*Storage) GetCodeHash

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

func (*Storage) GetCodeSize

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

func (*Storage) GetCurrentBlockVersion

func (s *Storage) GetCurrentBlockVersion() uint32

func (*Storage) Log

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

func (*Storage) SLoad

func (s *Storage) SLoad(n *evmutils.Int, k *evmutils.Int) (*evmutils.Int, error)

func (*Storage) SStore

func (s *Storage) SStore(n *evmutils.Int, k *evmutils.Int, v *evmutils.Int)

func (*Storage) SetCode

func (s *Storage) SetCode(address *evmutils.Int, code []byte)

func (*Storage) SetCodeHash

func (s *Storage) SetCodeHash(address *evmutils.Int, codeHash *evmutils.Int)

func (*Storage) SetCodeSize

func (s *Storage) SetCodeSize(address *evmutils.Int, size *evmutils.Int)

Jump to

Keyboard shortcuts

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