Skip to main content

kvault_interface/state/
vault_allocation.rs

1use bytemuck::{Pod, Zeroable};
2use solana_pubkey::Pubkey;
3
4use super::pod::PodU128;
5
6/// Per-reserve allocation within a vault.
7#[derive(Debug, Clone, Copy, Pod, Zeroable)]
8#[repr(C)]
9pub struct VaultAllocation {
10    /// Klend reserve address this allocation targets. `Pubkey::default()` means the slot is empty.
11    pub reserve: Pubkey,
12    /// Token account holding the cTokens received from the reserve.
13    pub ctoken_vault: Pubkey,
14    /// Relative weight for target allocation distribution.
15    pub target_allocation_weight: u64,
16    /// Maximum tokens that can be invested in this reserve.
17    pub token_allocation_cap: u64,
18    /// Bump seed for the [`ctoken_vault`](Self::ctoken_vault) PDA.
19    pub ctoken_vault_bump: u64,
20    /// Reserved for future configuration fields.
21    pub config_padding: [u64; 127],
22    /// Current cToken balance invested in this reserve.
23    pub ctoken_allocation: u64,
24    /// Slot number of the last invest call for this reserve.
25    pub last_invest_slot: u64,
26    /// Target token allocation as a scaled fraction ([`Fraction`](crate::Fraction)).
27    pub token_target_allocation_sf: PodU128,
28    /// Reserved for future state fields.
29    pub state_padding: [u64; 128],
30}
31
32const _: () = assert!(core::mem::size_of::<VaultAllocation>() == 2160);