pub trait Nep17Token {
// Required methods
fn symbol(&self) -> NeoResult<NeoString>;
fn decimals(&self) -> NeoResult<u8>;
fn total_supply(&self) -> NeoResult<NeoInteger>;
fn balance_of(&self, account: &NeoByteString) -> NeoResult<NeoInteger>;
fn transfer(
&self,
from: &NeoByteString,
to: &NeoByteString,
amount: &NeoInteger,
data: &NeoValue,
) -> NeoResult<bool>;
}Expand description
NEP-17 fungible token standard trait.
Contracts implementing this trait are compliant with the NEP-17 token standard, which is the canonical fungible token interface on Neo N3.
Required Methods§
Sourcefn total_supply(&self) -> NeoResult<NeoInteger>
fn total_supply(&self) -> NeoResult<NeoInteger>
Returns the total token supply.
Sourcefn balance_of(&self, account: &NeoByteString) -> NeoResult<NeoInteger>
fn balance_of(&self, account: &NeoByteString) -> NeoResult<NeoInteger>
Returns the token balance of the given account.
Sourcefn transfer(
&self,
from: &NeoByteString,
to: &NeoByteString,
amount: &NeoInteger,
data: &NeoValue,
) -> NeoResult<bool>
fn transfer( &self, from: &NeoByteString, to: &NeoByteString, amount: &NeoInteger, data: &NeoValue, ) -> NeoResult<bool>
Transfers amount tokens from from to to.
The implementation MUST:
- Verify
fromwitness viacheck_witness - Return
falseif the balance is insufficient - Fire a
Transferevent on success - Call
onNEP17Paymentontoif it is a deployed contract
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".