Module 0x2::coin
Defines the Coin type - platform wide representation of fungible tokens and coins. Coin can be described as a secure wrapper around Balance type.
- Resource
Coin
- Resource
CoinMetadata
- Resource
RegulatedCoinMetadata
- Resource
TreasuryCap
- Resource
DenyCapV2
- Struct
CurrencyCreated
- Resource
DenyCap
- Constants
- Function
total_supply
- Function
treasury_into_supply
- Function
supply_immut
- Function
supply_mut
- Function
value
- Function
balance
- Function
balance_mut
- Function
from_balance
- Function
into_balance
- Function
take
- Function
put
- Function
join
- Function
split
- Function
divide_into_n
- Function
zero
- Function
destroy_zero
- Function
create_currency
- Function
create_regulated_currency_v2
- Function
migrate_regulated_currency_to_v2
- Function
mint
- Function
mint_balance
- Function
burn
- Function
deny_list_v2_add
- Function
deny_list_v2_remove
- Function
deny_list_v2_contains_current_epoch
- Function
deny_list_v2_contains_next_epoch
- Function
deny_list_v2_enable_global_pause
- Function
deny_list_v2_disable_global_pause
- Function
deny_list_v2_is_global_pause_enabled_current_epoch
- Function
deny_list_v2_is_global_pause_enabled_next_epoch
- Function
mint_and_transfer
- Function
update_name
- Function
update_symbol
- Function
update_description
- Function
update_icon_url
- Function
get_decimals
- Function
get_name
- Function
get_symbol
- Function
get_description
- Function
get_icon_url
- Function
supply
- Function
create_regulated_currency
- Function
deny_list_add
- Function
deny_list_remove
- Function
deny_list_contains
use 0x1::ascii;
use 0x1::option;
use 0x1::string;
use 0x1::type_name;
use 0x2::balance;
use 0x2::deny_list;
use 0x2::object;
use 0x2::transfer;
use 0x2::tx_context;
use 0x2::types;
use 0x2::url;
Resource Coin
A coin of type T worth value. Transferable and storable
struct Coin<T> has store, key
Fields
- id: object::UID
- balance: balance::Balance<T>
Resource CoinMetadata
Each Coin type T created through create_currency function will have a
unique instance of CoinMetadata
struct CoinMetadata<T> has store, key
Fields
- id: object::UID
- decimals: u8
- Number of decimal places the coin uses. A coin with value N and decimals D should be shown as N / 10^D E.g., a coin with value 7002 and decimals 3 should be displayed as 7.002 This is metadata for display usage only.
- name: string::String
- Name for the token
- symbol: ascii::String
- Symbol for the token
- description: string::String
- Description of the token
- icon_url: option::Option<url::Url>
- URL for the token logo
Resource RegulatedCoinMetadata
Similar to CoinMetadata, but created only for regulated coins that use the DenyList. This object is always immutable.
struct RegulatedCoinMetadata<T> has key
Fields
- id: object::UID
- coin_metadata_object: object::ID
- The ID of the coin's CoinMetadata object.
- deny_cap_object: object::ID
- The ID of the coin's DenyCap object.
Resource TreasuryCap
Capability allowing the bearer to mint and burn coins of type T. Transferable
struct TreasuryCap<T> has store, key
Fields
- id: object::UID
- total_supply: balance::Supply<T>
Resource DenyCapV2
Capability allowing the bearer to deny addresses from using the currency's coins-- immediately preventing those addresses from interacting with the coin as an input to a transaction and at the start of the next preventing them from receiving the coin. If allow_global_pause is true, the bearer can enable a global pause that behaves as if all addresses were added to the deny list.
struct DenyCapV2<T> has store, key
Fields
- id: object::UID
- allow_global_pause: bool
Struct CurrencyCreated
struct CurrencyCreated<T> has copy, drop
Fields
- decimals: u8