Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigz/add-tiers-for-liq-perp-pnl #368

Merged
merged 15 commits into from
Feb 24, 2023
Merged

Conversation

0xbigz
Copy link
Member

@0xbigz 0xbigz commented Feb 22, 2023

No description provided.

programs/drift/src/math/margin.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/liquidation.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/liquidation.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/spot_balance.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/liquidation.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/liquidation.rs Outdated Show resolved Hide resolved
programs/drift/src/controller/liquidation.rs Outdated Show resolved Hide resolved
programs/drift/src/state/perp_market.rs Show resolved Hide resolved
@@ -1737,6 +1756,10 @@ pub fn liquidate_perp_pnl_for_deposit(
None,
)?;

let (safest_tier_spot_liability, safest_tier_perp_liability) =
calculate_user_safest_position_tiers(user, perp_market_map, spot_market_map)?;
let is_contract_tier_violation =
Copy link
Member

Choose a reason for hiding this comment

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

feel like it might just be cleaner to check the tier violation here and return early all at once here, instead of spreading the logic, but will defer to you

Copy link
Member Author

Choose a reason for hiding this comment

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

that'd be a lot of copy paste code tho

@crispheaney crispheaney merged commit 5667feb into master Feb 24, 2023
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.

2 participants