pub struct LiquidationKeeper;Implementations§
Source§impl LiquidationKeeper
impl LiquidationKeeper
Sourcepub fn should_liquidate(
position: &Position,
current_price: u64,
health_factor: u16,
) -> Result<Option<LiquidationTrigger>>
pub fn should_liquidate( position: &Position, current_price: u64, health_factor: u16, ) -> Result<Option<LiquidationTrigger>>
Check if a position meets liquidation criteria
Sourcepub fn calculate_liquidation_fee(position_value: u64) -> Result<u64>
pub fn calculate_liquidation_fee(position_value: u64) -> Result<u64>
Calculate liquidation fee for a position
Sourcepub fn calculate_insurance_payout(
pnl: i64,
available_insurance: u64,
) -> Result<u64>
pub fn calculate_insurance_payout( pnl: i64, available_insurance: u64, ) -> Result<u64>
Calculate insurance payout needed
Sourcepub fn execute_liquidation(
position: &mut Position,
liquidator: Pubkey,
liquidation_price: u64,
insurance_fund: &mut u64,
) -> Result<LiquidationEvent>
pub fn execute_liquidation( position: &mut Position, liquidator: Pubkey, liquidation_price: u64, insurance_fund: &mut u64, ) -> Result<LiquidationEvent>
Execute liquidation
Sourcepub fn check_liquidation_cooldown(
last_liquidation_slot: u64,
current_slot: u64,
) -> bool
pub fn check_liquidation_cooldown( last_liquidation_slot: u64, current_slot: u64, ) -> bool
Check if liquidation violates cooldown period
Sourcepub fn estimate_insurance_impact(
total_open_interest: u64,
default_rate_bps: u16,
insurance_fund: u64,
) -> Result<(u64, bool)>
pub fn estimate_insurance_impact( total_open_interest: u64, default_rate_bps: u16, insurance_fund: u64, ) -> Result<(u64, bool)>
Calculate liquidation impact on insurance fund
Sourcepub fn batch_check_liquidations(
positions: &[Position],
current_price: u64,
) -> Result<Vec<Pubkey>>
pub fn batch_check_liquidations( positions: &[Position], current_price: u64, ) -> Result<Vec<Pubkey>>
Batch liquidation check for multiple positions
Auto Trait Implementations§
impl Freeze for LiquidationKeeper
impl RefUnwindSafe for LiquidationKeeper
impl Send for LiquidationKeeper
impl Sync for LiquidationKeeper
impl Unpin for LiquidationKeeper
impl UnsafeUnpin for LiquidationKeeper
impl UnwindSafe for LiquidationKeeper
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more