Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/content/concepts/gaming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ In-game currencies allow users to purchase game features like items, upgrades, a

Using Sui, players can now have true ownership of their in-game currency. The currency exists as a token on the Sui blockchain, where players can conceivably buy, sell, or swap that currency for anything else that also lives on chain. If you create an ecosystem of games, players can purchase currency in one of your games but spend it in another one that also uses that same currency. The possibilities are vast, but you must first learn how to create the currency. The following topics can get you started.

- [Coin Standard](../standards/coin.mdx)
- [In-Game Currency](../guides/developer/coin/in-game-token.mdx)
- [Currency Standard](/standards/currency.mdx)
- [In-Game Currency](/guides/developer/coin/in-game-token.mdx)

### Tokens

Expand Down Expand Up @@ -460,8 +460,8 @@ By integrating these Sui blockchain features, ArcaneBattles not only enhances th

## Related links

<RelatedLink to="/standards/coin.mdx" />
<RelatedLink to="/guides/developer/coin.mdx" />
<RelatedLink to="/standards/currency.mdx" />
<RelatedLink to="/guides/developer/currency.mdx" />
<RelatedLink to="/guides/developer/nft.mdx" />
<RelatedLink to="/guides/developer/nft/asset-tokenization.mdx" />
<RelatedLink to="/guides/developer/nft/nft-rental.mdx" />
Expand Down
3 changes: 1 addition & 2 deletions docs/content/guides.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ Monitor the Sui network and programmatically react to on-chain events.

Learn how to mint various tokens on the Sui blockchain.
<Cards>
<Card title="Coins and tokens" href="/guides/developer/coin" />
<Card title="Stablecoins" href="/guides/developer/stablecoins" />
<Card title="Currencies and tokens" href="/guides/developer/currency" />
<Card title="NFTs" href="/guides/developer/nft" />
</Cards>

Expand Down
2 changes: 1 addition & 1 deletion docs/content/guides/developer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The developer guides are meant to introduce you to the Move programming language
</Card>
<Card title="Sui 101" href="/guides/developer/sui-101">
</Card>
<Card title="Coins, tokens, and NFTs" href="/guides/developer/coin">
<Card title="Coins, tokens, and NFTs" href="/guides/developer/currency">
</Card>
<Card title="Cryptography" href="/guides/developer/cryptography">
</Card>
Expand Down
16 changes: 10 additions & 6 deletions docs/content/guides/developer/coin-index.mdx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---
title: Coins
description: Learn about creating, managing, and using coins on Sui, including regulated tokens, in-game currencies, and loyalty tokens.
keywords: [ coin, coins, sui coin, regulated coin, in-game token, loyalty token, token design, tokenomics ]
title: Currencies and Tokens
description: Learn about creating and managing currencies and tokens on Sui using the Coin Registry system and `token` module, including regulated tokens, in-game currencies, and loyalty tokens.
keywords: [ coin, coins, sui coin, regulated coin, in-game token, loyalty token, token design, tokenomics, coin registry, currency registry ]
pagination_prev: null
---

Learn how to design and implement coins on Sui.
Learn how to design and implement currencies and tokens on Sui.

<Cards>
<Card title="Create Coins and Tokens" href="/guides/developer/coin">
<Card title="Create Currencies and Tokens" href="/guides/developer/currency">
Learn how to create currencies using the Coin Registry.
</Card>
<Card title="Regulated Coin and Deny List" href="/guides/developer/coin/regulated">
<Card title="Regulated Currency and Deny List" href="/guides/developer/coin/regulated">
Create regulated currencies with deny list capabilities.
</Card>
<Card title="In-Game Currency" href="/guides/developer/coin/in-game-token">
Use Closed-Loop Tokens for in-game currencies and restricted-use tokens.
</Card>
<Card title="Loyalty Tokens" href="/guides/developer/coin/loyalty">
Implement loyalty programs using the Closed-Loop Token standard.
</Card>
</Cards>
74 changes: 0 additions & 74 deletions docs/content/guides/developer/coin.mdx

This file was deleted.

27 changes: 19 additions & 8 deletions docs/content/guides/developer/coin/regulated.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
---
title: Regulated Coin and Deny List
description: You can create regulated coins on Sui, such as stablecoins. These coins are similar to other coins, like SUI, but include the ability to control access to the coin using a deny list.
keywords: [ regulated coin list, regulated coins, regulate coin, allow list, deny list, stablecoins, token example, create a token, how to create token, SUI token standards ]
title: Regulated Currency and Deny List
description: You can create regulated currencies on Sui using the Coin Registry system. These coins include the ability to control access using a deny list.
keywords: [ regulated coin list, regulated coins, regulate coin, allow list, deny list, stablecoins, token example, create a token, how to create token, SUI token standards, coin registry ]
---

You can create regulated coins on Sui, such as [stablecoins](../stablecoins.mdx). These coins are similar to other coins, like SUI, but include the ability to control access to the coin using a deny list.
You can create regulated currencies on Sui, such as stablecoins. These coins are similar to other coins, like SUI, but include the ability to control access to the currency using a deny list.

When creating standard coins, you call the `create_currency` function in the `coin` package of the Sui framework, whether directly or via an SDK. When you create regulated coins, you call the `create_regulated_currency_v2` function in that same package instead. The `create_regulated_currency_v2` function actually leverages the `create_currency` function to create the coin, but adds an additional step that produces a `DenyCapV2` and transfers it to the publisher of the regulated coin package. The bearer of the transferrable `DenyCapV2` object can control access to the coin through a deny list.
The Coin Registry system provides enhanced regulatory features through the `sui::coin_registry` module:

1. **During initialization:** Use the `make_regulated()` function on the `CurrencyInitializer<T>` before calling `finalize()`.
2. **Regulatory tracking:** The registry automatically tracks regulatory status in the `RegulatedState` enum.
3. **Enhanced compliance:** Built-in support for global pause functionality and better ecosystem integration.

Advantages of these regulatory features include:

- **Centralized tracking:** Regulatory status is stored in the registry for easy discovery.
- **Global pause support:** Enhanced pause/unpause functionality for emergency situations.
- **Compliance tooling:** Better integration with wallets, exchanges, and compliance systems.
- **Migration support:** Seamless migration from legacy regulated coins.

## `DenyList`

Expand All @@ -18,7 +29,7 @@ The `DenyList` object is a system object that has the address `0x403`. You canno

:::

To learn about the features available, see the [Coin standard](../../../standards/coin.mdx) documentation and the `coin` module in the <UnsafeLink href="/references/framework/sui/coin">Sui framework</UnsafeLink>.
To learn about the features available, see the [Currency Standard](/standards/currency.mdx) documentation and the `coin_registry` module in the Sui framework.

## Regulated coin example

