use anchor_lang::prelude::*;
#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, PartialEq, Eq, Debug)]
pub enum StablecoinPreset {
SSS1, SSS2, SSS3, Custom, }
#[account]
pub struct StablecoinConfig {
pub bump: u8,
pub mint: Pubkey,
pub master_authority: Pubkey,
pub pending_authority: Pubkey,
pub name: String, pub symbol: String, pub uri: String, pub decimals: u8,
pub preset: StablecoinPreset,
pub enable_permanent_delegate: bool,
pub enable_transfer_hook: bool,
pub default_account_frozen: bool,
pub enable_confidential_transfers: bool,
pub is_paused: bool,
pub supply_cap: u64, pub total_minted: u64,
pub total_burned: u64,
pub total_seized: u64,
pub audit_log_index: u64,
pub reserve_attestation_index: u64,
pub created_at: i64,
pub updated_at: i64,
}
impl StablecoinConfig {
pub const MAX_NAME_LEN: usize = 32;
pub const MAX_SYMBOL_LEN: usize = 10;
pub const MAX_URI_LEN: usize = 200;
pub const SEED_PREFIX: &'static [u8] = b"config";
pub const SPACE: usize = 8
+ 1
+ 32
+ 32
+ 32
+ (4 + 32)
+ (4 + 10)
+ (4 + 200)
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 1
+ 8
+ 8
+ 8
+ 8
+ 8
+ 8
+ 8
+ 8;
pub fn current_supply(&self) -> u64 {
self.total_minted.saturating_sub(self.total_burned)
}
}