Coin Standard
The Coin standard is the technical standard used for smart contracts on Sui for creating coins on the Sui blockchain. The standardization of coin creation on Sui means that wallets, exchanges, and other smart contracts can manage coins created on Sui the same as they manage SUI, without any additional processing logic.
See Sui Tokenomics to learn more about the SUI native coin and its use on the Sui network.
Although coins on Sui follow the Coin standard, they can offer specialized abilities. For example, you can create a regulated token that allows its creator to add specific addresses to a deny list, so that the identified addresses cannot use the token as inputs to transactions.
See the coin module documentation for all available options when creating a coin-type token on Sui.
Fungible tokens
In the Sui blockchain ecosystem, the Coin<T>
type represents open-loop fungible tokens (see Token<T>
for closed-loop tokens). Coins are denominated by their type parameter, T
, which is also associated with metadata (like name, symbol, decimal precision, and so on) that applies to all instances of Coin<T>
. The sui::coin
module exposes an interface over Coin<T>
that treats it as fungible, meaning that a unit of T
held in one instance of Coin<T>
is interchangeable with any other unit of T
, much like how traditional fiat currencies operate.
The documentation refers to fungible tokens created on Sui using the Coin standard as "coins". For fungible tokens created on Sui using the Closed-Loop Token standard, the documentation uses the term "tokens". In practice, the terms for both these objects are often interchangeable.
Treasury capability
When you create a coin using the coin::create_currency
function, the publisher of the smart contract that creates the coin receives a TreasuryCap
object. The TreasuryCap
object is required to mint new coins or to burn current ones. Consequently, only addresses that have access to this object are able to maintain the coin supply on the Sui network.
The TreasuryCap
object is transferable, so a third party can take over the management of a coin that you create if you transfer the TreasuryCap
. After transferring the capability, however, you are no longer able to mint and burn tokens yourself.
Regulated coins
The Coin standard includes the ability to create regulated coins. To create a regulated coin, you use the coin::create_regulated_currency_v2
function (which uses the coin::create_currency
function itself), but which also returns a DenyCap
capability. The DenyCap
capability allows the bearer to maintain a list of addresses that aren't allowed to use the token.
The regulated-coin-sample repository provides an example of regulated coin creation.
DenyList object
The list of addresses that aren't able to use a particular regulated coin is held within a system-created DenyList
shared object. If you have access to the DenyCap
, then you can use the coin::deny_list_v2_add
and coin::deny_list_v2_remove
functions to add and remove addresses.
Global pause switch
Regulated coin objects include an allow_global_pause
Boolean field. When set to true
, the bearer of the DenyCapV2
object for the coin type can use the coin::deny_list_v2_enable_global_pause
function to pause coin activity indefinitely. Immediately upon the bearer initiating the pause, the network disallows the coin type as input for any transactions. At the start of the next epoch (epochs last ~24 hours), the network additionally disallows all addresses from receiving the coin type.
When the bearer of the DenyCapV2
object for the coin type removes the pause using coin::deny_list_v2_disable_global_pause
, the coins are immediately available to use again as transaction inputs. Addresses cannot receive the coin type, however, until the following epoch.
The global pause functionality does not affect the deny list for the coin. After clearing the pause for the coin, any addresses included in the deny list are still unable to interact with the coin.
Coin metadata
Each coin you create includes metadata that describes it. Typically, smart contracts freeze this object upon creation using the transfer::public_freeze_object
function because the metadata for coins should almost never change. Regulated coins freeze the metadata they create automatically.
Regular coins using the Coin standard include a CoinMetadata
object. As mentioned previously, regulated coins build on top of the same procedure that creates regular coins, so they receive the same metadata object in addition to a RegulatedCoinMetadata
object that includes deny list information.
The fields of the metadata objects include the following:
CoinMetadata
Name | Description |
---|---|
id | The object ID of the metadata for the token. |
decimals | The number of decimals the token uses. If you set this field to 3 , then a token of value 1000 would display as 1.000 . |
name | Name of the coin. |
symbol | Symbol for the coin. This might be the same as name , but is typically fewer than five all capital letters. For example, SUI is the symbol for the native coin on Sui but its name is also SUI . |
description | A short description to describe the token. |
icon_url | The URL for the token's icon, used for display in wallets, explorers, and other apps. |