bucks-api 0.2.0

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

use super::BucksAccount;

/// StableProtocolPosition - Tracks a stable's position in a specific yield protocol.
///
/// This account provides explicit per-protocol tracking of deposits and receipt tokens,
/// enabling accurate yield calculation without relying on global share ratios.
///
/// PDA seeds: [b"position", stable.key.as_ref(), &[protocol_id]]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
pub struct StableProtocolPosition {
    /// The stable this position belongs to.
    pub stable: Pubkey,

    /// The protocol ID (PROTOCOL_KAMINO=0, PROTOCOL_PERENA=1).
    pub protocol_id: u8,

    /// Padding for alignment.
    pub _padding: [u8; 7],

    /// USDC deposited into this protocol via this stable.
    /// Invariant: sum(all positions for stable).deposits == stable.total_deposits
    pub deposits: u64,

    /// Receipt tokens (cTokens for Kamino, USD* for Perena) attributed to this stable.
    /// Invariant: sum(all positions for protocol).receipt_tokens == protocol.receipt_token_balance
    pub receipt_tokens: u64,
}

account!(BucksAccount, StableProtocolPosition);