vmstore

package
v1.4.2-beta Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrStorageExists   = errors.New("storage already exists")
	ErrStorageNotFound = errors.New("storage not found")
)

Functions

func ToCache added in v1.4.0

func ToCache(ctx *VMContext) map[string]interface{}

func Trie added in v1.4.0

func Trie(ctx *VMContext) *trie.Trie

func TrieHash added in v1.4.0

func TrieHash(ctx *VMContext) *types.Hash

Types

type ContractStore

type ContractStore interface {
	GetStorage(prefix, key []byte) ([]byte, error)
	SetStorage(prefix, key []byte, value []byte) error

	SetObjectStorage(prefix, key []byte, value interface{}) error
	GetStorageByRaw([]byte) ([]byte, error)

	Iterator(prefix []byte, fn func(key []byte, value []byte) error) error

	PovGlobalState() *statedb.PovGlobalStateDB
	PoVContractState() (*statedb.PovContractStateDB, error)
	PovGlobalStateByHeight(h uint64) *statedb.PovGlobalStateDB
	PoVContractStateByHeight(h uint64) (*statedb.PovContractStateDB, error)
	GetLatestPovBlock() (*types.PovBlock, error)
	GetLatestPovHeader() (*types.PovHeader, error)
	GetPovMinerStat(dayIndex uint32) (*types.PovMinerDayStat, error)

	ListTokens() ([]*types.TokenInfo, error)
	GetTokenById(tokenId types.Hash) (*types.TokenInfo, error)
	GetTokenByName(tokenName string) (*types.TokenInfo, error)

	EventBus() event.EventBus

	GetBlockChild(hash types.Hash) (types.Hash, error)
	GetStateBlock(hash types.Hash) (*types.StateBlock, error)
	GetStateBlockConfirmed(hash types.Hash) (*types.StateBlock, error)
	HasStateBlockConfirmed(hash types.Hash) (bool, error)

	GetAccountMeta(address types.Address) (*types.AccountMeta, error)
	GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
	HasAccountMetaConfirmed(address types.Address) (bool, error)

	GetAccountMetaByPovHeight(address types.Address) (*types.AccountMeta, error)
	GetTokenMetaByPovHeight(address types.Address, token types.Hash) (*types.TokenMeta, error)
	GetTokenMetaByBlockHash(hash types.Hash) (*types.TokenMeta, error)

	IsUserAccount(address types.Address) (bool, error)
	CalculateAmount(block *types.StateBlock) (types.Balance, error)
	GetRelation(dest interface{}, query string) error
	SelectRelation(dest interface{}, query string) error
}

type VMCache

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

func NewVMCache

func NewVMCache() *VMCache

func (*VMCache) AppendLog added in v1.3.1

func (cache *VMCache) AppendLog(log *types.VmLog)

func (*VMCache) Clear

func (cache *VMCache) Clear()

func (*VMCache) GetStorage

func (cache *VMCache) GetStorage(key []byte) (interface{}, bool)

func (*VMCache) LogList

func (cache *VMCache) LogList() types.VmLogs

func (*VMCache) SetStorage

func (cache *VMCache) SetStorage(key []byte, value interface{})

func (*VMCache) Trie

func (cache *VMCache) Trie(fn func([]byte) []byte) *trie.Trie

type VMContext

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

func NewVMContext

func NewVMContext(l ledger.Store, contractAddr *types.Address) *VMContext

func NewVMContextWithBlock added in v1.4.0

func NewVMContextWithBlock(l ledger.Store, block *types.StateBlock) *VMContext

WithBlock Load storage trie from the specified user address and block hash

func (*VMContext) CalculateAmount

func (v *VMContext) CalculateAmount(block *types.StateBlock) (types.Balance, error)

func (*VMContext) EventBus added in v1.4.0

func (v *VMContext) EventBus() event.EventBus

func (*VMContext) GetAccountMeta

func (v *VMContext) GetAccountMeta(address types.Address) (*types.AccountMeta, error)

func (*VMContext) GetAccountMetaByPovHeight added in v1.4.0

func (v *VMContext) GetAccountMetaByPovHeight(address types.Address) (*types.AccountMeta, error)

