Skip to content

Commit

Permalink
Merge pull request #9763 from vegaprotocol/insurance-pool
Browse files Browse the repository at this point in the history
fix: add a more complex scenario testing the insurance pool draining
  • Loading branch information
EVODelavega authored Oct 12, 2023
2 parents 442d765 + 87bd6d5 commit 63b6211
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
- [2948](https://github.com/vegaprotocol/system-tests/issues/2948) - Add integration test for failing system test.
- [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add filtering for party to the referral fees API.
- [9541](https://github.com/vegaprotocol/vega/issues/9731) - Add X day aggregate totals for referral set referees.
- [2985](https://github.com/vegaprotocol/system-tests/issues/2985) - Coverage for insurance pool transfers, fix deadlock when terminating pending market through governance.

### 🐛 Fixes

Expand Down
6 changes: 5 additions & 1 deletion core/execution/future/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,13 @@ func (m *Market) UpdateMarketState(ctx context.Context, changes *types.MarketSta
_ = m.idgen.NextID()
defer func() { m.idgen = nil }()
if changes.UpdateType == types.MarketStateUpdateTypeTerminate {
final := types.MarketStateClosed
if m.mkt.State == types.MarketStatePending || m.mkt.State == types.MarketStateProposed {
final = types.MarketStateCancelled
}
m.uncrossOrderAtAuctionEnd(ctx)
// terminate and settle data (either last traded price for perp, or settlement data provided via governance
m.tradingTerminatedWithFinalState(ctx, types.MarketStateClosed, num.UintZero().Mul(changes.SettlementPrice, m.priceFactor))
m.tradingTerminatedWithFinalState(ctx, final, num.UintZero().Mul(changes.SettlementPrice, m.priceFactor))
} else if changes.UpdateType == types.MarketStateUpdateTypeSuspend {
m.mkt.State = types.MarketStateSuspendedViaGovernance
m.mkt.TradingMode = types.MarketTradingModeSuspendedViaGovernance
Expand Down
Loading

0 comments on commit 63b6211

Please sign in to comment.