#[repr(C)]pub struct Obligation {Show 29 fields
pub tag: u64,
pub last_update: LastUpdate,
pub lending_market: Pubkey,
pub owner: Pubkey,
pub deposits: [ObligationCollateral; 8],
pub lowest_reserve_deposit_liquidation_ltv: u64,
pub deposited_value_sf: PodU128,
pub borrows: [ObligationLiquidity; 5],
pub borrow_factor_adjusted_debt_value_sf: PodU128,
pub borrowed_assets_market_value_sf: PodU128,
pub allowed_borrow_value_sf: PodU128,
pub unhealthy_borrow_value_sf: PodU128,
pub padding_deprecated_asset_tiers: [u8; 13],
pub elevation_group: u8,
pub num_of_obsolete_deposit_reserves: u8,
pub has_debt: u8,
pub referrer: Pubkey,
pub borrowing_disabled: u8,
pub autodeleverage_target_ltv_pct: u8,
pub lowest_reserve_deposit_max_ltv_pct: u8,
pub num_of_obsolete_borrow_reserves: u8,
pub ownership_transfer_state: u8,
pub reserved: [u8; 3],
pub highest_borrow_factor_pct: u64,
pub autodeleverage_margin_call_started_timestamp: u64,
pub obligation_orders: [ObligationOrder; 2],
pub borrow_order: BorrowOrder,
pub pending_owner: Pubkey,
pub padding_3: [u64; 69],
}Expand description
Lending market obligation state.
Fields§
§tag: u64§last_update: LastUpdate§lending_market: Pubkey§owner: Pubkey§deposits: [ObligationCollateral; 8]Deposited collateral (up to 8 positions).
lowest_reserve_deposit_liquidation_ltv: u64§deposited_value_sf: PodU128Market value of deposits (scaled fraction).
borrows: [ObligationLiquidity; 5]Borrowed liquidity (up to 5 positions).
borrow_factor_adjusted_debt_value_sf: PodU128Risk-adjusted debt value (scaled fraction).
borrowed_assets_market_value_sf: PodU128Market value of borrows (scaled fraction).
allowed_borrow_value_sf: PodU128Max borrow value at weighted-avg LTV (scaled fraction).
unhealthy_borrow_value_sf: PodU128Dangerous borrow value at liquidation threshold (scaled fraction).
padding_deprecated_asset_tiers: [u8; 13]§elevation_group: u8§num_of_obsolete_deposit_reserves: u8§has_debt: u81 if borrows array is non-empty.
referrer: Pubkey§borrowing_disabled: u8§autodeleverage_target_ltv_pct: u8§lowest_reserve_deposit_max_ltv_pct: u8§num_of_obsolete_borrow_reserves: u8§ownership_transfer_state: u8State of the ownership transfer process (see OwnershipTransferState in klend).
reserved: [u8; 3]§highest_borrow_factor_pct: u64§autodeleverage_margin_call_started_timestamp: u64§obligation_orders: [ObligationOrder; 2]§borrow_order: BorrowOrder§pending_owner: PubkeyPending owner during ownership transfer process.
Pubkey::default() means no pending owner.
padding_3: [u64; 69]Implementations§
Source§impl Obligation
impl Obligation
Sourcepub fn num_deposits(&self) -> usize
pub fn num_deposits(&self) -> usize
Number of active deposit positions.
Sourcepub fn num_borrows(&self) -> usize
pub fn num_borrows(&self) -> usize
Number of active borrow positions.
Sourcepub fn deposited_value(&self) -> u128
pub fn deposited_value(&self) -> u128
Total deposited value as a raw u128 scaled fraction.
Sourcepub fn allowed_borrow_value(&self) -> u128
pub fn allowed_borrow_value(&self) -> u128
Allowed borrow value (weighted-avg LTV) as a raw u128 scaled fraction.
Sourcepub fn unhealthy_borrow_value(&self) -> u128
pub fn unhealthy_borrow_value(&self) -> u128
Unhealthy borrow value (liquidation threshold) as a raw u128 scaled fraction.
Sourcepub fn borrow_factor_adjusted_debt_value(&self) -> u128
pub fn borrow_factor_adjusted_debt_value(&self) -> u128
Borrow-factor-adjusted debt value as a raw u128 scaled fraction.
Sourcepub fn borrowed_assets_market_value(&self) -> u128
pub fn borrowed_assets_market_value(&self) -> u128
Market value of borrowed assets as a raw u128 scaled fraction.
Sourcepub fn is_liquidatable(&self) -> bool
pub fn is_liquidatable(&self) -> bool
Returns true if the obligation can be liquidated
(borrow-factor-adjusted debt exceeds the unhealthy borrow value).
Sourcepub fn is_borrowing_disabled(&self) -> bool
pub fn is_borrowing_disabled(&self) -> bool
Returns true if the obligation has no borrow capacity left
(borrow-factor-adjusted debt >= allowed borrow value).
Trait Implementations§
Source§impl Clone for Obligation
impl Clone for Obligation
Source§fn clone(&self) -> Obligation
fn clone(&self) -> Obligation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Obligation
Source§impl Debug for Obligation
impl Debug for Obligation
impl Pod for Obligation
Source§impl SplDiscriminate for Obligation
impl SplDiscriminate for Obligation
Source§const SPL_DISCRIMINATOR: ArrayDiscriminator
const SPL_DISCRIMINATOR: ArrayDiscriminator
[u8; 8]Source§const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _
&[u8])Auto Trait Implementations§
impl Freeze for Obligation
impl RefUnwindSafe for Obligation
impl Send for Obligation
impl Sync for Obligation
impl Unpin for Obligation
impl UnsafeUnpin for Obligation
impl UnwindSafe for Obligation
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.