Opening More Use-case Using Token Extensions
Making your Fungible and Non-Fungible tokens more FUN!
The SPL Token Program has been the standard way of creating fungible and non-fungible tokens in Solana. It works and has been the base of many projects and dApps that we have currently in the ecosystem.
However, there are occasions when you want to add more feature set to your tokens. Maybe you want to trigger another logic when your token is being used, or maybe you want to earn some fees when they are being utilized. These and many other functionalities are brought to us by Token Extensions!
Available Token Extensions
Confidential transfers: do not reveal amount of transfer
Transfer fees: charging “tax” on transfer
Mint close authority: allows owner to reclaim rent
Interest-bearing tokens: set interest rate on tokens
Non-transferable tokens: soul-bound tokens
Permanent delegate: set a “co-owner”
Transfer hook: trigger another program upon transfer
Metadata pointer: set address to describe token
Metadata: embed metadata into the tokens
Group pointer: set a group account
Group: tokens can now belong to a group
Member: configuration for a group member
Member pointer: set an address that describes a group member
Memo required on transfer: attach memos upon transfer
Immutable owner: makes re-assigning impossible
Default account state: freezes all new token accounts so users must interact with project first to unfreeze
CPI guard: restricts how other programs can interact with your token
Reallocate: allows owners to reallocate token accounts
Mix and Match
Extensions can be mixed and matched. Use the extensions depending on your use-case. Some extensions cannot be mixed with others as well.
Some Illustration of the Token Extensions
How to add a Token Extension?
You can either configure token extensions upon creation of the token mint or update an existing one.
You can use the spl-token CLI as such
Or via script utilizing @solana/web3.js
and @solana/splt-token
. See example on how to configure Transfer Fees token extension here.
One of the main difference is the existence of these additional instructions as compared to the simple SPL token mints.
And to complete the set of instructions to create your transfer fee-enabled token. The first and last instructions are same with the original token mint creation.
Where to go from here?
A good starting point is to go to Token Extensions Getting Started guide and follow-along individual examples there.
Or you can also watch the examples on a YouTube playlist - Token Extensions on Solana Developer Guides
Token Extensions will also be part of our next BUILD STATION on August 17 (Luzon), register here
To deep dive more about Token Extensions, read the technical paper here