Skip to content

Commit

Permalink
fix: ensure ELS is updated when LP is cancelled
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Van Ootegem <[email protected]>
  • Loading branch information
EVODelavega committed Mar 21, 2024
1 parent a32c812 commit 4cc60f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### 🐛 Fixes

- [10960](https://github.com/vegaprotocol/vega/issues/10960) - Only the owner of a referral set can update it.
- [10950](https://github.com/vegaprotocol/vega/issues/10950) - Fix bug that caused cancelled liquidity provisions to stick around after opening auction.

## 0.75.1

Expand Down
6 changes: 6 additions & 0 deletions core/execution/common/liquidity_provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,12 @@ func (m *MarketLiquidity) CancelLiquidityProvision(ctx context.Context, party st
return err
}
}
// remove ELS for the cancelled LP if cancellation was applied immediately (e.g. during opening auction)
if applied {
m.equityShares.SetPartyStake(party, amendment.CommitmentAmount)
// force update for all shares
_ = m.equityShares.AllShares()
}

return nil
}
Expand Down
2 changes: 2 additions & 0 deletions core/execution/common/liquidity_provision_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ func TestCancelLiquidityProvisionDuringOpeningAuction(t *testing.T) {
}).
AnyTimes()

testLiquidity.equityShares.EXPECT().SetPartyStake(provider, gomock.Any()).Times(1)
testLiquidity.equityShares.EXPECT().AllShares().Times(1).Return(nil)
err = testLiquidity.marketLiquidity.CancelLiquidityProvision(ctx, provider)
assert.NoError(t, err)

Expand Down

0 comments on commit 4cc60f6

Please sign in to comment.