Coin Standard on Sui Blockchain: A Comprehensive Guide

ยท

The Coin Standard is the technical framework used for smart contract development on the Sui blockchain, enabling the creation of standardized digital coins. This standardization ensures seamless integration across wallets, exchanges, and smart contracts, allowing all Sui-created coins to be managed with the same logic as the native SUI token.

๐Ÿ‘‰ Explore Sui blockchain capabilities


Fungible Tokens on Sui

In Sui's ecosystem, the Coin type represents open-loop fungible tokens (distinct from closed-loop Token types). Key characteristics include:


Treasury Capability: Minting and Burning

The TreasuryCap object governs coin supply management:

Example Mint Function:

public fun mint(cap: &mut TreasuryCap, value: u64, ctx: &mut TxContext): Coin {
    Coin {
        id: object::new(ctx),
        balance: cap.total_supply.increase_supply(value),
    }
}

Regulated Coins Framework

Enhanced functionality for compliance-focused tokens:

Core Components

  1. Creation: Via coin::create_regulated_currency_v2 which returns:

    • Standard CoinMetadata
    • Additional RegulatedCoinMetadata
    • DenyCapV2 capability
  2. Deny List System:

    • Maintained in DenyList shared object (ID: 0x403)
    • Managed through:

      • coin::deny_list_v2_add (block addresses)
      • coin::deny_list_v2_remove (unblock addresses)
  3. Global Pause:

    • Activated when allow_global_pause=true
    • Functions:

      • coin::deny_list_v2_enable_global_pause
      • coin::deny_list_v2_disable_global_pause

Metadata Objects

CoinMetadataRegulatedCoinMetadata
id: Object IDid: Object ID
decimals: Precisioncoin_metadata_object: Linked ID
name: Display namedeny_cap_object: Control reference
symbol: Ticker
description: Summary
icon_url: Visual asset

SDK Implementation Examples

TypeScript (Deny List Management)

const tx = new Transaction();
tx.moveCall({
    target: `0x2::coin::deny_list_v2_add`,
    arguments: [
        tx.object('0x403'),
        tx.object('<DenyCapV2_ID>'),
        tx.pure.address('<TARGET_ADDRESS>')
    ],
    typeArguments: ['<COIN_TYPE>']
});

Rust (Global Pause)

#[allow(unused_mut_parameter)]
public fun deny_list_v2_enable_global_pause(
    deny_list: &mut DenyList,
    deny_cap: &mut DenyCapV2,
    ctx: &mut TxContext
) {
    assert!(deny_cap.allow_global_pause, EGlobalPauseNotAllowed);
    let ty = type_name::get_with_original_ids().into_string().into_bytes();
    deny_list.v2_enable_global_pause(DENY_LIST_COIN_INDEX, ty, ctx)
}

Query Functions for Coin Data

Metadata Accessors

FunctionReturns
get_decimals()u8 precision
get_name()String name
get_symbol()ASCII symbol
get_description()String summary
get_icon_url()Option of URL

Supply Monitoring


FAQ: Coin Standard on Sui

Q: Can regular coins be converted to regulated coins?
A: No - regulation features must be implemented during initial creation via create_regulated_currency_v2.

Q: How quickly do deny list changes take effect?
A: Transaction blocking is immediate; receiving blocks apply at next epoch (~24 hours).

Q: Is metadata modifiable after creation?
A: Only for regular coins if not frozen. Regulated coin metadata is permanently frozen.

Q: What happens to coins during global pause?
A: All transaction inputs are blocked immediately. Receiving blocks activate next epoch.

Q: Can multiple addresses control deny lists?
A: Only the current DenyCapV2 bearer can modify the list - capability ownership is exclusive.

๐Ÿ‘‰ Learn more about Sui tokenomics


Additional Resources