Trait NativeTokenExt

Source
pub trait NativeTokenExt {
    // Required methods
    fn native_token_initialize(
        &mut self,
        method_context: MethodContext,
        contract: Address,
        own_balance: &Address,
        max_issuance: &Balance,
    ) -> Result<NativeToken, ContractError>;
    fn native_token_balance(
        &self,
        contract: Address,
        target: &Address,
    ) -> Result<Balance, ContractError>;
    fn native_token_transfer(
        &mut self,
        method_context: MethodContext,
        contract: Address,
        from: &Address,
        to: &Address,
        amount: &Balance,
    ) -> Result<(), ContractError>;
}
Expand description

Extension trait that provides helper methods for calling NativeToken’s methods on Env for convenience purposes

Required Methods§

Source

fn native_token_initialize( &mut self, method_context: MethodContext, contract: Address, own_balance: &Address, max_issuance: &Balance, ) -> Result<NativeToken, ContractError>

Initialize native token on a shard with max issuance allowed by this shard.

Block rewards will be implemented using transfers from native token’s balance.

Source

fn native_token_balance( &self, contract: Address, target: &Address, ) -> Result<Balance, ContractError>

Source

fn native_token_transfer( &mut self, method_context: MethodContext, contract: Address, from: &Address, to: &Address, amount: &Balance, ) -> Result<(), ContractError>

Implementations on Foreign Types§

Source§

impl NativeTokenExt for Env<'_>

Source§

fn native_token_initialize( &mut self, method_context: MethodContext, contract: Address, own_balance: &Address, max_issuance: &Balance, ) -> Result<NativeToken, ContractError>

Source§

fn native_token_balance( &self, contract: Address, target: &Address, ) -> Result<Balance, ContractError>

Source§

fn native_token_transfer( &mut self, method_context: MethodContext, contract: Address, from: &Address, to: &Address, amount: &Balance, ) -> Result<(), ContractError>

Implementors§