Skip to content

Commit

Permalink
program: let user with positive pnl be settled if being liquidated (#…
Browse files Browse the repository at this point in the history
…1020)

* program: let user with positive pnl be settled if being liquidated

* CHANGELOG
  • Loading branch information
crispheaney committed Apr 18, 2024
1 parent 58771d1 commit 42af0de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixes

- program: program: let user with positive pnl be settled if being liquidated ([#1020](https://github.com/drift-labs/protocol-v2/pull/1020))
- program: fix should_expire_order_before_fill ([#1021](https://github.com/drift-labs/protocol-v2/pull/1021))

### Breaking

Expand Down
1 change: 1 addition & 0 deletions programs/drift/src/controller/pnl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ pub fn settle_pnl(
validate!(
pnl_to_settle_with_user < 0
|| max_pnl_pool_excess > 0
|| (pnl_to_settle_with_user > 0 && user.is_being_liquidated())
|| (user.authority.eq(authority) || user.delegate.eq(authority)),
ErrorCode::UserMustSettleTheirOwnPositiveUnsettledPNL,
"User must settle their own unsettled pnl when its positive and pnl pool not in excess"
Expand Down

0 comments on commit 42af0de

Please sign in to comment.