From 8070a95f002a0c9a8997547d41e470dae0707852 Mon Sep 17 00:00:00 2001 From: Chris Heaney Date: Sat, 21 Dec 2024 15:40:29 -0500 Subject: [PATCH] program: use dynamic liquidator fee for liqudiate_perp --- programs/drift/src/controller/liquidation.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/programs/drift/src/controller/liquidation.rs b/programs/drift/src/controller/liquidation.rs index 3b43f4f32..e4d9eca05 100644 --- a/programs/drift/src/controller/liquidation.rs +++ b/programs/drift/src/controller/liquidation.rs @@ -343,7 +343,14 @@ pub fn liquidate_perp( let quote_oracle_price = oracle_map .get_price_data("e_spot_market.oracle_id())? .price; - let liquidator_fee = market.liquidator_fee; + + let liquidator_fee = get_liquidation_fee( + market.liquidator_fee, + market.get_max_liquidation_fee()?, + user.last_active_slot, + slot, + )?; + let if_liquidation_fee = calculate_perp_if_fee( intermediate_margin_calculation.tracked_market_margin_shortage(margin_shortage)?, user_base_asset_amount,