Skip to main content

carbon_token_program_decoder/accounts/
mint.rs

1//! This code was AUTOGENERATED using the Codama library.
2use solana_pubkey::Pubkey;
3
4#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
5#[derive(Debug, Clone, borsh::BorshSerialize, borsh::BorshDeserialize, PartialEq)]
6pub struct Mint {
7    /// Optional authority used to mint new tokens. The mint authority may only
8    /// be provided during mint creation. If no mint authority is present
9    /// then the mint has a fixed supply and no further tokens may be minted.
10    pub mint_authority: Option<Pubkey>,
11    /// Total supply of tokens.
12    pub supply: u64,
13    /// Number of base 10 digits to the right of the decimal place.
14    pub decimals: u8,
15    /// Is `true` if this structure has been initialized.
16    pub is_initialized: bool,
17    /// Optional authority to freeze token accounts.
18    pub freeze_authority: Option<Pubkey>,
19}
20
21impl Mint {
22    pub fn decode(data: &[u8]) -> Option<Self> {
23        if data.len() != 82 {
24            return None;
25        }
26
27        let mut data_slice = data;
28
29        data_slice = &data_slice[0..];
30
31        borsh::BorshDeserialize::deserialize(&mut data_slice).ok()
32    }
33}