Module 0xa9::token
use 0x1::option;
use 0x2::coin;
use 0x2::transfer;
use 0x2::tx_context;
use 0x2::url;
Struct TOKEN
struct TOKEN has drop
Fields
-
dummy_field: bool
-
Function init
fun init(witness: token::TOKEN, ctx: &mut tx_context::TxContext)
Implementation
fun init(witness: TOKEN, ctx: &mut TxContext) {
let (treasury_cap, coin_metadata) = coin::create_currency(
witness,
9,
b"InterchainTokenService",
b"InterchainTokenService Example Coin",
b"",
option::none(),
ctx,
);
transfer::public_transfer(treasury_cap, tx_context::sender(ctx));
transfer::public_transfer(coin_metadata, tx_context::sender(ctx));
}
Function mint
public fun mint(treasury_cap: &mut coin::TreasuryCap<token::TOKEN>, amount: u64, to: address, ctx: &mut tx_context::TxContext)
Implementation
public fun mint(
treasury_cap: &mut TreasuryCap<TOKEN>,
amount: u64,
to: address,
ctx: &mut TxContext,
) {
treasury_cap.mint_and_transfer(amount, to, ctx);
}