bucks-api 0.2.0

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

use super::BucksAccount;

/// Vault - Global state for the Bucks protocol.
/// Manages all deposited USDC across multiple yield protocols.
///
/// Invariant: total_deposits == sum(all Stable.total_deposits)
/// Invariant: total_deposits == sum(all ProtocolRegistry.receipt_token_balance * exchange_rate) - yield
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
pub struct Vault {
    /// The admin authority that can manage the vault.
    pub admin: Pubkey,

    /// Treasury address where platform fees are collected.
    pub treasury: Pubkey,

    /// The total amount of USDC currently deposited across all protocols.
    /// This is a cached sum of all Stable.total_deposits.
    pub total_deposits: u64,

    /// Unix timestamp of last checkpoint update.
    pub last_checkpoint: i64,

    /// The total amount of yield claimed over the lifetime of the program.
    pub lifetime_yield: u64,

    /// Platform fee in basis points (1000 = 10%).
    pub platform_fee_bps: u16,

    /// The primary protocol ID where new deposits are routed.
    pub primary_protocol: u8,

    /// Emergency pause flag (0 = active, 1 = paused).
    pub paused: u8,

    /// Number of active protocols registered.
    pub protocol_count: u8,

    /// Padding for alignment to 8-byte boundary.
    pub _padding: [u8; 3],
}

account!(BucksAccount, Vault);