☀️Solana account structure
The following structures are literally copied from the contract source code:
pub struct LendingMarket {
/// Version of lending market
pub version: u8,
/// Bump seed for derived authority address
pub bump_seed: u8,
/// Owner authority which can add new reserves
pub owner: Pubkey,
/// Currency market prices are quoted in
/// e.g. "USD" null padded (`*b"USD\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"`) or a SPL token mint pubkey
pub quote_currency: [u8; 32],
/// Token program id
pub token_program_id: Pubkey,
/// Oracle (Pyth) program id
pub oracle_program_id: Pubkey,
/// Oracle (Switchboard) program id
pub switchboard_oracle_program_id: Pubkey,
}
pub struct Obligation {
/// Version of the struct
pub version: u8,
/// Last update to collateral, liquidity, or their market values
pub last_update: LastUpdate,
/// Lending market address
pub lending_market: Pubkey,
/// Owner authority which can borrow liquidity
pub owner: Pubkey,
/// Deposited collateral for the obligation, unique by deposit reserve address
pub deposits: Vec<ObligationCollateral>,
/// Borrowed liquidity for the obligation, unique by borrow reserve address
pub borrows: Vec<ObligationLiquidity>,
/// Market value of deposits
pub deposited_value: Decimal,
/// Market value of borrows
pub borrowed_value: Decimal,
/// The maximum borrow value at the weighted average loan to value ratio
pub allowed_borrow_value: Decimal,
/// The dangerous borrow value at the weighted average liquidation threshold
pub unhealthy_borrow_value: Decimal,
}
pub struct Reserve {
/// Version of the struct
pub version: u8,
/// Last slot when supply and rates updated
pub last_update: LastUpdate,
/// Lending market address
pub lending_market: Pubkey,
/// Reserve liquidity
pub liquidity: ReserveLiquidity,
/// Reserve collateral
pub collateral: ReserveCollateral,
/// Reserve configuration values
pub config: ReserveConfig,
}
pub struct ReserveLiquidity {
/// Reserve liquidity mint address
pub mint_pubkey: Pubkey,
/// Reserve liquidity mint decimals
pub mint_decimals: u8,
/// Reserve liquidity supply address
pub supply_pubkey: Pubkey,
/// Reserve liquidity pyth oracle account
pub pyth_oracle_pubkey: Pubkey,
/// Reserve liquidity switchboard oracle account
pub switchboard_oracle_pubkey: Pubkey,
/// Reserve liquidity available
pub available_amount: u64,
/// Reserve liquidity borrowed
pub borrowed_amount_wads: Decimal,
/// Reserve liquidity cumulative borrow rate
pub cumulative_borrow_rate_wads: Decimal,
/// Reserve liquidity market price in quote currency
pub market_price: Decimal,
}
pub struct FluidityData {
token_mint: Pubkey,
fluid_mint: Pubkey,
pda: Pubkey,
payout_authority: Pubkey, // can turn on emergency mode, reward users, update mint limits
operator: Pubkey, // can turn on emergency mode, unblock rewards, update payout limits, change
// the payout auth
emergency_council: Pubkey, // can turn on emergency mode
pending_payout_authority: Option<Pubkey>,
// wrapping and payouts
no_emergency: bool,
block_payout_threshold: u64,
global_mint_remaining: u64,
}
Last updated