func (*VMContext) GetBlockChild added in v1.4.0

func (v *VMContext) GetBlockChild(hash types.Hash) (types.Hash, error)

func (*VMContext) GetLatestPovBlock added in v1.2.3

func (v *VMContext) GetLatestPovBlock() (*types.PovBlock, error)

func (*VMContext) GetLatestPovHeader added in v1.4.0

func (v *VMContext) GetLatestPovHeader() (*types.PovHeader, error)

func (*VMContext) GetPovMinerStat added in v1.2.3

func (v *VMContext) GetPovMinerStat(dayIndex uint32) (*types.PovMinerDayStat, error)

FIXME: pov height

func (*VMContext) GetRelation added in v1.4.0

func (v *VMContext) GetRelation(dest interface{}, query string) error

func (*VMContext) GetStateBlock added in v1.2.3

func (v *VMContext) GetStateBlock(hash types.Hash) (*types.StateBlock, error)

func (*VMContext) GetStateBlockConfirmed added in v1.4.0

func (v *VMContext) GetStateBlockConfirmed(hash types.Hash) (*types.StateBlock, error)

func (*VMContext) GetStorage

func (v *VMContext) GetStorage(prefix, key []byte) ([]byte, error)

func (*VMContext) GetStorageByRaw added in v1.4.0

func (v *VMContext) GetStorageByRaw(i []byte) ([]byte, error)

func (*VMContext) GetTokenById added in v1.4.0

func (v *VMContext) GetTokenById(tokenId types.Hash) (*types.TokenInfo, error)

func (*VMContext) GetTokenByName added in v1.4.0

func (v *VMContext) GetTokenByName(tokenName string) (*types.TokenInfo, error)

func (*VMContext) GetTokenMeta added in v1.2.0

func (v *VMContext) GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)

func (*VMContext) GetTokenMetaByBlockHash added in v1.4.0

func (v *VMContext) GetTokenMetaByBlockHash(hash types.Hash) (*types.TokenMeta, error)

func (*VMContext) GetTokenMetaByPovHeight added in v1.4.0

func (v *VMContext) GetTokenMetaByPovHeight(address types.Address, token types.Hash) (*types.TokenMeta, error)

func (*VMContext) HasAccountMetaConfirmed added in v1.4.0

func (v *VMContext) HasAccountMetaConfirmed(address types.Address) (bool, error)

func (*VMContext) HasStateBlockConfirmed added in v1.4.0

func (v *VMContext) HasStateBlockConfirmed(hash types.Hash) (bool, error)

func (*VMContext) IsUserAccount

func (v *VMContext) IsUserAccount(address types.Address) (bool, error)

func (*VMContext) Iterator

func (v *VMContext) Iterator(prefix []byte, fn func(key []byte, value []byte) error) error

func (*VMContext) ListTokens added in v1.4.0

func (v *VMContext) ListTokens() ([]*types.TokenInfo, error)

func (*VMContext) PoVContractState added in v1.4.0

func (v *VMContext) PoVContractState() (*statedb.PovContractStateDB, error)

func (*VMContext) PoVContractStateByHeight added in v1.4.0

func (v *VMContext) PoVContractStateByHeight(h uint64) (*statedb.PovContractStateDB, error)

func (*VMContext) PovGlobalState added in v1.4.0

func (v *VMContext) PovGlobalState() *statedb.PovGlobalStateDB

func (*VMContext) PovGlobalStateByHeight added in v1.4.0

func (v *VMContext) PovGlobalStateByHeight(h uint64) *statedb.PovGlobalStateDB

func (*VMContext) SelectRelation added in v1.4.0

func (v *VMContext) SelectRelation(dest interface{}, query string) error

func (*VMContext) SetObjectStorage added in v1.4.0

func (v *VMContext) SetObjectStorage(prefix, key []byte, value interface{}) error

func (*VMContext) SetStorage

func (v *VMContext) SetStorage(prefix, key []byte, value []byte) error

func (*VMContext) WithCache added in v1.4.0

func (v *VMContext) WithCache(c storage.Cache) *VMContext

Jump to

Keyboard shortcuts

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