multiversx_sc_modules::esdt

Trait EsdtModule

Source
pub trait EsdtModule: ContractBase + Sized {
    // Required methods
    fn token_id(
        &self,
    ) -> SingleValueMapper<Self::Api, TokenIdentifier<Self::Api>>;
    fn callbacks(&self) -> CallbackProxyObj<Self::Api>;

    // Provided methods
    fn issue_token(
        &self,
        token_display_name: ManagedBuffer<Self::Api>,
        token_ticker: ManagedBuffer<Self::Api>,
        token_type: EsdtTokenType,
        opt_num_decimals: OptionalValue<usize>,
    ) { ... }
    fn issue_callback(
        &self,
        result: ManagedAsyncCallResult<Self::Api, TokenIdentifier<Self::Api>>,
    ) { ... }
    fn mint(&self, token_nonce: u64, amount: &BigUint<Self::Api>) { ... }
    fn burn(&self, token_nonce: u64, amount: &BigUint<Self::Api>) { ... }
    fn nft_create<T: TopEncode>(
        &self,
        amount: &BigUint<Self::Api>,
        attributes: &T,
    ) -> u64 { ... }
    fn get_token_attributes<T: TopDecode>(&self, token_nonce: u64) -> T { ... }
    fn require_token_issued(&self) { ... }
}
Expand description

Standard smart contract module for managing a single ESDT.

When added to a smart contract offers basic ESDT usage. A lot of contracts use an owned ESDT for various purposes. This module is used to offer a standard way of performing the basic operations.

It provides endpoints for:

  • issuing of an ESDT
  • setting local roles
  • minting/burning

Required Methods§

Provided Methods§

Source

fn issue_token( &self, token_display_name: ManagedBuffer<Self::Api>, token_ticker: ManagedBuffer<Self::Api>, token_type: EsdtTokenType, opt_num_decimals: OptionalValue<usize>, )

Source

fn issue_callback( &self, result: ManagedAsyncCallResult<Self::Api, TokenIdentifier<Self::Api>>, )

Source

fn mint(&self, token_nonce: u64, amount: &BigUint<Self::Api>)

Source

fn burn(&self, token_nonce: u64, amount: &BigUint<Self::Api>)

Source

fn nft_create<T: TopEncode>( &self, amount: &BigUint<Self::Api>, attributes: &T, ) -> u64

Source

fn get_token_attributes<T: TopDecode>(&self, token_nonce: u64) -> T

Source

fn require_token_issued(&self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C> EsdtModule for C
where C: AutoImpl,