Documentation ¶
Index ¶
- Constants
- func Call(ic *interop.Context) error
- func Deploy(ic *interop.Context) error
- type BlockedAccounts
- type Contracts
- type GAS
- func (c *GAS) Decimals(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (g *GAS) Initialize(ic *interop.Context) error
- func (c *GAS) Metadata() *interop.ContractMD
- func (c *GAS) Name(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (g *GAS) OnPersist(ic *interop.Context) error
- func (c *GAS) Symbol(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (c *GAS) TotalSupply(ic *interop.Context, _ []stackitem.Item) stackitem.Item
- func (c *GAS) Transfer(ic *interop.Context, args []stackitem.Item) stackitem.Item
- func (c *GAS) TransferInternal(ic *interop.Context, from, to util.Uint160, amount *big.Int) error
- type NEO
- func (c *NEO) Decimals(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (n *NEO) GetCandidates(d dao.DAO) ([]state.Validator, error)
- func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
- func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
- func (n *NEO) Initialize(ic *interop.Context) error
- func (c *NEO) Metadata() *interop.ContractMD
- func (n *NEO) ModifyAccountVotes(acc *state.NEOBalanceState, d dao.DAO, value *big.Int, typ int) error
- func (c *NEO) Name(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (n *NEO) OnPersist(ic *interop.Context) error
- func (n *NEO) RegisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error
- func (c *NEO) Symbol(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (c *NEO) TotalSupply(ic *interop.Context, _ []stackitem.Item) stackitem.Item
- func (c *NEO) Transfer(ic *interop.Context, args []stackitem.Item) stackitem.Item
- func (c *NEO) TransferInternal(ic *interop.Context, from, to util.Uint160, amount *big.Int) error
- func (n *NEO) UnregisterCandidateInternal(ic *interop.Context, pub *keys.PublicKey) error
- func (n *NEO) VoteInternal(ic *interop.Context, h util.Uint160, pub *keys.PublicKey) error
- type Policy
- func (p *Policy) CheckPolicy(d dao.DAO, tx *transaction.Transaction) error
- func (p *Policy) GetBlockedAccountsInternal(dao dao.DAO) (BlockedAccounts, error)
- func (p *Policy) GetFeePerByteInternal(dao dao.DAO) int64
- func (p *Policy) GetMaxBlockSizeInternal(dao dao.DAO) uint32
- func (p *Policy) GetMaxBlockSystemFeeInternal(dao dao.DAO) int64
- func (p *Policy) GetMaxTransactionsPerBlockInternal(dao dao.DAO) uint32
- func (p *Policy) GetMaxVerificationGas(_ dao.DAO) int64
- func (p *Policy) Initialize(ic *interop.Context) error
- func (p *Policy) Metadata() *interop.ContractMD
- func (p *Policy) OnPersist(ic *interop.Context) error
- func (p *Policy) OnPersistEnd(dao dao.DAO)
Constants ¶
const GASFactor = NEOTotalSupply
GASFactor is a divisor for finding GAS integral value.
const (
// NEOTotalSupply is the total amount of NEO in the system.
NEOTotalSupply = 100000000
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockedAccounts ¶
BlockedAccounts represents a slice of blocked accounts hashes.
func BlockedAccountsFromBytes ¶
func BlockedAccountsFromBytes(b []byte) (BlockedAccounts, error)
BlockedAccountsFromBytes converts serialized BlockedAccounts to structure.
func (*BlockedAccounts) Bytes ¶
func (ba *BlockedAccounts) Bytes() []byte
Bytes returns serialized BlockedAccounts.
func (*BlockedAccounts) DecodeBinary ¶
func (ba *BlockedAccounts) DecodeBinary(r *io.BinReader)
DecodeBinary implements io.Serializable interface.
func (*BlockedAccounts) EncodeBinary ¶
func (ba *BlockedAccounts) EncodeBinary(w *io.BinWriter)
EncodeBinary implements io.Serializable interface.
func (*BlockedAccounts) ToStackItem ¶
func (ba *BlockedAccounts) ToStackItem() stackitem.Item
ToStackItem converts BlockedAccounts to stackitem.Item
type Contracts ¶
type Contracts struct { NEO *NEO GAS *GAS Policy *Policy Contracts []interop.Contract // contains filtered or unexported fields }
Contracts is a set of registered native contracts.
func NewContracts ¶
func NewContracts() *Contracts
NewContracts returns new set of native contracts with new GAS, NEO and Policy contracts.
func (*Contracts) GetPersistScript ¶
GetPersistScript returns VM script calling "onPersist" method of every native contract.
type GAS ¶
type GAS struct { NEO *NEO // contains filtered or unexported fields }
GAS represents GAS native contract.
func (*GAS) Initialize ¶
Initialize initializes GAS contract.
func (*GAS) Metadata ¶
func (c *GAS) Metadata() *interop.ContractMD
func (*GAS) TotalSupply ¶
type NEO ¶
type NEO struct { GAS *GAS // contains filtered or unexported fields }
NEO represents NEO native contract.
func (*NEO) GetCandidates ¶ added in v0.91.0
GetCandidates returns current registered validators list with keys and votes.
func (*NEO) GetNextBlockValidatorsInternal ¶
func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
GetNextBlockValidatorsInternal returns next block validators.
func (*NEO) GetValidatorsInternal ¶
func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
GetValidatorsInternal returns a list of current validators.
func (*NEO) Initialize ¶
Initialize initializes NEO contract.
func (*NEO) Metadata ¶
func (c *NEO) Metadata() *interop.ContractMD
func (*NEO) ModifyAccountVotes ¶
func (n *NEO) ModifyAccountVotes(acc *state.NEOBalanceState, d dao.DAO, value *big.Int, typ int) error
ModifyAccountVotes modifies votes of the specified account by value (can be negative). typ specifies if this modify is occurring during transfer or vote (with old or new validator).
func (*NEO) RegisterCandidateInternal ¶ added in v0.91.0
RegisterCandidateInternal registers pub as a new candidate.
func (*NEO) TotalSupply ¶
func (*NEO) TransferInternal ¶ added in v0.91.0
TransferInternal transfers NEO between accounts.
func (*NEO) UnregisterCandidateInternal ¶ added in v0.91.0
UnregisterCandidateInternal unregisters pub as a candidate.
type Policy ¶
type Policy struct { interop.ContractMD // contains filtered or unexported fields }
Policy represents Policy native contract.
func (*Policy) CheckPolicy ¶
func (p *Policy) CheckPolicy(d dao.DAO, tx *transaction.Transaction) error
CheckPolicy checks whether transaction conforms to current policy restrictions like not being signed by blocked account or not exceeding block-level system fee limit.
func (*Policy) GetBlockedAccountsInternal ¶
func (p *Policy) GetBlockedAccountsInternal(dao dao.DAO) (BlockedAccounts, error)
GetBlockedAccountsInternal returns list of blocked accounts hashes.
func (*Policy) GetFeePerByteInternal ¶
GetFeePerByteInternal returns required transaction's fee per byte.
func (*Policy) GetMaxBlockSizeInternal ¶ added in v0.91.0
GetMaxBlockSizeInternal returns maximum block size.
func (*Policy) GetMaxBlockSystemFeeInternal ¶ added in v0.91.0
GetMaxBlockSystemFeeInternal the maximum overall system fee per block.
func (*Policy) GetMaxTransactionsPerBlockInternal ¶
GetMaxTransactionsPerBlockInternal returns the upper limit of transactions per block.
func (*Policy) GetMaxVerificationGas ¶ added in v0.91.0
GetMaxVerificationGas returns maximum gas allowed to be burned during verificaion.
func (*Policy) Initialize ¶
Initialize initializes Policy native contract and implements Contract interface.
func (*Policy) Metadata ¶
func (p *Policy) Metadata() *interop.ContractMD
Metadata implements Contract interface.
func (*Policy) OnPersistEnd ¶
OnPersistEnd updates cached Policy values if they've been changed