neo

package
v0.0.0-...-dc6c195 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: MIT Imports: 4 Imported by: 11

Documentation

Overview

Package neo provides an interface to NeoToken native contract. NEO token is special, it's not just a regular NEP-17 contract, it also provides access to chain-specific settings and implements committee voting system.

Index

Constants

View Source
const Hash = "\xf5\x63\xea\x40\xbc\x28\x3d\x4d\x0e\x05\xc4\x8e\xa3\x05\xb3\xf2\xa0\x73\x40\xef"

Hash represents NEO contract hash.

Variables

This section is empty.

Functions

func BalanceOf

func BalanceOf(addr interop.Hash160) int

BalanceOf represents `balanceOf` method of NEO native contract.

func Decimals

func Decimals() int

Decimals represents `decimals` method of NEO native contract.

func GetAllCandidates

func GetAllCandidates() iterator.Iterator

GetAllCandidates represents `getAllCandidates` method of NEO native contract. It returns Iterator over the whole set of Neo candidates sorted by public key bytes. Each iterator value can be cast to Candidate. Use iterator interop package to work with the returned Iterator.

func GetCandidateVote

func GetCandidateVote(pub interop.PublicKey) int

GetCandidateVote represents `getCandidateVote` method of NEO native contract. It returns -1 if the candidate hasn't been registered or voted for and the overall candidate votes otherwise.

func GetCommittee

func GetCommittee() []interop.PublicKey

GetCommittee represents `getCommittee` method of NEO native contract.

func GetCommitteeAddress

func GetCommitteeAddress() interop.Hash160

GetCommitteeAddress represents `getCommitteeAddress` method of NEO native contract.

func GetGASPerBlock

func GetGASPerBlock() int

GetGASPerBlock represents `getGasPerBlock` method of NEO native contract.

func GetNextBlockValidators

func GetNextBlockValidators() []interop.PublicKey

GetNextBlockValidators represents `getNextBlockValidators` method of NEO native contract.

func GetRegisterPrice

func GetRegisterPrice() int

GetRegisterPrice represents `getRegisterPrice` method of NEO native contract.

func RegisterCandidate

func RegisterCandidate(pub interop.PublicKey) bool

RegisterCandidate represents `registerCandidate` method of NEO native contract.

func SetGASPerBlock

func SetGASPerBlock(amount int)

SetGASPerBlock represents `setGasPerBlock` method of NEO native contract.

func SetRegisterPrice

func SetRegisterPrice(amount int)

SetRegisterPrice represents `setRegisterPrice` method of NEO native contract.

func Symbol

func Symbol() string

Symbol represents `symbol` method of NEO native contract.

func TotalSupply

func TotalSupply() int

TotalSupply represents `totalSupply` method of NEO native contract.

func Transfer

func Transfer(from, to interop.Hash160, amount int, data any) bool

Transfer represents `transfer` method of NEO native contract.

func UnclaimedGAS

func UnclaimedGAS(addr interop.Hash160, end int) int

UnclaimedGAS represents `unclaimedGas` method of NEO native contract.

func UnregisterCandidate

func UnregisterCandidate(pub interop.PublicKey) bool

UnregisterCandidate represents `unregisterCandidate` method of NEO native contract.

func Vote

func Vote(addr interop.Hash160, pub interop.PublicKey) bool

Vote represents `vote` method of NEO native contract.

Types

type AccountState

type AccountState struct {
	Balance        int
	Height         int
	VoteTo         interop.PublicKey
	LastGasPerVote int
}

AccountState contains info about a NEO holder.

func GetAccountState

func GetAccountState(addr interop.Hash160) *AccountState

GetAccountState represents `getAccountState` method of NEO native contract.

type Candidate

type Candidate struct {
	Key   interop.PublicKey
	Votes int
}

Candidate represents a single native Neo candidate.

func GetCandidates

func GetCandidates() []Candidate

GetCandidates represents `getCandidates` method of NEO native contract. It returns up to 256 candidates. Use GetAllCandidates in case if you need the whole set of candidates.

Jump to

Keyboard shortcuts

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