gas

class GAS

Bases: object

A class used to represent the GAS native contract

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

Gets the symbol of GAS.

Returns

the GAS string.

Return type

str

classmethod decimals()int

Gets the amount of decimals used by GAS.

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 GAS 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.