-
Notifications
You must be signed in to change notification settings - Fork 212
program: isolated position #1757
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
base: master
Are you sure you want to change the base?
Conversation
programs/drift/src/state/user.rs
Outdated
| /// The last base asset amount per lp the amm had | ||
| /// Used to settle the users lp position |
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.
change field description probably a good idea
|
|
||
| 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); |
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.
exit_cross_margin_bankruptcy also clears the BeingLiquidated flag on exit, should do that here?
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.
yeah
| /// precision: BASE_PRECISION | ||
| pub last_base_asset_amount_per_lp: i64, | ||
| /// precision: SPOT_BALANCE_PRECISION | ||
| pub isolated_position_scaled_balance: u64, |
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.
is it worth taking over lp_shares and making this u128 too to avoid overflow issues like with spot?
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.
think its fine to make it as spot position since thats what normal usdc deposit uses
* program: add transfer isolated pos deposit into swift * cargo test
* program: start auto transfer * update * cargo fmt --
programs/drift/src/state/user.rs
Outdated
| } | ||
|
|
||
| validate!( | ||
| calculation.meets_margin_requirement(), |
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.
is this going to throw when cross margin under Initial and to_isolated_position = false?
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.
oops yeah gotta delete
No description provided.