Skip to content

Conversation

@crispheaney
Copy link
Member

@crispheaney crispheaney commented Jul 20, 2025

No description provided.

Comment on lines 1091 to 1092
/// The last base asset amount per lp the amm had
/// Used to settle the users lp position
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change field description probably a good idea

@crispheaney crispheaney changed the title program: isolation position init program: isolated position Oct 8, 2025

pub fn exit_isolated_margin_bankruptcy(&mut self, perp_market_index: u16) -> DriftResult {
let perp_position = self.force_get_isolated_perp_position_mut(perp_market_index)?;
perp_position.position_flag &= !(PositionFlag::Bankrupt as u8);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit_cross_margin_bankruptcy also clears the BeingLiquidated flag on exit, should do that here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah

/// precision: BASE_PRECISION
pub last_base_asset_amount_per_lp: i64,
/// precision: SPOT_BALANCE_PRECISION
pub isolated_position_scaled_balance: u64,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth taking over lp_shares and making this u128 too to avoid overflow issues like with spot?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think its fine to make it as spot position since thats what normal usdc deposit uses

}

validate!(
calculation.meets_margin_requirement(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this going to throw when cross margin under Initial and to_isolated_position = false?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yeah gotta delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants