sss_token/state/
config.rs1use anchor_lang::prelude::*;
2
3#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, PartialEq, Eq, Debug)]
4pub enum StablecoinPreset {
5 SSS1, SSS2, SSS3, Custom, }
10
11#[account]
12pub struct StablecoinConfig {
13 pub bump: u8,
14 pub mint: Pubkey,
15 pub master_authority: Pubkey,
16 pub pending_authority: Pubkey, pub name: String, pub symbol: String, pub uri: String, pub decimals: u8,
23
24 pub preset: StablecoinPreset,
26 pub enable_permanent_delegate: bool,
27 pub enable_transfer_hook: bool,
28 pub default_account_frozen: bool,
29 pub enable_confidential_transfers: bool, pub is_paused: bool,
33 pub supply_cap: u64, pub total_minted: u64,
35 pub total_burned: u64,
36 pub total_seized: u64,
37 pub audit_log_index: u64,
38 pub reserve_attestation_index: u64,
39
40 pub created_at: i64,
42 pub updated_at: i64,
43}
44
45impl StablecoinConfig {
46 pub const MAX_NAME_LEN: usize = 32;
47 pub const MAX_SYMBOL_LEN: usize = 10;
48 pub const MAX_URI_LEN: usize = 200;
49
50 pub const SEED_PREFIX: &'static [u8] = b"config";
51
52 pub const SPACE: usize = 8
55 + 1
56 + 32
57 + 32
58 + 32
59 + (4 + 32)
60 + (4 + 10)
61 + (4 + 200)
62 + 1
63 + 1
64 + 1
65 + 1
66 + 1
67 + 1
68 + 1
69 + 8
70 + 8
71 + 8
72 + 8
73 + 8
74 + 8
75 + 8
76 + 8;
77
78 pub fn current_supply(&self) -> u64 {
79 self.total_minted.saturating_sub(self.total_burned)
80 }
81}