Expand Down Expand Up @@ -75,7 +86,7 @@ The example uses a single file to create the smart contract for the project (`re

### Creating regulated coins

The Sui Coin standard provides a `create_regulated_currency_v2` function to create regulated coins. This function actually uses `create_currency` to mint a coin, but extends the function by also creating and transferring a `DenyCapV2` capability. The `DenyCapV2` bearer can add and remove addresses from a list that controls, or regulates, access to the coin. This ability is a requirement for assets like stablecoins.
The Sui Currency Standard provides a `new_currency_with_otw` function to create currency using a One-Time Witness. To make the currency regulated, the module provides a `make_regulated` function that initializes the regulated currency and returns a `DenyCapV2`. The `DenyCapV2` bearer can add and remove addresses from a list that controls, or regulates, access to the coin. This ability is a requirement for assets like stablecoins.

The TypeScript and Rust clients handle the call to the `coin` package's `mint` function. The `coin` package also includes a `mint_and_transfer` function you could use to perform the same task, but the composability of minting the coin in one command and transferring with another is preferable. Using two explicit commands allows you to implement future logic between the minting of the coin and the transfer. The structure of programmable transaction blocks means you're still making and paying for a single transaction on the network.

Expand Down Expand Up @@ -150,7 +161,7 @@ For the ability to manage the addresses assigned to the deny list for your coin,

If you add an address to the deny list, you might notice that you can still send tokens to that address. If so, that's because the address is still able to receive coins until the end of the epoch in which you called the function. If you try to send the regulated coin from the now blocked address, your attempt results in an error. After the next epoch starts, the address can no longer receive the coins, either. If you remove the address, it can receive coins immediately but must wait until the epoch after removal before the address can include the coins as transaction inputs.

To use these functions, you pass the address you want to either add or remove. The frontend function then calls the relevant move module in the framework, adding the `DenyList` object (`0x403`) and your `DenyCap` object ID. You receive the `DenyCap` ID at the time of publishing the smart contract. In this example, you add that value to the `.env` file that the frontend function reads from.
To use these functions, you pass the address you want to either add or remove. The frontend function then calls the relevant move module in the framework, adding the `DenyList` object (`0x403`) and your `DenyCapV2` object ID. You receive the `DenyCapV2` ID at the time of publishing the smart contract. In this example, you add that value to the `.env` file that the frontend function reads from.

<Tabs groupId="code-language">

Expand Down
84 changes: 84 additions & 0 deletions docs/content/guides/developer/currency.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: Create Currencies and Tokens
description: Learn how to create currencies and mint coins and tokens on the Sui network using the Coin Registry system.
keywords: [ mint tokens, create tokens, use tokens, publish token, custom tokens, sui CLI, denylist, regulated coins, coin registry, currency registry ]
pagination_prev: null
---

The Coin Registry system provides a centralized approach to currency management through the `sui::coin_registry` module. The registry is a shared object located at address `0xc` that stores metadata, supply information, and regulatory status for all registered coin types.

The `sui::token` module handles token creation on the network. Refer to the [Closed-Loop Token](/standards/closed-loop-token.mdx) and [Currency](/standards/currency.mdx) Standards documentation for more information on these features.

### Currency creation process

The registry system supports two currency creation methods:

1. **Standard creation:** Call `new_currency<T>()` when creating the coin outside of the `init` function of your package.
1. **OTW creation:** Use `new_currency_with_otw<T>()` with a One-Time Witness for uniqueness proof.

Both methods return a `CurrencyInitializer<T>` that allows configuration before finalization:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Both methods return a `CurrencyInitializer<T>` that allows configuration before finalization:
Both methods return `CurrencyInitializer<T>` that allows configuration before finalization:


<details>
<summary>
Regular currency creation
</summary>
<ImportContent source="examples/move/coin/sources/non_otw_currency.move" mode="code" />
</details>

<details>
<summary>
OTW currency creation
</summary>
<ImportContent source="examples/move/coin/sources/my_coin_new.move" mode="code" />
</details>

The initialization process allows for:

- **Supply model selection:** Choose fixed, burn-only, or flexible supply.
- **Regulatory configuration:** Add deny list capabilities if needed.

:::caution Important

After initialization of a currency using the OTW method, you must call `finalize_registration` to create the shared `Currency` object that the Coin Registry can track.

:::

## `DenyList`

The Sui framework provides a `DenyList` singleton, shared object that the bearer of a `DenyCapV2` can access to specify a list of addresses that are unable to use a Sui core type. The initial use case for `DenyList`, however, focuses on limiting access to coins of a specified type. This is useful, for example, when creating a regulated coin on Sui that requires the ability to block certain addresses from using it as inputs to transactions. Regulated coins on Sui satisfy any regulations that require the ability to prevent known bad actors from having access to those coins.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Sui framework provides a `DenyList` singleton, shared object that the bearer of a `DenyCapV2` can access to specify a list of addresses that are unable to use a Sui core type. The initial use case for `DenyList`, however, focuses on limiting access to coins of a specified type. This is useful, for example, when creating a regulated coin on Sui that requires the ability to block certain addresses from using it as inputs to transactions. Regulated coins on Sui satisfy any regulations that require the ability to prevent known bad actors from having access to those coins.
The Sui framework provides a `DenyList` shared object that the bearer of a `DenyCapV2` can access to specify a list of addresses that are unable to use a Sui type. The initial use case for `DenyList`, however, focuses on limiting access to coins of a specified type. This is useful, for example, when creating a regulated coin on Sui that requires the ability to block certain addresses from using it as inputs to transactions. Regulated coins on Sui must satisfy any regulations that require the ability to prevent known bad actors from having access to those coins.


:::info

The `DenyList` object is a system object that has the address `0x403`. You cannot create it yourself.

:::

## Create regulated currency

Use the `make_regulated()` function during the initialization phase before calling `finalize()`. This adds deny list capabilities to the `Currency<T>` and tracks the regulatory status within the registry system.

<details>
<summary>
Regulated currency creation
</summary>
<ImportContent source="examples/move/coin/sources/regcoin_new.move" mode="code" />
</details>

## Create tokens

Tokens reuse the `TreasuryCap` defined in the `sui::coin` module and therefore have the same initialization process. The `coin::create_currency` function guarantees the uniqueness of the `TreasuryCap` and forces the creation of a `CoinMetadata` object.

Coin-like functions perform the minting and burning of tokens. Both require the `TreasuryCap`:

- `token::mint`: Mint a token
- `token::burn`: Burn a token

See [Closed-Loop Token](../../standards/closed-loop-token.mdx) standard for complete details of working with tokens.

## Related links

<RelatedLink to="/guides/developer/coin/regulated.mdx" />
<RelatedLink to="/guides/developer/coin/loyalty.mdx" />
<RelatedLink to="/guides/developer/coin/in-game-token.mdx" />
<RelatedLink to="/concepts/sui-move-concepts/derived-objects.mdx" />
<RelatedLink href="https://move-book.com/programmability/one-time-witness.html" label="One Time Witness" desc="The Move Book documentation of the one time witness pattern. " />
5 changes: 3 additions & 2 deletions docs/content/guides/developer/stablecoins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sidebar_label: Stablecoins
description: Stablecoins are a type of cryptocurrency that are designed to maintain a stable value relative to a fiat currency or a basket of assets.
keywords: [ stablecoins, USDT, tether, agora, USDC, USD coin, AUSD, ondo USDY, USDY, using stablecoins, stablecoins in ptbs, ptbs, programmable transaction blocks, stablecoins in programmable transaction blocks ]
pagination_prev: null
draft: true
---

Stablecoins are a type of cryptocurrency that are designed to maintain a stable value relative to a fiat currency or a basket of assets. They are widely used for trading, lending, and as a store of value.
Expand Down Expand Up @@ -42,7 +43,7 @@ USDY is a fully collateralized US dollar stablecoin issued by Ondo Finance, allo
## How to use USDC on Sui {#usdc-guide}

:::info
While this example uses USDC, the same principles can be applied to any asset on Sui that uses the [Sui Coin standard](../../standards/coin.mdx).
While this example uses USDC, the same principles can be applied to any asset on Sui that uses the [Sui Currency Standard](/standards/currency.mdx).
:::


Expand Down Expand Up @@ -78,7 +79,7 @@ The `usdc` package uses a specific version of the `sui` package, which causes a

### Using USDC in Move

USDC uses the [Sui Coin standard](../../standards/coin.mdx) and can be used just like any other coin type in the Sui framework.
USDC uses the [Sui Currency Standard](/standards/currency.mdx) and can be used just like any other coin type in the Sui framework.

After importing the `usdc` package, you can use the `USDC` type.

Expand Down
Loading
Loading