vmstore

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT, MIT Imports: 9 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

This section is empty.

Types

type ContractStore

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

	CalculateAmount(block *types.StateBlock) (types.Balance, error)
	IsUserAccount(address types.Address) (bool, error)
	GetAccountMeta(address types.Address) (*types.AccountMeta, error)
	GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
	GetStateBlock(hash types.Hash) (*types.StateBlock, error)
	HasTokenMeta(address types.Address, token types.Hash) (bool, error)
	SaveStorage(txns ...db.StoreTxn) error
}

type VMCache

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

func NewVMCache

func NewVMCache(trie *trie.Trie) *VMCache

func (*VMCache) Clear

func (cache *VMCache) Clear()

func (*VMCache) GetStorage

func (cache *VMCache) GetStorage(key []byte) []byte

func (*VMCache) LogList

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

func (*VMCache) SetStorage

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

func (*VMCache) Storage

func (cache *VMCache) Storage() map[string][]byte

func (*VMCache) Trie

func (cache *VMCache) Trie() *trie.Trie

type VMContext

type VMContext struct {
	Cache *VMCache
	// contains filtered or unexported fields
}

func NewVMContext

func NewVMContext(l *ledger.Ledger) *VMContext

func (*VMContext) CalculateAmount

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

func (*VMContext) GetAccountMeta

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

func (*VMContext) GetLatestPovBlock added in v1.2.3

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

func (*VMContext) GetLogger added in v1.2.3

func (v *VMContext) GetLogger() *zap.SugaredLogger

func (*VMContext) GetPovBlockByHeight added in v1.2.3

func (v *VMContext) GetPovBlockByHeight(height uint64) (*types.PovBlock, error)

func (*VMContext) GetPovHeaderByHeight added in v1.2.3

func (v *VMContext) GetPovHeaderByHeight(height uint64) (*types.PovHeader, error)

func (*VMContext) GetPovMinerStat added in v1.2.3

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

func (*VMContext) GetRepresentation added in v1.2.3

func (v *VMContext) GetRepresentation(address types.Address) (*types.Benefit, error)

func (*VMContext) GetStateBlock added in v1.2.3

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

func (*VMContext) GetStorage

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

func (*VMContext) GetTokenMeta added in v1.2.0

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

func (*VMContext) HasTokenMeta added in v1.2.0

func (v *VMContext) HasTokenMeta(address types.Address, token 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) SaveStorage

func (v *VMContext) SaveStorage(txns ...db.StoreTxn) error

func (*VMContext) SaveTrie

func (v *VMContext) SaveTrie(txns ...db.StoreTxn) error

func (*VMContext) SetStorage

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

Jump to

Keyboard shortcuts

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