Skip to main content

Obligation

Struct Obligation 

Source
#[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: PodU128

Market value of deposits (scaled fraction).

§borrows: [ObligationLiquidity; 5]

Borrowed liquidity (up to 5 positions).

§borrow_factor_adjusted_debt_value_sf: PodU128

Risk-adjusted debt value (scaled fraction).

§borrowed_assets_market_value_sf: PodU128

Market value of borrows (scaled fraction).

§allowed_borrow_value_sf: PodU128

Max borrow value at weighted-avg LTV (scaled fraction).

§unhealthy_borrow_value_sf: PodU128

Dangerous borrow value at liquidation threshold (scaled fraction).

§padding_deprecated_asset_tiers: [u8; 13]§elevation_group: u8§num_of_obsolete_deposit_reserves: u8§has_debt: u8

1 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: u8

State 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: Pubkey

Pending owner during ownership transfer process. Pubkey::default() means no pending owner.

§padding_3: [u64; 69]

Implementations§

Source§

impl Obligation

Source

pub fn num_deposits(&self) -> usize

Number of active deposit positions.

Source

pub fn num_borrows(&self) -> usize

Number of active borrow positions.

Source

pub fn deposited_value(&self) -> u128

Total deposited value as a raw u128 scaled fraction.

Source

pub fn allowed_borrow_value(&self) -> u128

Allowed borrow value (weighted-avg LTV) as a raw u128 scaled fraction.

Source

pub fn unhealthy_borrow_value(&self) -> u128

Unhealthy borrow value (liquidation threshold) as a raw u128 scaled fraction.

Source

pub fn borrow_factor_adjusted_debt_value(&self) -> u128

Borrow-factor-adjusted debt value as a raw u128 scaled fraction.

Source

pub fn borrowed_assets_market_value(&self) -> u128

Market value of borrowed assets as a raw u128 scaled fraction.

Source

pub fn is_liquidatable(&self) -> bool

Returns true if the obligation can be liquidated (borrow-factor-adjusted debt exceeds the unhealthy borrow value).

Source

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

Source§

fn clone(&self) -> Obligation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Obligation

Source§

impl Debug for Obligation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Pod for Obligation

Source§

impl SplDiscriminate for Obligation

Source§

const SPL_DISCRIMINATOR: ArrayDiscriminator

The 8-byte discriminator as a [u8; 8]
Source§

const SPL_DISCRIMINATOR_SLICE: &'static [u8] = _

The 8-byte discriminator as a slice (&[u8])
Source§

impl Zeroable for Obligation

Source§

fn zeroed() -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

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

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> NoUninit for T
where T: Pod,

Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.