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:
- Type Parameter (
T): Associates metadata (name, symbol, decimal precision) with each coin instance - Interchangeability: Units of
Tare fungible, mirroring traditional fiat currency behavior Documentation Terminology:
- "Coins" = Coin Standard creations
- "Tokens" = Closed-Loop Standard creations
Treasury Capability: Minting and Burning
The TreasuryCap object governs coin supply management:
- Creation: Generated via
coin::create_currencyfor contract publishers Functions:
coin::mint: Creates new tokens (auto-updates total supply)coin::burn: Destroys tokens (enforces supply limits)
- Transferability: Can be transferred to third parties, relinquishing original creator control
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
Creation: Via
coin::create_regulated_currency_v2which returns:- Standard
CoinMetadata - Additional
RegulatedCoinMetadata DenyCapV2capability
- Standard
Deny List System:
- Maintained in
DenyListshared object (ID:0x403) Managed through:
coin::deny_list_v2_add(block addresses)coin::deny_list_v2_remove(unblock addresses)
- Maintained in
Global Pause:
- Activated when
allow_global_pause=true Functions:
coin::deny_list_v2_enable_global_pausecoin::deny_list_v2_disable_global_pause
- Activated when
Metadata Objects
| CoinMetadata | RegulatedCoinMetadata |
|---|---|
id: Object ID | id: Object ID |
decimals: Precision | coin_metadata_object: Linked ID |
name: Display name | deny_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
| Function | Returns |
|---|---|
get_decimals() | u8 precision |
get_name() | String name |
get_symbol() | ASCII symbol |
get_description() | String summary |
get_icon_url() | Option of URL |
Supply Monitoring
coin::supply(): Returns current circulating amount
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