Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 05999a9

Browse files
authored
Update token docs (#360)
1 parent 0c89817 commit 05999a9

File tree

1 file changed

+35
-16
lines changed

1 file changed

+35
-16
lines changed

docs/src/token.md

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The Token Program's source is available on
2424

2525
The on-chain Token Program is written in Rust and available on crates.io as
2626
[spl-token](https://docs.rs/spl-token). The program's [instruction interface
27-
documentation](https://docs.rs/spl-token/1.0.2/spl_token/instruction/enum.TokenInstruction.html)
27+
documentation](https://docs.rs/spl-token/2.0.1/spl_token/instruction/enum.TokenInstruction.html)
2828
can also be found there.
2929

3030
Auto-generated C bindings are also available for the on-chain Token Program and
@@ -33,7 +33,7 @@ available
3333

3434
[Javascript
3535
bindings](https://github.com/solana-labs/solana-program-library/blob/master/token/js/client/token.js)
36-
are available that support loading the Token Program on to a chain and issuing
36+
are available that support loading the Token Program on to a chain and issue
3737
instructions.
3838

3939
## Command-line Utility
@@ -159,24 +159,27 @@ CqAxDdBRnawzx9q4PYM3wrybLHBhDZ4P6BTV13WsRJYJ AQoKYV7tYpTrFZN6P5oUufbQKAUr9mNYGe1
159159
### Creating a new token type
160160

161161
A new token type can be created by initializing a new Mint with the
162-
`InitializeMint` instruction. The Mint is used to create or "Mint" new tokens,
162+
`InitializeMint` instruction. The Mint is used to create or "mint" new tokens,
163163
and these tokens are stored in Accounts. A Mint is associated with each
164164
Account, which means that the total supply of a particular token type is equal
165165
to the balances of all the associated Accounts.
166166

167-
A Mint can either be configured with a fixed-supply or non-fixed supply. The
168-
total supply of a fixed-supply Mint is determined during initialization and
169-
deposited into a provided destination account. A non-fixed-supply Mint also has
170-
an owner associated with it who has the authority to create new tokens in the
171-
future with the `MintTo` instruction. Both types of Mints can `Burn` tokens to
172-
decrease supply.ß
173-
174167
It's important to note that the `InitializeMint` instruction does not require
175168
the Solana account being initialized also be a signer. The `InitializeMint`
176169
instruction should be atomically processed with the system instruction that
177170
creates the Solana account by including both instructions in the same
178171
transaction.
179172

173+
Once a Mint is initialized, the `mint_authority` can create new tokens using the
174+
`MintTo` instruction. As long as a Mint contains a valid `mint_authority`, the
175+
Mint is considered to have a non-fixed supply, and the `mint_authority` can
176+
create new tokens with the `MintTo` instruction at any time. The `SetAuthority`
177+
instruction can be used to irreversibly set the Mint's authority to `None`,
178+
rendering the Mint's supply fixed. No further tokens can ever be Minted.
179+
180+
Token supply can be reduced at any time by issuing a `Burn` instruction which
181+
removes and discards tokens from an Account.
182+
180183
### Creating accounts
181184

182185
Accounts hold token balances and are created using the `InitializeAccount`
@@ -205,13 +208,13 @@ to another Account, effectively removing the token from circulation permanently.
205208

206209
Account owners may delegate authority over some or all of their token balance
207210
using the `Approve` instruction. Delegated authorities may transfer or burn up
208-
to the amount they've been delegated. Authority delegation may be revoked by
209-
the Account's owner via the `Revoke` instruction.
211+
to the amount they've been delegated. Authority delegation may be revoked by the
212+
Account's owner via the `Revoke` instruction.
210213

211214
### Multisignatures
212215

213-
M of N multisignatures are supported and can be used in place of Mint owners, or
214-
Account owners or delegates. Multisignature owners or delegates must be
216+
M of N multisignatures are supported and can be used in place of Mint
217+
authorities or Account owners or delegates. Multisignature authorities must be
215218
initialized with the `InitializeMultisig` instruction. Initialization specifies
216219
the set of N public keys that are valid and the number M of those N that must be
217220
present as instruction signers for the authority to be legitimate.
@@ -222,6 +225,15 @@ require the Solana account being initialized also be a signer. The
222225
instruction that creates the Solana account by including both instructions in
223226
the same transaction.
224227

228+
### Freezing accounts
229+
230+
The Mint may also contain a `freeze_authority` can be used to issue
231+
`FreezeAccount` instructions that will render an Account unusable. Token
232+
instructions that include a frozen account will fail until the Account is thawed
233+
using the `ThawAccount` instruction. The `SetAuthority` instruction can be used
234+
to change a Mint's `freeze_authority`. If a Mint's `freeze_authority` is set to
235+
`None` then account freezing is permanently disabled
236+
225237
### Wrapping SOL
226238

227239
The Token Program can be used to wrap native SOL. Doing so allows native SOL to
@@ -242,9 +254,16 @@ These accounts have a few unique behaviors
242254
- Burning is not supported
243255
- When closing an Account the balance may be non-zero.
244256

257+
### Rent-exemption
258+
259+
To ensure a reliable calculation of supply, a consistency valid Mint, and
260+
consistently valid Multisig accounts all Solana accounts holding a Account,
261+
Mint, or Multisig must contain enough SOL to be considered (rent
262+
exempt)[https://docs.solana.com/implemented-proposals/rent]
263+
245264
### Closing accounts
246265

247266
An account may be closed using the `CloseAccount` instruction. When closing an
248267
Account, all remaining SOL will be transferred to another Solana account
249-
(doesn't have to be associated with the Token Program). Non-native accounts
250-
must have a balance of zero to be closed.
268+
(doesn't have to be associated with the Token Program). Non-native Accounts must
269+
have a balance of zero to be closed.

0 commit comments

Comments
 (0)