pub trait MultiFungibleTokenCore {
    fn mt_batch_transfer(
        &mut self,
        receiver_id: AccountId,
        token_ids: Vec<AccountId>,
        amounts: Vec<U128>,
        memo: Option<String>
    ); fn mt_batch_transfer_call(
        &mut self,
        receiver_id: AccountId,
        token_ids: Vec<AccountId>,
        amounts: Vec<U128>,
        memo: Option<String>,
        msg: String
    ) -> PromiseOrValue<U128>; fn mt_total_supply(&self, token_id: AccountId) -> U128; fn mt_balance_of(&self, account_id: AccountId, token_id: AccountId) -> U128; fn mt_add_token(&mut self, token_id: AccountId); }

Required Methods§

Transfers positive amount of tokens from the env::predecessor_account_id to receiver_id. Both accounts must be registered with the contract for transfer to succeed. (See NEP-145) This method must to be able to accept attached deposits, and must not panic on attached deposit. Exactly 1 yoctoNEAR must be attached. See the Security section of the standard.

Arguments:

  • receiver_id - the account ID of the receiver.
  • amount - the amount of tokens to transfer. Must be a positive number in decimal string representation.
  • memo - an optional string field in a free form to associate a memo with this transfer.

Transfers positive amount of tokens from the env::predecessor_account_id to receiver_id account. Then calls mt_on_transfer method on receiver_id contract and attaches a callback to resolve this transfer. mt_on_transfer method must return the amount of tokens unused by the receiver contract, the remaining tokens must be refunded to the predecessor_account_id at the resolve transfer callback.

Token contract must pass all the remaining unused gas to the mfton_transfer call.

Malicious or invalid behavior by the receiver’s contract:

  • If the receiver contract promise fails or returns invalid value, the full transfer amount must be refunded.
  • If the receiver contract overspent the tokens, and the receiver_id balance is lower than the required refund amount, the remaining balance must be refunded. See the Security section of the standard.

Both accounts must be registered with the contract for transfer to succeed. (See #145) This method must to be able to accept attached deposits, and must not panic on attached deposit. Exactly 1 yoctoNEAR must be attached. See the Security section of the standard.

Arguments:

  • receiver_id - the account ID of the receiver contract. This contract will be called.
  • amount - the amount of tokens to transfer. Must be a positive number in a decimal string representation.
  • memo - an optional string field in a free form to associate a memo with this transfer.
  • msg - a string message that will be passed to mfton_transfer contract call.

Returns a promise which will result in the amount of tokens withdrawn from sender’s account.

Returns the total supply of the token in a decimal string representation.

Returns the balance of the account. If the account doesn’t exist must returns "0".

Implementors§