code.vegaprotocol.io/vega@v0.79.0/core/integration/features/spot/accounts_and_fees/fund-release-bug.feature (about) 1 Feature: replicate the fund releasing bug when market is terminated 2 3 Scenario: 001 terminate market with Oracle 4 Given time is updated to "2023-07-20T00:00:00Z" 5 6 Given the fees configuration named "fees-config-1": 7 | maker fee | infrastructure fee | 8 | 0 | 0 | 9 Given the log normal risk model named "lognormal-risk-model-1": 10 | risk aversion | tau | mu | r | sigma | 11 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 12 13 And the price monitoring named "price-monitoring-1": 14 | horizon | probability | auction extension | 15 | 36000 | 0.999 | 23 | 16 17 And the liquidity sla params named "SLA-1": 18 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 19 | 1 | 0.1 | 2 | 0.2 | 20 21 Given the following assets are registered: 22 | id | decimal places | 23 | ETH | 1 | 24 | BTC | 1 | 25 26 And the following network parameters are set: 27 | name | value | 28 | network.markPriceUpdateMaximumFrequency | 2s | 29 | market.liquidity.earlyExitPenalty | 0.25 | 30 | market.liquidity.bondPenaltyParameter | 0 | 31 | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.5 | 32 | market.liquidity.sla.nonPerformanceBondPenaltyMax | 0.2 | 33 | market.liquidity.maximumLiquidityFeeFactorLevel | 0.4 | 34 | validators.epoch.length | 2s | 35 | limits.markets.maxPeggedOrders | 10 | 36 | market.liquidity.probabilityOfTrading.tau.scaling | 0.1 | 37 38 And the spot markets: 39 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | sla params | 40 | BTC/ETH | BTC/ETH | BTC | ETH | lognormal-risk-model-1 | 1 | fees-config-1 | price-monitoring-1 | SLA-1 | 41 And the following network parameters are set: 42 | name | value | 43 | market.liquidity.providersFeeCalculationTimeStep | 2s | 44 45 Given the parties deposit on asset's general account the following amount: 46 | party | asset | amount | 47 | party1 | ETH | 100000 | 48 | party2 | BTC | 5000 | 49 | lp1 | ETH | 4000 | 50 | lp1 | BTC | 600 | 51 | lp2 | ETH | 4000 | 52 | lp2 | BTC | 600 | 53 | lp3 | ETH | 4000 | 54 | lp3 | BTC | 600 | 55 56 And the average block duration is "1" 57 58 Given the liquidity monitoring parameters: 59 | name | triggering ratio | time window | scaling factor | 60 | updated-lqm-params | 0.2 | 20s | 0.8 | 61 62 When the spot markets are updated: 63 | id | liquidity monitoring | linear slippage factor | quadratic slippage factor | 64 | BTC/ETH | updated-lqm-params | 0.5 | 0.5 | 65 66 Then the network moves ahead "1" blocks 67 Then the market data for the market "BTC/ETH" should be: 68 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 69 | 0 | TRADING_MODE_OPENING_AUCTION | AUCTION_TRIGGER_OPENING | 0 | 0 | 0 | 70 71 # place orders and generate trades 72 And the parties place the following orders: 73 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 74 | party1 | BTC/ETH | buy | 1 | 10 | 0 | TYPE_LIMIT | TIF_GTC | buy-party-order1 | | 75 | party1 | BTC/ETH | buy | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | buy-party-order2 | | 76 | party1 | BTC/ETH | buy | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | buy-party-order3 | | 77 | party2 | BTC/ETH | sell | 1 | 15 | 0 | TYPE_LIMIT | TIF_GTC | sell-party-order1 | | 78 # | party2 | BTC/ETH | sell | 1 | 18 | 0 | TYPE_LIMIT | TIF_GTC | sell-party-order2 | | 79 80 When the network moves ahead "4" blocks 81 82 Then the market data for the market "BTC/ETH" should be: 83 | mark price | trading mode | auction trigger | horizon | min bound | max bound | target stake | supplied stake | 84 | 15 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 36000 | 14 | 17 | 0 | 0 | 85 86 And the parties place the following orders: 87 | party | market id | side | volume | price | resulting trades | type | tif | reference | only | 88 | party2 | BTC/ETH | sell | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | sell-party-order3 | | 89 90 When the network moves ahead "4" blocks 91 92 Then the market data for the market "BTC/ETH" should be: 93 | mark price | trading mode | auction trigger | 94 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 95 96 #cancel the orders that triggered price mon auction 97 Then the parties cancel all their orders for the markets: 98 | party | market id | 99 | party1 | BTC/ETH | 100 | party2 | BTC/ETH | 101 102 When the parties submit the following liquidity provision: 103 | id | party | market id | commitment amount | fee | lp type | 104 | lp1 | lp1 | BTC/ETH | 2000 | 0.4 | submission | 105 106 #lp commits provisions and submits orders 107 #other parties enter orders that will cross 108 And the parties place the following orders: 109 | party | market id | side | volume | price | resulting trades | type | tif | reference | 110 | lp1 | BTC/ETH | buy | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | lp-order1 | 111 | party1 | BTC/ETH | buy | 1 | 14 | 0 | TYPE_LIMIT | TIF_GTC | buy-party-order4 | 112 | party2 | BTC/ETH | sell | 1 | 14 | 0 | TYPE_LIMIT | TIF_GTC | sell-party-order4 | 113 | lp1 | BTC/ETH | sell | 1 | 13 | 0 | TYPE_LIMIT | TIF_GTC | lp-order2 | 114 115 When the network moves ahead "1" blocks 116 Then the market data for the market "BTC/ETH" should be: 117 | mark price | trading mode | auction trigger | 118 | 15 | TRADING_MODE_MONITORING_AUCTION | AUCTION_TRIGGER_PRICE | 119 120 When the market states are updated through governance: 121 | market id | state | 122 | BTC/ETH | MARKET_STATE_UPDATE_TYPE_TERMINATE | 123 124 125 # When the network moves ahead "4" blocks 126 127 # Then the market data for the market "BTC/ETH" should be: 128 # | mark price | trading mode | auction trigger | 129 # | 13 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 130 131 # When the network moves ahead "1" blocks 132 133 # And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 134 # Then the party "lp1" lp liquidity bond account balance should be "2000" for the market "BTC/ETH" 135 # And the parties should have the following account balances: 136 # | party | asset | market id | general | 137 # | lp1 | BTC | BTC/ETH | 610 | 138 # | lp1 | ETH | BTC/ETH | 1865 | 139 140 # When the market states are updated through governance: 141 # | market id | state | 142 # | BTC/ETH | MARKET_STATE_UPDATE_TYPE_TERMINATE | 143 144 # And the parties should have the following account balances: 145 # | party | asset | market id | general | 146 # | lp1 | BTC | BTC/ETH | 610 | 147 # | lp1 | ETH | BTC/ETH | 3865 | 148 149 # Then "lp1" should have holding account balance of "0" for asset "ETH" 150 # And the party "lp1" lp liquidity fee account balance should be "0" for the market "BTC/ETH" 151 # Then the party "lp1" lp liquidity bond account balance should be "0" for the market "BTC/ETH" 152 153 # And the network treasury balance should be "0" for the asset "ETH" 154 # And the global insurance pool balance should be "0" for the asset "ETH" 155 # And the global insurance pool balance should be "0" for the asset "BTC"