Module 0x2::iota
Coin<IOTA>
is the token used to pay for gas in IOTA.
It has 9 decimals, and the smallest unit (10^-9) is called "nano".
- Struct
IOTA
- Struct
IotaTreasuryCap
- Constants
- Function
new
- Function
transfer
- Function
mint
- Function
mint_balance
- Function
burn
- Function
burn_balance
- Function
total_supply
use 0x1::option;
use 0x2::balance;
use 0x2::coin;
use 0x2::transfer;
use 0x2::tx_context;
use 0x2::url;
Struct IOTA
Name of the coin
struct IOTA has drop
Fields
Struct IotaTreasuryCap
The IOTA token treasury capability. Protects the token from unauthorized changes.
struct IotaTreasuryCap has store
Fields
Constants
Sender is not @0x0 the system address.
const ENotSystemAddress: u64 = 1;
const EAlreadyMinted: u64 = 0;
Function new
Register the IOTA
Coin to acquire IotaTreasuryCap
.
This should be called only once during genesis creation.
fun new(ctx: &mut tx_context::TxContext): iota::IotaTreasuryCap
Implementation
Function transfer
public entry fun transfer(c: coin::Coin<iota::IOTA>, recipient: address)
Implementation
Function mint
Create an IOTA coin worth value
and increase the total supply in cap
accordingly.
public fun mint(cap: &mut iota::IotaTreasuryCap, value: u64, ctx: &mut tx_context::TxContext): coin::Coin<iota::IOTA>
Implementation
Function mint_balance
Mint some amount of IOTA as a Balance
and increase the total supply in cap
accordingly.
Aborts if value
+ cap.inner.total_supply
>= U64_MAX
public fun mint_balance(cap: &mut iota::IotaTreasuryCap, value: u64, ctx: &tx_context::TxContext): balance::Balance<iota::IOTA>
Implementation
Function burn
Destroy the IOTA coin c
and decrease the total supply in cap
accordingly.
public fun burn(cap: &mut iota::IotaTreasuryCap, c: coin::Coin<iota::IOTA>, ctx: &tx_context::TxContext): u64
Implementation
Function burn_balance
Destroy the IOTA balance b
and decrease the total supply in cap
accordingly.
public fun burn_balance(cap: &mut iota::IotaTreasuryCap, b: balance::Balance<iota::IOTA>, ctx: &tx_context::TxContext): u64
Implementation
Function total_supply
Return the total number of IOTA's in circulation.
public fun total_supply(cap: &iota::IotaTreasuryCap): u64