Function std::asset::mint_to

pub fn mint_to(to: Identity, sub_id: SubId, amount: u64) 
Expand description

Mint amount coins of the current contract’s asset_id and transfer them
to to by calling either force_transfer_to_contract or
transfer_to_address, depending on the type of Identity.

Additional Information

If the to Identity is a contract, this will transfer coins to the contract even with no way to retrieve them
(i.e: no withdrawal functionality on the receiving contract), possibly leading to
the PERMANENT LOSS OF COINS if not used with care.

Arguments

  • to: [Identity] - The recipient identity.
  • sub_id: [SubId] - The sub identifier of the asset which to mint.
  • amount: [u64] - The amount of coins to mint.

Examples

use std::{constants::ZERO_B256, asset::mint_to};

fn foo() {
    let to_address = Identity::Address(Address::from(ZERO_B256));
    let to_contract_id = Identity::ContractId(ContractId::from(ZERO_B256));
    mint_to(to_address, ZERO_B256, 500);
    mint_to(to_contract_id, ZERO_B256, 500);
}