store

package
v0.0.3-alphanet Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account interface {
	Identifier() types.HashHeight
	Address() *types.Address

	Storage() db.DB

	Frontier() (*nom.AccountBlock, error)
	ByHash(hash types.Hash) (*nom.AccountBlock, error)
	ByHeight(height uint64) (*nom.AccountBlock, error)
	MoreByHeight(height, count uint64) ([]*nom.AccountBlock, error)

	GetBalance(zts types.ZenonTokenStandard) (*big.Int, error)
	SetBalance(zts types.ZenonTokenStandard, balance *big.Int) error
	GetBalanceMap() (map[types.ZenonTokenStandard]*big.Int, error)

	GetChainPlasma() (*big.Int, error)
	AddChainPlasma(uint64) error

	MarkAsReceived(hash types.Hash) error
	IsReceived(hash types.Hash) bool

	SequencerFront(mailbox AccountMailbox) *types.AccountHeader
	SequencerPopFront()

	Apply(patch db.Patch) error
	Snapshot() Account
	Changes() (db.Patch, error)
}

type AccountMailbox

type AccountMailbox interface {
	Address() types.Address
	Snapshot() AccountMailbox

	MarkAsUnreceived(hash types.Hash) error
	MarkAsReceived(hash types.Hash) error
	MarkBlockThatReceives(hash types.Hash, receiveHeader types.AccountHeader) error

	GetBlockWhichReceives(fromHash types.Hash) *types.AccountHeader
	GetUnreceivedAccountBlockHashes(atMost uint64) ([]types.Hash, error)

	SequencerPushBack(types.AccountHeader)
	SequencerSize() uint64
	SequencerByHeight(uint64) *types.AccountHeader
}

type Genesis

type Genesis interface {
	ChainIdentifier() uint64
	IsGenesisMomentum(hash types.Hash) bool
	GetGenesisMomentum() *nom.Momentum
	GetGenesisTransaction() *nom.MomentumTransaction
	GetSporkAddress() *types.Address
}

type Momentum

type Momentum interface {
	Genesis

	Identifier() types.HashHeight
	GetFrontierMomentum() (*nom.Momentum, error)
	GetMomentumByHash(types.Hash) (*nom.Momentum, error)
	GetMomentumByHeight(uint64) (*nom.Momentum, error)

	GetAccountBlock(types.AccountHeader) (*nom.AccountBlock, error)
	GetFrontierAccountBlock(types.Address) (*nom.AccountBlock, error)
	GetAccountBlockByHash(types.Hash) (*nom.AccountBlock, error)
	GetAccountBlockByHeight(types.Address, uint64) (*nom.AccountBlock, error)

	GetAccountBlocksByHeight(address types.Address, height, count uint64) ([]*nom.AccountBlock, error)
	GetMomentumsByHash(blockHash types.Hash, higher bool, count uint64) ([]*nom.Momentum, error)
	GetMomentumsByHeight(height uint64, higher bool, count uint64) ([]*nom.Momentum, error)
	GetMomentumBeforeTime(timestamp *time.Time) (*nom.Momentum, error)
	PrefetchMomentum(momentum *nom.Momentum) (*nom.DetailedMomentum, error)

	GetBlockWhichReceives(hash types.Hash) (*nom.AccountBlock, error)

	GetBlockConfirmationHeight(hash types.Hash) (uint64, error)

	GetAllDefinedSporks() ([]*definition.Spork, error)
	GetActivePillars() ([]*definition.PillarInfo, error)
	IsSporkActive(*types.ImplementedSpork) (bool, error)
	GetStakeBeneficialAmount(addr types.Address) (*big.Int, error)
	GetTokenInfoByTs(ts types.ZenonTokenStandard) (*definition.TokenInfo, error)
	ComputePillarDelegations() ([]*types.PillarDelegationDetail, error)

	GetAccountStore(address types.Address) Account
	GetAccountDB(address types.Address) db.DB
	GetAccountMailbox(address types.Address) AccountMailbox

	Snapshot() Momentum
	Changes() (db.Patch, error)

	AddAccountBlockTransaction(header types.AccountHeader, patch db.Patch) error
}

Jump to

Keyboard shortcuts

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