Tokens On Solana
-
explainer page only
-
explain tokens on solana
-
overview token program
-
explorer links
-
link source code
-
spl-token.js
Token Program
- token extensions program
- business logic for all tokens fungible/non fungible
token extensions program (2022) https://github.com/solana-labs/solana-program-library/tree/78da1843fc515e4aa9e18ea48b71d2b903e5e6ea/token/program-2022
Mint Account
- explain mint account
pub struct Mint {
/// Optional authority used to mint new tokens. The mint authority may only
/// be provided during mint creation. If no mint authority is present
/// then the mint has a fixed supply and no further tokens may be
/// minted.
pub mint_authority: COption<Pubkey>,
/// Total supply of tokens.
pub supply: u64,
/// Number of base 10 digits to the right of the decimal place.
pub decimals: u8,
/// Is `true` if this structure has been initialized
pub is_initialized: bool,
/// Optional authority to freeze token accounts.
pub freeze_authority: COption<Pubkey>,
}
pyusd https://explorer.solana.com/address/2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo
usdc https://explorer.solana.com/address/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
- playground fetch mint
Token Account
- explain token account
pub struct Account {
/// The mint associated with this account
pub mint: Pubkey,
/// The owner of this account.
pub owner: Pubkey,
/// The amount of tokens this account holds.
pub amount: u64,
/// If `delegate` is `Some` then `delegated_amount` represents
/// the amount authorized by the delegate
pub delegate: COption<Pubkey>,
/// The account's state
pub state: AccountState,
/// If is_some, this is a native token, and the value logs the rent-exempt
/// reserve. An Account is required to be rent-exempt, so the value is
/// used by the Processor to ensure that wrapped SOL accounts do not
/// drop below this threshold.
pub is_native: COption<u64>,
/// The amount delegated
pub delegated_amount: u64,
/// Optional authority to close the account.
pub close_authority: COption<Pubkey>,
}
pyusd token account https://explorer.solana.com/address/B6j8ccfHJAPJYdV5y1knB7gEGFNzKRyvuxerbWUcb75L
usdc token account https://explorer.solana.com/address/3emsAVdmGKERbHjmGfQ6oZ1e35dkf5iYcS6U4CPKFVaa
- playground fetch tojken
Relationship between Accounts
- diagrams