Documentation ¶
Index ¶
- Constants
- func Deploy(ic *interop.Context, _ *vm.VM) 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
- type NEO
- func (c *NEO) Decimals(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
- func (n *NEO) GetRegisteredValidators(d dao.DAO) ([]state.Validator, 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) error
- func (c *NEO) Name(_ *interop.Context, _ []stackitem.Item) stackitem.Item
- func (n *NEO) OnPersist(ic *interop.Context) 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 (n *NEO) VoteInternal(ic *interop.Context, h util.Uint160, pubs keys.PublicKeys) error
- type Policy
- func (p *Policy) CheckPolicy(ic *interop.Context, tx *transaction.Transaction) (bool, error)
- func (p *Policy) GetBlockedAccountsInternal(dao dao.DAO) (BlockedAccounts, error)
- func (p *Policy) GetFeePerByteInternal(dao dao.DAO) int64
- func (p *Policy) GetMaxTransactionsPerBlockInternal(dao dao.DAO) uint32
- 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)
- type ValidatorsCount
Constants ¶
const GASFactor = NEOTotalSupply
GASFactor is a divisor for finding GAS integral value.
const MaxValidatorsVoted = 1024
MaxValidatorsVoted limits the number of validators that one can vote for.
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) GetNativeInterop ¶
GetNativeInterop returns an interop getter for a given set of 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) GetNextBlockValidatorsInternal ¶
func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) (keys.PublicKeys, error)
GetNextBlockValidatorsInternal returns next block validators.
func (*NEO) GetRegisteredValidators ¶
GetRegisteredValidators returns current registered validators list with keys and votes.
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 ¶
ModifyAccountVotes modifies votes of the specified account by value (can be negative).
func (*NEO) TotalSupply ¶
func (*NEO) VoteInternal ¶
VoteInternal votes from account h for validarors specified in pubs.
type Policy ¶
type Policy struct { interop.ContractMD // contains filtered or unexported fields }
Policy represents Policy native contract.
func (*Policy) CheckPolicy ¶
func (p *Policy) CheckPolicy(ic *interop.Context, tx *transaction.Transaction) (bool, error)
CheckPolicy checks whether transaction's script hashes for verifying are included into blocked accounts list.
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) GetMaxTransactionsPerBlockInternal ¶
GetMaxTransactionsPerBlockInternal returns the upper limit of transactions per block.
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
type ValidatorsCount ¶
type ValidatorsCount [MaxValidatorsVoted]big.Int
ValidatorsCount represents votes with particular number of consensus nodes for this number to be changeable by the voting system.
func ValidatorsCountFromBytes ¶
func ValidatorsCountFromBytes(b []byte) (*ValidatorsCount, error)
ValidatorsCountFromBytes converts serialized ValidatorsCount to structure.
func (*ValidatorsCount) Bytes ¶
func (vc *ValidatorsCount) Bytes() []byte
Bytes returns serialized ValidatorsCount.
func (*ValidatorsCount) DecodeBinary ¶
func (vc *ValidatorsCount) DecodeBinary(r *io.BinReader)
DecodeBinary implements io.Serializable interface.
func (*ValidatorsCount) EncodeBinary ¶
func (vc *ValidatorsCount) EncodeBinary(w *io.BinWriter)
EncodeBinary implements io.Serializable interface.
func (*ValidatorsCount) GetWeightedAverage ¶
func (vc *ValidatorsCount) GetWeightedAverage() int
GetWeightedAverage returns an average count of validators that's been voted for not counting 1/4 of minimum and maximum numbers.