Skip to content

Commit 662e4d6

Browse files
committed
Merge branch 'bigz/burn-lp-shares-logging' into bigz/fix-lp-entry-breakeven-price-calc
2 parents 6a3ab21 + 9806a3b commit 662e4d6

File tree

1 file changed

+12
-1
lines changed
  • programs/drift/src/controller

1 file changed

+12
-1
lines changed

programs/drift/src/controller/lp.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub fn burn_lp_shares(
251251
oracle_price: i64,
252252
) -> DriftResult<(PositionDelta, i64)> {
253253
// settle
254-
let (position_delta, pnl) = settle_lp_position(position, market)?;
254+
let (mut position_delta, mut pnl) = settle_lp_position(position, market)?;
255255

256256
// clean up
257257
let unsettled_remainder = market
@@ -296,6 +296,17 @@ pub fn burn_lp_shares(
296296
?;
297297

298298
update_quote_asset_amount(position, market, -dust_base_asset_value.cast()?)?;
299+
300+
msg!(
301+
"perp {} remainder_base_asset_amount burn fee= {}",
302+
position.market_index,
303+
dust_base_asset_value
304+
);
305+
306+
position_delta.quote_asset_amount = position_delta
307+
.quote_asset_amount
308+
.safe_sub(dust_base_asset_value.cast()?)?;
309+
pnl = pnl.safe_sub(dust_base_asset_value.cast()?)?;
299310
}
300311

301312
// update last_ metrics

0 commit comments

Comments
 (0)