code.vegaprotocol.io/vega@v0.79.0/core/integration/features/successor-markets-insurance.feature (about) 1 Feature: Successor markets: Global insurance pool account collects all outstanding funds from closed/expired markets in a risk universe (0013-ACCT-032 0013-ACCT-033) 2 3 Background: 4 Given time is updated to "2019-11-30T00:00:00Z" 5 And the following assets are registered: 6 | id | decimal places | 7 | ETH | 1 | 8 | USD | 1 | 9 10 Given the log normal risk model named "lognormal-risk-model-fish": 11 | risk aversion | tau | mu | r | sigma | 12 | 0.001 | 0.01 | 0 | 0.0 | 1.2 | 13 And the margin calculator named "margin-calculator-1": 14 | search factor | initial factor | release factor | 15 | 1.2 | 1.5 | 2 | 16 17 ## Create some oracles 18 ## oracle for parent 19 And the oracle spec for settlement data filtering data from "0xCAFECAFE1" named "ethDec19Oracle": 20 | property | type | binding | 21 | prices.ETH.value | TYPE_INTEGER | settlement data | 22 And the oracle spec for trading termination filtering data from "0xCAFECAFE1" named "ethDec19Oracle": 23 | property | type | binding | 24 | trading.terminated | TYPE_BOOLEAN | trading termination | 25 And the settlement data decimals for the oracle named "ethDec19Oracle" is given in "0" decimal places 26 27 ## oracle for a successor 1 28 And the oracle spec for settlement data filtering data from "0xCAFECAAA" named "ethDec20Oracle": 29 | property | type | binding | 30 | prices.ETH.value | TYPE_INTEGER | settlement data | 31 And the oracle spec for trading termination filtering data from "0xCAFECAAA" named "ethDec20Oracle": 32 | property | type | binding | 33 | trading.terminated | TYPE_BOOLEAN | trading termination | 34 And the settlement data decimals for the oracle named "ethDec20Oracle" is given in "0" decimal places 35 36 ## oracle for a successor 2 37 And the oracle spec for settlement data filtering data from "0xCAFECABB" named "ethDec21Oracle": 38 | property | type | binding | 39 | prices.ETH.value | TYPE_INTEGER | settlement data | 40 And the oracle spec for trading termination filtering data from "0xCAFECABB" named "ethDec21Oracle": 41 | property | type | binding | 42 | trading.terminated | TYPE_BOOLEAN | trading termination | 43 And the settlement data decimals for the oracle named "ethDec21Oracle" is given in "0" decimal places 44 45 ## oracle for a successor 3 46 And the oracle spec for settlement data filtering data from "0xCAFECACC" named "ethDec22Oracle": 47 | property | type | binding | 48 | prices.ETH.value | TYPE_INTEGER | settlement data | 49 And the oracle spec for trading termination filtering data from "0xCAFECACC" named "ethDec22Oracle": 50 | property | type | binding | 51 | trading.terminated | TYPE_BOOLEAN | trading termination | 52 And the settlement data decimals for the oracle named "ethDec22Oracle" is given in "0" decimal places 53 54 ## oracle for a successor 4 55 And the oracle spec for settlement data filtering data from "0xCAFECADD" named "ethDec23Oracle": 56 | property | type | binding | 57 | prices.ETH.value | TYPE_INTEGER | settlement data | 58 And the oracle spec for trading termination filtering data from "0xCAFECADD" named "ethDec23Oracle": 59 | property | type | binding | 60 | trading.terminated | TYPE_BOOLEAN | trading termination | 61 And the settlement data decimals for the oracle named "ethDec23Oracle" is given in "0" decimal places 62 63 And the liquidity monitoring parameters: 64 | name | triggering ratio | time window | scaling factor | 65 | lqm-params | 0.01 | 10s | 5 | 66 67 And the following network parameters are set: 68 | name | value | 69 | network.markPriceUpdateMaximumFrequency | 0s | 70 | market.auction.minimumDuration | 1 | 71 | market.fee.factors.infrastructureFee | 0.001 | 72 | market.fee.factors.makerFee | 0.004 | 73 | market.value.windowLength | 60s | 74 | market.liquidity.bondPenaltyParameter | 0.1 | 75 | validators.epoch.length | 5s | 76 | market.liquidity.stakeToCcyVolume | 0.2 | 77 | market.liquidity.successorLaunchWindowLength | 8s | 78 | limits.markets.maxPeggedOrders | 2 | 79 And the average block duration is "1" 80 81 82 ## All parties have 1,000,000.000,000,000,000,000,000 83 ## Add as many parties as needed here 84 And the parties deposit on asset's general account the following amount: 85 | party | asset | amount | 86 | lpprov1 | USD | 10000000000000000000000000 | 87 | lpprov2 | USD | 10000000000000000000000000 | 88 | trader1 | USD | 10000000000000000000000000 | 89 | trader2 | USD | 10000000000000000000000000 | 90 | trader3 | USD | 10000000000000000000000000 | 91 | trader4 | USD | 10000000000000000000000000 | 92 | trader5 | USD | 10000000000000000000000000 | 93 94 @SMGIP01 95 Scenario: Test global insurance pool collects successor markets insurance balances: parent and a successor leave opening auction, parent is canceled. 96 Given the markets: 97 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 98 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 99 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 100 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 101 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 102 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 103 104 Given the initial insurance pool balance is "1000" for all the markets 105 And the parties submit the following liquidity provision: 106 | id | party | market id | commitment amount | fee | lp type | 107 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 108 | lp2 | lpprov2 | ETH/DEC20 | 1000 | 0.1 | submission | 109 110 And the parties place the following pegged iceberg orders: 111 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 112 | lpprov2 | ETH/DEC20 | 2 | 1 | buy | BID | 500 | 10 | 113 | lpprov2 | ETH/DEC20 | 2 | 1 | sell | ASK | 500 | 10 | 114 115 And the parties place the following orders: 116 | party | market id | side | volume | price | resulting trades | type | tif | 117 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 118 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 119 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 120 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 121 | lpprov1 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 122 | lpprov1 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 123 124 And the network moves ahead "2" blocks 125 Then the mark price should be "150" for the market "ETH/DEC19" 126 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 127 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 128 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 129 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 130 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 131 132 ## Now ETH/DEC20 leaves opening auction 133 When the parties place the following orders: 134 | party | market id | side | volume | price | resulting trades | type | tif | 135 | trader1 | ETH/DEC20 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 136 | trader1 | ETH/DEC20 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 137 | trader2 | ETH/DEC20 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 138 | trader2 | ETH/DEC20 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 139 140 And the network moves ahead "11" blocks 141 Then the mark price should be "150" for the market "ETH/DEC20" 142 143 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 144 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 145 146 ## Insurance pool for closed market is distributed 147 And the insurance pool balance should be "500" for the market "ETH/DEC19" 148 And the insurance pool balance should be "1500" for the market "ETH/DEC20" 149 And the insurance pool balance should be "0" for the market "ETH/DEC21" 150 And the insurance pool balance should be "0" for the market "ETH/DEC22" 151 And the insurance pool balance should be "0" for the market "ETH/DEC23" 152 153 And the global insurance pool balance should be "3000" for the asset "USD" 154 155 ## Cancel ETH/DEC19 156 When the market states are updated through governance: 157 | market id | state | settlement price | 158 | ETH/DEC19 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 159 160 ## Insurance pool for closed market is distributed as two equal parts to the remaining successor 161 ## and the global insurance pool 162 And the insurance pool balance should be "0" for the market "ETH/DEC19" 163 And the insurance pool balance should be "1500" for the market "ETH/DEC20" 164 165 And the global insurance pool balance should be "3500" for the asset "USD" 166 167 And the network moves ahead "1" blocks 168 169 ## Terminate ETH/DEC20 170 Then the oracles broadcast data signed with "0xCAFECAAA": 171 | name | value | 172 | trading.terminated | true | 173 174 And the network moves ahead "1" blocks 175 176 ## Settle ETH/DEC20 177 When the oracles broadcast data signed with "0xCAFECAAA": 178 | name | value | 179 | prices.ETH.value | 14000000 | 180 181 Then the market state should be "STATE_SETTLED" for the market "ETH/DEC20" 182 And then the network moves ahead "1" blocks 183 184 And the insurance pool balance should be "1500" for the market "ETH/DEC20" 185 And the global insurance pool balance should be "3500" for the asset "USD" 186 187 And the network moves ahead "10" blocks 188 189 And the global insurance pool balance should be "5000" for the asset "USD" 190 191 ## The insurance pools from the settled/cancelled markets are all drained 192 Then the insurance pool balance should be "0" for the market "ETH/DEC19" 193 And the insurance pool balance should be "0" for the market "ETH/DEC20" 194 And the insurance pool balance should be "0" for the market "ETH/DEC21" 195 And the insurance pool balance should be "0" for the market "ETH/DEC22" 196 And the insurance pool balance should be "0" for the market "ETH/DEC23" 197 198 199 @SMGIP02 200 Scenario: Test global insurance pool collects successor and parent markets balances: parent and a successor leave opening auction, successor is canceled. 201 Given the markets: 202 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 203 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 204 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 205 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 206 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 207 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 208 209 Given the initial insurance pool balance is "1000" for all the markets 210 And the parties submit the following liquidity provision: 211 | id | party | market id | commitment amount | fee | lp type | 212 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 213 | lp2 | lpprov2 | ETH/DEC20 | 1000 | 0.1 | submission | 214 215 And the parties place the following pegged iceberg orders: 216 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 217 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | BID | 500 | 10 | 218 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | ASK | 500 | 10 | 219 220 And the parties place the following orders: 221 | party | market id | side | volume | price | resulting trades | type | tif | 222 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 223 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 224 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 225 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 226 | lpprov1 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 227 | lpprov1 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 228 229 And the network moves ahead "2" blocks 230 Then the mark price should be "150" for the market "ETH/DEC19" 231 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 232 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 233 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 234 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 235 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 236 237 ## Terminate ETH/DEC19 238 Then the oracles broadcast data signed with "0xCAFECAFE1": 239 | name | value | 240 | trading.terminated | true | 241 242 And the network moves ahead "1" blocks 243 244 ## Settle ETH/DEC19 245 When the oracles broadcast data signed with "0xCAFECAFE1": 246 | name | value | 247 | prices.ETH.value | 14000000 | 248 249 Then the market state should be "STATE_SETTLED" for the market "ETH/DEC19" 250 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 251 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 252 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 253 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 254 255 And then the network moves ahead "11" blocks 256 257 ## The balance from the settled parent market gets distributed equally among the remaining 258 ## 4 successor markets in TRADING_MODE_OPENING_AUCTION and the global insurance pool 259 And the insurance pool balance should be "0" for the market "ETH/DEC19" 260 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 261 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 262 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 263 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 264 265 And the global insurance pool balance should be "1000" for the asset "USD" 266 267 ## Get one of the successors into continous mode 268 And the parties place the following orders: 269 | party | market id | side | volume | price | resulting trades | type | tif | 270 | trader1 | ETH/DEC20 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 271 | trader1 | ETH/DEC20 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 272 | trader1 | ETH/DEC20 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 273 | trader2 | ETH/DEC20 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 274 | lpprov1 | ETH/DEC20 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 275 | lpprov1 | ETH/DEC20 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 276 277 And the network moves ahead "2" blocks 278 Then the mark price should be "150" for the market "ETH/DEC20" 279 280 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC20" 281 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 282 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 283 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 284 285 ## Insurance pool balances are not changed at this point 286 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 287 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 288 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 289 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 290 And the global insurance pool balance should be "1000" for the asset "USD" 291 292 ## Cancel ETH/DEC20 293 When the market states are updated through governance: 294 | market id | state | settlement price | 295 | ETH/DEC20 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 296 297 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 298 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 299 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 300 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 301 302 And the network moves ahead "10" blocks 303 304 ## Insurance balance from ETH/DEC20 is moved to global insurance account 305 ## and the global insurance pool 306 And the insurance pool balance should be "0" for the market "ETH/DEC20" 307 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 308 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 309 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 310 311 And the global insurance pool balance should be "2000" for the asset "USD" 312 313 ## Now we need to cancel the remaining successor markets one by one. 314 ## Cancel ETH/DEC21 315 When the market states are updated through governance: 316 | market id | state | settlement price | 317 | ETH/DEC21 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 318 319 And the network moves ahead "10" blocks 320 And the insurance pool balance should be "0" for the market "ETH/DEC20" 321 And the insurance pool balance should be "0" for the market "ETH/DEC21" 322 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 323 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 324 325 And the global insurance pool balance should be "3000" for the asset "USD" 326 327 ## Cancel ETH/DEC22 328 When the market states are updated through governance: 329 | market id | state | settlement price | 330 | ETH/DEC22 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 331 332 And the network moves ahead "10" blocks 333 And the insurance pool balance should be "0" for the market "ETH/DEC20" 334 And the insurance pool balance should be "0" for the market "ETH/DEC21" 335 And the insurance pool balance should be "0" for the market "ETH/DEC22" 336 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 337 338 And the global insurance pool balance should be "4000" for the asset "USD" 339 340 ## Cancel ETH/DEC23 341 When the market states are updated through governance: 342 | market id | state | settlement price | 343 | ETH/DEC23 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 344 345 And the network moves ahead "10" blocks 346 347 ## Insurance balances from all successors are now drained 348 And the insurance pool balance should be "0" for the market "ETH/DEC20" 349 And the insurance pool balance should be "0" for the market "ETH/DEC21" 350 And the insurance pool balance should be "0" for the market "ETH/DEC22" 351 And the insurance pool balance should be "0" for the market "ETH/DEC23" 352 353 And the global insurance pool balance should be "5000" for the asset "USD" 354 355 356 @SMGIP03 357 Scenario: Test global insurance pool collects successor and parent markets balances: parent, successor leave opening auction, successor is canceled. 358 Given the markets: 359 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 360 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 361 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 362 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 363 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 364 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 365 366 Given the initial insurance pool balance is "1000" for all the markets 367 And the parties submit the following liquidity provision: 368 | id | party | market id | commitment amount | fee | lp type | 369 | lp1 | lpprov1 | ETH/DEC21 | 9000 | 0.1 | submission | 370 | lp2 | lpprov2 | ETH/DEC21 | 1000 | 0.1 | submission | 371 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 372 | lp2 | lpprov2 | ETH/DEC19 | 1000 | 0.1 | submission | 373 374 And the parties place the following pegged iceberg orders: 375 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 376 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | BID | 500 | 10 | 377 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | ASK | 500 | 10 | 378 379 ## Place orders on one of the successor markets 380 And the parties place the following orders: 381 | party | market id | side | volume | price | resulting trades | type | tif | 382 | trader1 | ETH/DEC21 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 383 | trader1 | ETH/DEC21 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 384 | trader1 | ETH/DEC21 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 385 | trader2 | ETH/DEC21 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 386 | lpprov1 | ETH/DEC21 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 387 | lpprov1 | ETH/DEC21 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 388 389 And the network moves ahead "1" blocks 390 391 ## Successor window did not pass, mark price 0, ETH/DEC21 is in opening auction yet 392 Then the mark price should be "0" for the market "ETH/DEC21" 393 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 394 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 395 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 396 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 397 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 398 399 ## Insurance pools did not change 400 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 401 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 402 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 403 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 404 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 405 And the global insurance pool balance should be "0" for the asset "USD" 406 407 And the network moves ahead "10" blocks 408 Then the mark price should be "0" for the market "ETH/DEC21" 409 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 410 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 411 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 412 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 413 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 414 415 And the parties place the following orders: 416 | party | market id | side | volume | price | resulting trades | type | tif | 417 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 418 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 419 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 420 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 421 | lpprov2 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 422 | lpprov2 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 423 424 And the network moves ahead "2" blocks 425 426 Then the mark price should be "150" for the market "ETH/DEC21" 427 Then the mark price should be "150" for the market "ETH/DEC19" 428 429 ## The enacted successor market caused the rest of the successors to be closed. 430 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 431 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 432 433 ## Insurance pool balances for canceled successors got distributed as: 434 ## 50% to the enacted successor, remaining amount in two parts 1:2 to the parent and global insurance pool 435 And the insurance pool balance should be "500" for the market "ETH/DEC19" 436 And the insurance pool balance should be "0" for the market "ETH/DEC20" 437 And the insurance pool balance should be "1500" for the market "ETH/DEC21" 438 And the insurance pool balance should be "0" for the market "ETH/DEC22" 439 And the insurance pool balance should be "0" for the market "ETH/DEC23" 440 And the global insurance pool balance should be "3000" for the asset "USD" 441 442 And the network moves ahead "10" blocks 443 444 ## Market price for the parent is still 0 and it is in TRADING_MODE_OPENING_AUCTION 445 Then the mark price should be "150" for the market "ETH/DEC19" 446 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 447 448 ## Mark price for the earlier traded ETH/DEC21 is already 150 449 Then the mark price should be "150" for the market "ETH/DEC21" 450 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 451 452 ## Cancel ETH/DEC21 453 When the market states are updated through governance: 454 | market id | state | settlement price | 455 | ETH/DEC21 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 456 457 And the network moves ahead "1" blocks 458 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 459 460 And the insurance pool balance should be "500" for the market "ETH/DEC19" 461 And the insurance pool balance should be "1500" for the market "ETH/DEC21" 462 And the insurance pool balance should be "0" for the market "ETH/DEC20" 463 And the insurance pool balance should be "0" for the market "ETH/DEC22" 464 And the insurance pool balance should be "0" for the market "ETH/DEC23" 465 466 And the global insurance pool balance should be "3000" for the asset "USD" 467 468 And the network moves ahead "10" blocks 469 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 470 471 ## After ETH/DEC21 was canceled its insurance pool balance is moved into the global insurance account 472 And the insurance pool balance should be "500" for the market "ETH/DEC19" 473 And the insurance pool balance should be "0" for the market "ETH/DEC21" 474 And the insurance pool balance should be "0" for the market "ETH/DEC20" 475 And the insurance pool balance should be "0" for the market "ETH/DEC22" 476 And the insurance pool balance should be "0" for the market "ETH/DEC23" 477 478 And the global insurance pool balance should be "4500" for the asset "USD" 479 480 ## Cancel ETH/DEC19 481 When the market states are updated through governance: 482 | market id | state | settlement price | 483 | ETH/DEC19 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 484 485 And the network moves ahead "1" blocks 486 487 And the insurance pool balance should be "0" for the market "ETH/DEC19" 488 And the insurance pool balance should be "0" for the market "ETH/DEC21" 489 And the insurance pool balance should be "0" for the market "ETH/DEC20" 490 And the insurance pool balance should be "0" for the market "ETH/DEC22" 491 And the insurance pool balance should be "0" for the market "ETH/DEC23" 492 493 And the global insurance pool balance should be "5000" for the asset "USD" 494 495 496 @SMGIP04 497 Scenario: Test global insurance pool collects successor and parent markets balances: parent, successor leave opening auction, successor is settled. 498 Given the markets: 499 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 500 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 501 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 502 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 503 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 504 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 505 506 Given the initial insurance pool balance is "1000" for all the markets 507 And the parties submit the following liquidity provision: 508 | id | party | market id | commitment amount | fee | lp type | 509 | lp1 | lpprov1 | ETH/DEC21 | 9000 | 0.1 | submission | 510 | lp2 | lpprov2 | ETH/DEC21 | 1000 | 0.1 | submission | 511 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 512 | lp2 | lpprov2 | ETH/DEC19 | 1000 | 0.1 | submission | 513 514 And the parties place the following pegged iceberg orders: 515 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 516 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | BID | 500 | 10 | 517 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | ASK | 500 | 10 | 518 519 ## Place orders on one of the successor markets 520 And the parties place the following orders: 521 | party | market id | side | volume | price | resulting trades | type | tif | 522 | trader1 | ETH/DEC21 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 523 | trader1 | ETH/DEC21 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 524 | trader1 | ETH/DEC21 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 525 | trader2 | ETH/DEC21 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 526 | lpprov1 | ETH/DEC21 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 527 | lpprov1 | ETH/DEC21 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 528 529 And the network moves ahead "1" blocks 530 531 ## Successor window did not pass, mark price 0, ETH/DEC21 is in opening auction yet 532 Then the mark price should be "0" for the market "ETH/DEC21" 533 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 534 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 535 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 536 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 537 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 538 539 ## Insurance pools did not change 540 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 541 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 542 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 543 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 544 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 545 And the global insurance pool balance should be "0" for the asset "USD" 546 547 And the network moves ahead "10" blocks 548 Then the mark price should be "0" for the market "ETH/DEC21" 549 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 550 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 551 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 552 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 553 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 554 555 And the parties place the following orders: 556 | party | market id | side | volume | price | resulting trades | type | tif | 557 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 558 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 559 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 560 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 561 | lpprov2 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 562 | lpprov2 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 563 564 And the network moves ahead "2" blocks 565 566 Then the mark price should be "150" for the market "ETH/DEC21" 567 Then the mark price should be "150" for the market "ETH/DEC19" 568 569 ## The enacted successor market caused the rest of the successors to be closed. 570 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 571 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 572 573 ## Insurance pool balances for canceled successors got distributed as: 574 ## 50% to the enacted successor, remaining amount in two parts 1:2 to the parent and global insurance account 575 And the insurance pool balance should be "500" for the market "ETH/DEC19" 576 And the insurance pool balance should be "0" for the market "ETH/DEC20" 577 And the insurance pool balance should be "1500" for the market "ETH/DEC21" 578 And the insurance pool balance should be "0" for the market "ETH/DEC22" 579 And the insurance pool balance should be "0" for the market "ETH/DEC23" 580 And the global insurance pool balance should be "3000" for the asset "USD" 581 582 And the network moves ahead "10" blocks 583 584 ## Market price for the parent is still 0 and it is in TRADING_MODE_OPENING_AUCTION 585 Then the mark price should be "150" for the market "ETH/DEC19" 586 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 587 588 ## Mark price for the earlier traded ETH/DEC21 is already 150 589 Then the mark price should be "150" for the market "ETH/DEC21" 590 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21" 591 592 ## Terminate ETH/DEC21 593 Then the oracles broadcast data signed with "0xCAFECABB": 594 | name | value | 595 | trading.terminated | true | 596 597 And the network moves ahead "1" blocks 598 599 ## Settle ETH/DEC21 600 When the oracles broadcast data signed with "0xCAFECABB": 601 | name | value | 602 | prices.ETH.value | 14000000 | 603 604 Then the market state should be "STATE_SETTLED" for the market "ETH/DEC21" 605 And the network moves ahead "1" blocks 606 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 607 608 And the insurance pool balance should be "500" for the market "ETH/DEC19" 609 And the insurance pool balance should be "1500" for the market "ETH/DEC21" 610 And the insurance pool balance should be "0" for the market "ETH/DEC20" 611 And the insurance pool balance should be "0" for the market "ETH/DEC22" 612 And the insurance pool balance should be "0" for the market "ETH/DEC23" 613 614 And the global insurance pool balance should be "3000" for the asset "USD" 615 616 And the network moves ahead "10" blocks 617 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 618 619 ## After ETH/DEC21 was canceled - its insurance pool balance is moved into the global insruance account 620 And the insurance pool balance should be "500" for the market "ETH/DEC19" 621 And the insurance pool balance should be "0" for the market "ETH/DEC21" 622 And the insurance pool balance should be "0" for the market "ETH/DEC20" 623 And the insurance pool balance should be "0" for the market "ETH/DEC22" 624 And the insurance pool balance should be "0" for the market "ETH/DEC23" 625 626 And the global insurance pool balance should be "4500" for the asset "USD" 627 628 ## Cancel ETH/DEC19 629 When the market states are updated through governance: 630 | market id | state | settlement price | 631 | ETH/DEC19 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 632 633 And the network moves ahead "1" blocks 634 635 And the insurance pool balance should be "0" for the market "ETH/DEC19" 636 And the insurance pool balance should be "0" for the market "ETH/DEC21" 637 And the insurance pool balance should be "0" for the market "ETH/DEC20" 638 And the insurance pool balance should be "0" for the market "ETH/DEC22" 639 And the insurance pool balance should be "0" for the market "ETH/DEC23" 640 641 And the global insurance pool balance should be "5000" for the asset "USD" 642 643 644 @SMGIP05 645 Scenario: Test global insurance pool collects successor and parent markets balances: parent, three successors, successors settled. 646 Given the markets: 647 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 648 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 649 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 650 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 651 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 652 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 653 654 Given the initial insurance pool balance is "1000" for all the markets 655 And the parties submit the following liquidity provision: 656 | id | party | market id | commitment amount | fee | lp type | 657 | lp1 | lpprov1 | ETH/DEC20 | 9000 | 0.1 | submission | 658 | lp2 | lpprov2 | ETH/DEC20 | 1000 | 0.1 | submission | 659 | lp1 | lpprov1 | ETH/DEC21 | 9000 | 0.1 | submission | 660 | lp2 | lpprov2 | ETH/DEC21 | 1000 | 0.1 | submission | 661 | lp1 | lpprov1 | ETH/DEC22 | 9000 | 0.1 | submission | 662 | lp2 | lpprov2 | ETH/DEC22 | 1000 | 0.1 | submission | 663 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 664 | lp2 | lpprov2 | ETH/DEC19 | 1000 | 0.1 | submission | 665 666 And the parties place the following pegged iceberg orders: 667 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 668 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | BID | 500 | 10 | 669 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | ASK | 500 | 10 | 670 671 ## Place orders on one of the successor markets 672 And the parties place the following orders: 673 | party | market id | side | volume | price | resulting trades | type | tif | 674 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 675 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 676 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 677 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 678 | lpprov1 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 679 | lpprov1 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 680 | trader1 | ETH/DEC21 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 681 | trader1 | ETH/DEC21 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 682 | lpprov1 | ETH/DEC21 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 683 | trader1 | ETH/DEC22 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 684 | trader2 | ETH/DEC22 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 685 | lpprov1 | ETH/DEC22 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 686 687 And the network moves ahead "1" blocks 688 689 ## Successor window did not pass, mark price 0, ETH/DEC21 and ETH/DEC22 in opening auction yet 690 Then the mark price should be "0" for the market "ETH/DEC19" 691 Then the mark price should be "0" for the market "ETH/DEC21" 692 Then the mark price should be "0" for the market "ETH/DEC22" 693 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 694 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 695 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 696 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 697 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 698 699 ## Insurance pools did not change 700 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 701 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 702 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 703 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 704 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 705 And the global insurance pool balance should be "0" for the asset "USD" 706 707 And the network moves ahead "10" blocks 708 Then the mark price should be "150" for the market "ETH/DEC19" 709 Then the mark price should be "0" for the market "ETH/DEC21" 710 Then the mark price should be "0" for the market "ETH/DEC22" 711 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 712 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 713 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 714 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 715 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 716 717 And the parties place the following orders: 718 | party | market id | side | volume | price | resulting trades | type | tif | 719 | trader1 | ETH/DEC23 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 720 | trader1 | ETH/DEC23 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 721 | lpprov2 | ETH/DEC23 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 722 723 And the network moves ahead "2" blocks 724 725 Then the mark price should be "0" for the market "ETH/DEC23" 726 Then the mark price should be "0" for the market "ETH/DEC21" 727 Then the mark price should be "0" for the market "ETH/DEC22" 728 Then the mark price should be "150" for the market "ETH/DEC19" 729 730 ## The enacted successor market caused the rest of the successors to be closed. 731 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 732 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 733 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 734 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 735 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 736 737 ## Insurance pool balances did not change 738 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 739 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 740 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 741 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 742 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 743 And the global insurance pool balance should be "0" for the asset "USD" 744 745 And the network moves ahead "10" blocks 746 747 Then the mark price should be "0" for the market "ETH/DEC23" 748 Then the mark price should be "0" for the market "ETH/DEC21" 749 Then the mark price should be "0" for the market "ETH/DEC22" 750 Then the mark price should be "150" for the market "ETH/DEC19" 751 752 ## Settle one of the successors that initially had orders 753 Then the oracles broadcast data signed with "0xCAFECABB": 754 | name | value | 755 | trading.terminated | true | 756 757 And the network moves ahead "1" blocks 758 759 When the oracles broadcast data signed with "0xCAFECABB": 760 | name | value | 761 | prices.ETH.value | 14000000 | 762 763 And the network moves ahead "2" blocks 764 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 765 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 766 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 767 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 768 769 ## Settled successor moved into global insurnace account 770 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 771 And the insurance pool balance should be "0" for the market "ETH/DEC21" 772 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 773 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 774 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 775 776 And the global insurance pool balance should be "1000" for the asset "USD" 777 778 ## Settle another of the successors that initially had orders 779 Then the oracles broadcast data signed with "0xCAFECACC": 780 | name | value | 781 | trading.terminated | true | 782 783 And the network moves ahead "1" blocks 784 785 When the oracles broadcast data signed with "0xCAFECACC": 786 | name | value | 787 | prices.ETH.value | 14000000 | 788 789 And the network moves ahead "2" blocks 790 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 791 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 792 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 793 794 ## Settled successor moved into the global insurance account. 795 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 796 And the insurance pool balance should be "0" for the market "ETH/DEC21" 797 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 798 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 799 800 And the global insurance pool balance should be "2000" for the asset "USD" 801 802 And the network moves ahead "10" blocks 803 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 804 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 805 806 ## Settle ETH/DEC19 807 Then the oracles broadcast data signed with "0xCAFECAFE1": 808 | name | value | 809 | trading.terminated | true | 810 811 And the network moves ahead "1" blocks 812 813 When the oracles broadcast data signed with "0xCAFECAFE1": 814 | name | value | 815 | prices.ETH.value | 14000000 | 816 817 And the network moves ahead "1" blocks 818 Then the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 819 820 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 821 And the insurance pool balance should be "0" for the market "ETH/DEC21" 822 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 823 And the insurance pool balance should be "0" for the market "ETH/DEC22" 824 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 825 826 And the global insurance pool balance should be "2000" for the asset "USD" 827 ## wait until successor window expires 828 When the network moves ahead "9" blocks 829 Then the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 830 831 And the insurance pool balance should be "0" for the market "ETH/DEC19" 832 And the insurance pool balance should be "0" for the market "ETH/DEC21" 833 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 834 And the insurance pool balance should be "0" for the market "ETH/DEC22" 835 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 836 And the global insurance pool balance should be "3000" for the asset "USD" 837 838 ## Cancel the last successor 839 When the market states are updated through governance: 840 | market id | state | settlement price | 841 | ETH/DEC23 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 842 843 And the insurance pool balance should be "0" for the market "ETH/DEC19" 844 And the insurance pool balance should be "0" for the market "ETH/DEC21" 845 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 846 And the insurance pool balance should be "0" for the market "ETH/DEC22" 847 And the insurance pool balance should be "0" for the market "ETH/DEC23" 848 849 And the global insurance pool balance should be "4000" for the asset "USD" 850 851 ## Cancel the ETH/DEC20 successor 852 When the market states are updated through governance: 853 | market id | state | settlement price | 854 | ETH/DEC20 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 855 856 And the insurance pool balance should be "0" for the market "ETH/DEC19" 857 And the insurance pool balance should be "0" for the market "ETH/DEC21" 858 And the insurance pool balance should be "0" for the market "ETH/DEC20" 859 And the insurance pool balance should be "0" for the market "ETH/DEC22" 860 And the insurance pool balance should be "0" for the market "ETH/DEC23" 861 862 And the global insurance pool balance should be "5000" for the asset "USD" 863 864 865 @SMGIP06 866 Scenario: Test global insurance pool collects successor and parent markets balances: parent, three successors, parent leave opening auction, successors settled. 867 Given the markets: 868 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 869 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 870 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 871 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 872 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 873 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 874 875 Given the initial insurance pool balance is "1000" for all the markets 876 And the parties submit the following liquidity provision: 877 | id | party | market id | commitment amount | fee | lp type | 878 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 879 | lp2 | lpprov2 | ETH/DEC19 | 1000 | 0.1 | submission | 880 | lp1 | lpprov1 | ETH/DEC23 | 9000 | 0.1 | submission | 881 | lp2 | lpprov2 | ETH/DEC23 | 1000 | 0.1 | submission | 882 883 884 ## Place orders on one of the successor markets 885 And the parties place the following orders: 886 | party | market id | side | volume | price | resulting trades | type | tif | 887 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 888 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 889 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 890 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 891 | lpprov1 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 892 | lpprov1 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 893 894 And the network moves ahead "1" blocks 895 896 And the parties place the following orders: 897 | party | market id | side | volume | price | resulting trades | type | tif | 898 | trader1 | ETH/DEC23 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 899 | trader1 | ETH/DEC23 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 900 | lpprov2 | ETH/DEC23 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 901 902 903 ## Successor window did not pass, mark price 0, ETH/DEC19 in opening auction yet 904 Then the mark price should be "0" for the market "ETH/DEC19" 905 906 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 907 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 908 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 909 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 910 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 911 912 And the network moves ahead "10" blocks 913 Then the mark price should be "150" for the market "ETH/DEC19" 914 915 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 916 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 917 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 918 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 919 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 920 921 And the parties place the following orders: 922 | party | market id | side | volume | price | resulting trades | type | tif | 923 | trader1 | ETH/DEC21 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 924 | trader1 | ETH/DEC21 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 925 | lpprov2 | ETH/DEC21 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 926 927 And the network moves ahead "2" blocks 928 929 Then the mark price should be "0" for the market "ETH/DEC21" 930 Then the mark price should be "0" for the market "ETH/DEC23" 931 Then the mark price should be "150" for the market "ETH/DEC19" 932 933 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 934 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 935 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 936 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 937 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 938 939 And the network moves ahead "10" blocks 940 941 Then the mark price should be "0" for the market "ETH/DEC23" 942 Then the mark price should be "0" for the market "ETH/DEC21" 943 Then the mark price should be "150" for the market "ETH/DEC19" 944 945 ## Insurance pool balances did not change 946 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 947 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 948 And the insurance pool balance should be "1000" for the market "ETH/DEC21" 949 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 950 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 951 And the global insurance pool balance should be "0" for the asset "USD" 952 953 ## Settle one of the successors 954 Then the oracles broadcast data signed with "0xCAFECABB": 955 | name | value | 956 | trading.terminated | true | 957 958 And the network moves ahead "1" blocks 959 960 When the oracles broadcast data signed with "0xCAFECABB": 961 | name | value | 962 | prices.ETH.value | 14000000 | 963 964 965 And the network moves ahead "2" blocks 966 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 967 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 968 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 969 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 970 971 ## Settled successor moved into global insurance account 972 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 973 And the insurance pool balance should be "0" for the market "ETH/DEC21" 974 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 975 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 976 And the insurance pool balance should be "1000" for the market "ETH/DEC23" 977 978 And the global insurance pool balance should be "1000" for the asset "USD" 979 980 ## Settle the other of the successors that had orders - ETH/DEC23 981 Then the oracles broadcast data signed with "0xCAFECADD": 982 | name | value | 983 | trading.terminated | true | 984 985 And the network moves ahead "1" blocks 986 987 When the oracles broadcast data signed with "0xCAFECADD": 988 | name | value | 989 | prices.ETH.value | 14000000 | 990 991 And the network moves ahead "2" blocks 992 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 993 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 994 995 ## Settled successor remaining insurance pool balance is moved into the global insurance account. 996 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 997 And the insurance pool balance should be "0" for the market "ETH/DEC21" 998 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 999 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 1000 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1001 1002 And the global insurance pool balance should be "2000" for the asset "USD" 1003 1004 And the network moves ahead "10" blocks 1005 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 1006 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 1007 1008 ## Settle ETH/DEC19 1009 Then the oracles broadcast data signed with "0xCAFECAFE1": 1010 | name | value | 1011 | trading.terminated | true | 1012 1013 And the network moves ahead "1" blocks 1014 1015 When the oracles broadcast data signed with "0xCAFECAFE1": 1016 | name | value | 1017 | prices.ETH.value | 14000000 | 1018 1019 And the network moves ahead "1" blocks 1020 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 1021 1022 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 1023 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1024 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 1025 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 1026 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1027 1028 And the global insurance pool balance should be "2000" for the asset "USD" 1029 1030 And the network moves ahead "10" blocks 1031 And the insurance pool balance should be "0" for the market "ETH/DEC19" 1032 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1033 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 1034 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 1035 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1036 1037 And the global insurance pool balance should be "3000" for the asset "USD" 1038 1039 ## Cancel the ETH/DEC20 successor 1040 When the market states are updated through governance: 1041 | market id | state | settlement price | 1042 | ETH/DEC20 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 1043 1044 And the insurance pool balance should be "0" for the market "ETH/DEC19" 1045 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1046 And the insurance pool balance should be "0" for the market "ETH/DEC20" 1047 And the insurance pool balance should be "1000" for the market "ETH/DEC22" 1048 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1049 1050 And the global insurance pool balance should be "4000" for the asset "USD" 1051 1052 ## Cancel the ETH/DEC22 successor 1053 When the market states are updated through governance: 1054 | market id | state | settlement price | 1055 | ETH/DEC22 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 1056 1057 1058 And the insurance pool balance should be "0" for the market "ETH/DEC19" 1059 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1060 And the insurance pool balance should be "0" for the market "ETH/DEC20" 1061 And the insurance pool balance should be "0" for the market "ETH/DEC22" 1062 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1063 1064 And the global insurance pool balance should be "5000" for the asset "USD" 1065 1066 1067 @SMGIP07 1068 Scenario: Test global insurance pool collects successor and parent markets balances: parent, three successors, successor leave opening auction, successors settled. 1069 Given the markets: 1070 | id | quote name | asset | liquidity monitoring | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | decimal places | position decimal places | parent market id | insurance pool fraction | successor auction | sla params | 1071 | ETH/DEC19 | ETH | USD | lqm-params | lognormal-risk-model-fish | margin-calculator-1 | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 1 | 1 | | | | default-futures | 1072 | ETH/DEC20 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec20Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 1073 | ETH/DEC21 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec21Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 1074 | ETH/DEC22 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec22Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 1075 | ETH/DEC23 | ETH | USD | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec23Oracle | 0.1 | 0 | 1 | 1 | ETH/DEC19 | 0.5 | 10 | default-futures | 1076 1077 Given the initial insurance pool balance is "1000" for all the markets 1078 And the parties submit the following liquidity provision: 1079 | id | party | market id | commitment amount | fee | lp type | 1080 | lp1 | lpprov1 | ETH/DEC23 | 9000 | 0.1 | submission | 1081 | lp2 | lpprov2 | ETH/DEC23 | 1000 | 0.1 | submission | 1082 | lp1 | lpprov1 | ETH/DEC22 | 9000 | 0.1 | submission | 1083 | lp2 | lpprov2 | ETH/DEC22 | 1000 | 0.1 | submission | 1084 | lp1 | lpprov1 | ETH/DEC21 | 9000 | 0.1 | submission | 1085 | lp2 | lpprov2 | ETH/DEC21 | 1000 | 0.1 | submission | 1086 | lp1 | lpprov1 | ETH/DEC19 | 9000 | 0.1 | submission | 1087 | lp2 | lpprov2 | ETH/DEC19 | 1000 | 0.1 | submission | 1088 1089 And the parties place the following pegged iceberg orders: 1090 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 1091 | lpprov2 | ETH/DEC19 | 2 | 1 | buy | BID | 500 | 10 | 1092 | lpprov2 | ETH/DEC19 | 2 | 1 | sell | ASK | 500 | 10 | 1093 1094 ## Place orders on one of the successor markets 1095 And the parties place the following orders: 1096 | party | market id | side | volume | price | resulting trades | type | tif | 1097 | trader1 | ETH/DEC23 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 1098 | trader1 | ETH/DEC23 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 1099 | trader1 | ETH/DEC23 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1100 | trader2 | ETH/DEC23 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1101 | lpprov1 | ETH/DEC23 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 1102 | lpprov1 | ETH/DEC23 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 1103 | trader1 | ETH/DEC22 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 1104 | trader1 | ETH/DEC22 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1105 | lpprov1 | ETH/DEC22 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 1106 | lpprov1 | ETH/DEC22 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 1107 | trader1 | ETH/DEC21 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 1108 | trader1 | ETH/DEC21 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1109 | lpprov1 | ETH/DEC21 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 1110 1111 And the network moves ahead "1" blocks 1112 1113 ## Successor window did not pass, mark price 0, ETH/DEC23 in opening auction yet 1114 Then the mark price should be "0" for the market "ETH/DEC23" 1115 Then the mark price should be "0" for the market "ETH/DEC22" 1116 Then the mark price should be "0" for the market "ETH/DEC21" 1117 1118 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC19" 1119 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC20" 1120 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC21" 1121 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC22" 1122 And the trading mode should be "TRADING_MODE_OPENING_AUCTION" for the market "ETH/DEC23" 1123 1124 And the network moves ahead "10" blocks 1125 Then the mark price should be "0" for the market "ETH/DEC23" 1126 Then the mark price should be "0" for the market "ETH/DEC22" 1127 Then the mark price should be "0" for the market "ETH/DEC21" 1128 1129 And the network moves ahead "2" blocks 1130 1131 Then the mark price should be "150" for the market "ETH/DEC23" 1132 Then the mark price should be "0" for the market "ETH/DEC19" 1133 1134 And the parties place the following orders: 1135 | party | market id | side | volume | price | resulting trades | type | tif | 1136 | trader1 | ETH/DEC19 | buy | 10 | 1 | 0 | TYPE_LIMIT | TIF_GTC | 1137 | trader1 | ETH/DEC19 | sell | 10 | 2000 | 0 | TYPE_LIMIT | TIF_GTC | 1138 | trader1 | ETH/DEC19 | buy | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1139 | trader2 | ETH/DEC19 | sell | 1 | 150 | 0 | TYPE_LIMIT | TIF_GTC | 1140 | lpprov2 | ETH/DEC19 | buy | 225 | 40 | 0 | TYPE_LIMIT | TIF_GTC | 1141 | lpprov2 | ETH/DEC19 | sell | 36 | 250 | 0 | TYPE_LIMIT | TIF_GTC | 1142 1143 And the network moves ahead "2" blocks 1144 1145 Then the mark price should be "150" for the market "ETH/DEC23" 1146 Then the mark price should be "150" for the market "ETH/DEC19" 1147 1148 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC23" 1149 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 1150 1151 And the network moves ahead "10" blocks 1152 1153 ## Remaining successor markets moved into the global insurance account 1154 And the insurance pool balance should be "500" for the market "ETH/DEC19" 1155 And the insurance pool balance should be "0" for the market "ETH/DEC20" 1156 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1157 And the insurance pool balance should be "0" for the market "ETH/DEC22" 1158 And the insurance pool balance should be "1500" for the market "ETH/DEC23" 1159 And the global insurance pool balance should be "3000" for the asset "USD" 1160 1161 ## Settle ETH/DEC23 1162 Then the oracles broadcast data signed with "0xCAFECADD": 1163 | name | value | 1164 | trading.terminated | true | 1165 1166 And the network moves ahead "1" blocks 1167 1168 When the oracles broadcast data signed with "0xCAFECADD": 1169 | name | value | 1170 | prices.ETH.value | 14000000 | 1171 1172 And the trading mode should be "TRADING_MODE_NO_TRADING" for the market "ETH/DEC23" 1173 1174 And the network moves ahead "10" blocks 1175 1176 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC19" 1177 1178 ## Settled successor distributed its insurance pool balance across in 2 equal parts. 1179 And the insurance pool balance should be "500" for the market "ETH/DEC19" 1180 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1181 And the insurance pool balance should be "0" for the market "ETH/DEC20" 1182 And the insurance pool balance should be "0" for the market "ETH/DEC22" 1183 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1184 1185 ## Cancel the parent 1186 When the market states are updated through governance: 1187 | market id | state | settlement price | 1188 | ETH/DEC19 | MARKET_STATE_UPDATE_TYPE_TERMINATE | 150 | 1189 1190 And the network moves ahead "2" blocks 1191 1192 And the insurance pool balance should be "0" for the market "ETH/DEC19" 1193 And the insurance pool balance should be "0" for the market "ETH/DEC21" 1194 And the insurance pool balance should be "0" for the market "ETH/DEC20" 1195 And the insurance pool balance should be "0" for the market "ETH/DEC22" 1196 And the insurance pool balance should be "0" for the market "ETH/DEC23" 1197 1198 And the global insurance pool balance should be "5000" for the asset "USD"