A common use case for smart contracts is issuing custom fungible tokens (such as ERC-20 tokens on Ethereum). Let's take a look at how that can be done on Sui using the Sui Framework, and some variations on the classic fungible tokens.
The Sui Framework is Sui's specific implementation of the Move VM. It contains Sui's native API's including its implementation of the Move standard library, as well as Sui-specific operations such as crypto primitives and Sui's implementation of data structures at the framework level.
An implementation of a custom fungible token in Sui will heavily leverage some of the libraries in the Sui Framework.
The main library we will use to implement a custom fungible token on Sui is the sui::coin
module.
The resources or methods we will directly use in our fungible token example are:
- Resource: Coin
- Resource: TreasuryCap
- Resource: CoinMetadata
- Method: coin::create_currency
We will revisit each of these in more depth after introducing some new concepts in the next few sections.