bucks_api/state/protocol.rs
1use serde::{Deserialize, Serialize};
2use steel::*;
3
4use super::BucksAccount;
5
6/// ProtocolRegistry - Tracks a registered yield protocol.
7/// Each protocol (Kamino, Perena, etc.) has its own registry account.
8#[repr(C)]
9#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable, Serialize, Deserialize)]
10pub struct ProtocolRegistry {
11 /// Unique identifier for this protocol (0 = Kamino, 1 = Perena, etc.).
12 pub protocol_id: u8,
13
14 /// Padding for alignment.
15 pub _padding1: [u8; 7],
16
17 /// Human-readable name of the protocol.
18 pub name: [u8; 32],
19
20 /// Whether this protocol is active (0 = inactive, 1 = active).
21 pub active: u8,
22
23 /// Padding for alignment.
24 pub _padding2: [u8; 7],
25
26 /// The balance of receipt tokens (cTokens for Kamino, USD* for Perena).
27 pub receipt_token_balance: u64,
28
29 /// The current USDC value of the receipt tokens.
30 pub usdc_value: u64,
31
32 /// Exchange rate: USDC per receipt token, scaled by 1e9.
33 pub exchange_rate: u64,
34
35 /// Unix timestamp of last exchange rate update.
36 pub last_rate_update: i64,
37}
38
39account!(BucksAccount, ProtocolRegistry);