-
Notifications
You must be signed in to change notification settings - Fork 125
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
program: fill_perp checks maintenance margin req if position is reduced #714
program: fill_perp checks maintenance margin req if position is reduced #714
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #714 +/- ##
==========================================
+ Coverage 74.40% 74.49% +0.09%
==========================================
Files 125 125
Lines 28940 29054 +114
==========================================
+ Hits 21533 21645 +112
- Misses 7407 7409 +2
|
programs/drift/src/math/orders.rs
Outdated
based_asset_amount_filled: i64, | ||
market_index: u16, | ||
) -> DriftResult<MarginRequirementType> { | ||
let current_position = maker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is position after fill? maybe good to specify somewhere
programs/drift/src/math/orders.rs
Outdated
let position_before = current_position.safe_sub(based_asset_amount_filled)?; | ||
|
||
if current_position.signum() == position_before.signum() | ||
&& current_position.abs() < position_before.abs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good candidate for helper function
position_after.was_reduced(position_before)
e9acb73
to
229ad5a
Compare
No description provided.