neo

class NEO

Bases: object

A class used to represent the NEO native contract

hash: boa3.builtin.type.UInt160
classmethod symbol()str

Gets the symbol of NEO.

Returns

the NEO string.

Return type

str

classmethod decimals()int

Gets the amount of decimals used by NEO.

Returns

the number 8.

Return type

int

classmethod totalSupply()int

Gets the total token supply deployed in the system.

Returns

the total token supply deployed in the system.

Return type

int

classmethod balanceOf(account: boa3.builtin.type.UInt160)int

Get the current balance of an address.

Parameters

account (UInt160) – the account’s address to retrieve the balance for

Returns

the account’s balance

Return type

int

classmethod transfer(from_address: boa3.builtin.type.UInt160, to_address: boa3.builtin.type.UInt160, amount: int, data: Optional[Any] = None)bool

Transfers an amount of GAS from one account to another

If the method succeeds, it will fire the Transfer event and must return true, even if the amount is 0, or from and to are the same address.

Parameters
  • from_address (UInt160) – the address to transfer from

  • to_address (UInt160) – the address to transfer to

  • amount (int) – the amount of NEO to transfer

  • data (Any) – whatever data is pertinent to the onNEP17Payment method

Returns

whether the transfer was successful

Return type

bool

Raises

Exception – raised if from_address or to_address length is not 20 or if amount is less than zero.

classmethod get_gas_per_block()int

Gets the amount of GAS generated in each block.

Returns

the amount of GAS generated

Return type

int

classmethod unclaimed_gas(account: boa3.builtin.type.UInt160, end: int)int

Gets the amount of unclaimed GAS in the specified account.

Parameters
  • account (UInt160) – the account to check

  • end (int) – the block index used when calculating GAS

classmethod register_candidate(pubkey: boa3.builtin.type.ECPoint)bool

Registers as a candidate.

Parameters

pubkey (ECPoint) – The public key of the account to be registered

Returns

whether the registration was a success or not

Return type

bool

classmethod unregister_candidate(pubkey: boa3.builtin.type.ECPoint)bool

Unregisters as a candidate.

Parameters

pubkey (ECPoint) – The public key of the account to be unregistered

Returns

whether the unregistration was a success or not

Return type

bool

classmethod vote(account: boa3.builtin.type.UInt160, vote_to: boa3.builtin.type.ECPoint)bool

Votes for a candidate.

Parameters
  • account (UInt160) – the account that is voting

  • vote_to (ECPoint) – the public key of the one being voted

classmethod get_all_candidates()boa3.builtin.interop.iterator.Iterator

Gets the registered candidates iterator.

Returns

all registered candidates

Return type

Iterator

classmethod un_vote(account: boa3.builtin.type.UInt160)bool

Removes the vote of the candidate voted. It would be the same as calling vote(account, None).

Parameters

account (UInt160) – the account that is removing the vote

classmethod get_candidates()List[Tuple[boa3.builtin.type.ECPoint, int]]

Gets the list of all registered candidates.

Returns

all registered candidates

Return type

List[Tuple[ECPoint, int]]

classmethod get_candidate_vote(pubkey: boa3.builtin.type.ECPoint)int

Gets votes from specific candidate.

Returns

Votes or -1 if it was not found.

Return type

int

classmethod get_committee()List[boa3.builtin.type.ECPoint]

Gets all committee members list.

Returns

all committee members

Return type

List[ECPoint]

classmethod get_next_block_validators()List[boa3.builtin.type.ECPoint]

Gets validators list of the next block.

Returns

the public keys of the validators

Return type

List[ECPoint]

classmethod get_account_state(account: boa3.builtin.type.UInt160)boa3.builtin.contract.NeoAccountState

Gets the latest votes of the specified account.

Parameters

account (UInt160) – the specified account

Returns

the state of the account

Return type

NeoAccountState