bucks-api 0.2.0

White label stablecoin launchpad
Documentation
use serde::{Deserialize, Serialize};
use steel::*;

use super::BucksAccount;

/// Stable - Per-stablecoin state tracking.
/// Each stablecoin created has its own Stable account.
///
/// Invariant: total_deposits == sum(all StableProtocolPosition.deposits for this stable)
/// Invariant: total_deposits == stablecoin_mint.supply (1:1 peg)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
pub struct Stable {
    /// The creator address (authority).
    pub authority: Pubkey,

    /// The address of the token metadata.
    pub metadata: Pubkey,

    /// The stablecoin mint address.
    pub mint: Pubkey,

    /// The total amount of USDC deposited via this stablecoin.
    /// This is a cached sum of all StableProtocolPosition.deposits for this stable.
    pub total_deposits: u64,

    /// The amount of yield claimed over the lifetime of this stablecoin.
    pub lifetime_yield_claimed: u64,

    /// The timestamp this coin was created.
    pub created_at: i64,
}

account!(BucksAccount, Stable);