code.vegaprotocol.io/vega@v0.79.0/core/integration/features/successor-markets-expiration.feature (about) 1 Feature: Simple example of successor markets 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 | 18 | 8 | USD | 0 | 9 10 # Create some oracles 11 ## oracle for parent 12 And the oracle spec for settlement data filtering data from "0xCAFECAFE1" named "ethDec19Oracle": 13 | property | type | binding | 14 | prices.ETH.value | TYPE_INTEGER | settlement data | 15 And the oracle spec for trading termination filtering data from "0xCAFECAFE1" named "ethDec19Oracle": 16 | property | type | binding | 17 | trading.terminated | TYPE_BOOLEAN | trading termination | 18 And the settlement data decimals for the oracle named "ethDec19Oracle" is given in "5" decimal places 19 ## oracle for a successor 20 And the oracle spec for settlement data filtering data from "0xCAFECAFE" named "ethDec20Oracle": 21 | property | type | binding | 22 | prices.ETH.value | TYPE_INTEGER | settlement data | 23 And the oracle spec for trading termination filtering data from "0xCAFECAFE" named "ethDec20Oracle": 24 | property | type | binding | 25 | trading.terminated | TYPE_BOOLEAN | trading termination | 26 And the settlement data decimals for the oracle named "ethDec20Oracle" is given in "5" decimal places 27 And the liquidity monitoring parameters: 28 | name | triggering ratio | time window | scaling factor | 29 | lqm-params | 0.01 | 10s | 5 | 30 31 And the following network parameters are set: 32 | name | value | 33 | network.markPriceUpdateMaximumFrequency | 0s | 34 | market.auction.minimumDuration | 1 | 35 | market.fee.factors.infrastructureFee | 0.001 | 36 | market.fee.factors.makerFee | 0.004 | 37 | market.value.windowLength | 60s | 38 | market.liquidity.bondPenaltyParameter | 0.1 | 39 | validators.epoch.length | 5s | 40 | market.liquidity.stakeToCcyVolume | 0.2 | 41 | market.liquidity.successorLaunchWindowLength | 8s | 42 And the average block duration is "1" 43 44 45 # All parties have 1,000,000.000,000,000,000,000,000 46 # Add as many parties as needed here 47 And the parties deposit on asset's general account the following amount: 48 | party | asset | amount | 49 | lpprov | ETH | 10000000000000000000000000 | 50 | trader1 | ETH | 10000000000000000000000000 | 51 | trader2 | ETH | 10000000000000000000000000 | 52 | trader3 | ETH | 10000000000000000000000000 | 53 | trader4 | ETH | 10000000000000000000000000 | 54 | trader5 | ETH | 10000000000000000000000000 | 55 56 @SuccessorMarketExpires 57 Scenario: 0081-SUCM-035 Enact a successor market once the parent market is settled, and the succession window has expired 58 Given the markets: 59 | 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 | 60 | ETH/DEC19 | ETH | ETH | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | ethDec19Oracle | 0.1 | 0 | 5 | 5 | | | | default-futures | 61 | ETH/DEC20 | ETH | ETH | lqm-params | default-st-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 0.1 | 0 | 5 | 5 | ETH/DEC19 | 1 | 10 | default-futures | 62 Given the initial insurance pool balance is "1000" for all the markets 63 And the parties submit the following liquidity provision: 64 | id | party | market id | commitment amount | fee | lp type | 65 | lp1 | lpprov | ETH/DEC19 | 3905000000000000 | 0.3 | submission | 66 | lp1 | lpprov | ETH/DEC19 | 3905000000000000 | 0.3 | submission | 67 And the parties place the following orders: 68 | party | market id | side | volume | price | resulting trades | type | tif | reference | 69 | trader1 | ETH/DEC19 | buy | 5 | 1001 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-1 | 70 | trader1 | ETH/DEC19 | buy | 5 | 900 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-2 | 71 | trader1 | ETH/DEC19 | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-3 | 72 | trader2 | ETH/DEC19 | sell | 5 | 1200 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 73 | trader2 | ETH/DEC19 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-2 | 74 | trader2 | ETH/DEC19 | sell | 5 | 951 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-3 | 75 When the opening auction period ends for market "ETH/DEC19" 76 Then the market data for the market "ETH/DEC19" should be: 77 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 78 | 976 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 134907600000 | 3905000000000000 | 5 | 79 And the parties should have the following account balances: 80 | party | asset | market id | margin | general | 81 | trader1 | ETH | ETH/DEC19 | 126362285504 | 9999999999999873637714496 | 82 And the parties should have the following margin levels: 83 | party | market id | maintenance | 84 | trader1 | ETH/DEC19 | 105301904587 | 85 And the liquidity provider fee shares for the market "ETH/DEC19" should be: 86 | party | equity like share | average entry valuation | 87 | lpprov | 1 | 3905000000000000 | 88 # provide liquidity for successor market 89 When the oracles broadcast data signed with "0xCAFECAFE1": 90 | name | value | 91 | trading.terminated | true | 92 | prices.ETH.value | 975 | 93 Then the market state should be "STATE_SETTLED" for the market "ETH/DEC19" 94 95 # enactment timestamp 96 When the successor market "ETH/DEC20" is enacted 97 Then the market data for the market "ETH/DEC20" should be: 98 | trading mode | 99 | TRADING_MODE_OPENING_AUCTION | 100 And the last market state should be "STATE_SETTLED" for the market "ETH/DEC19" 101 And the last market state should be "STATE_PENDING" for the market "ETH/DEC20" 102 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 103 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 104 And the global insurance pool balance should be "0" for the asset "ETH" 105 106 #now ensure the succession time window has elapsed 107 When the network moves ahead "8" blocks 108 And the last market state should be "STATE_SETTLED" for the market "ETH/DEC19" 109 And the last market state should be "STATE_PENDING" for the market "ETH/DEC20" 110 And the insurance pool balance should be "1000" for the market "ETH/DEC19" 111 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 112 And the global insurance pool balance should be "0" for the asset "ETH" 113 114 When the network moves ahead "5" blocks 115 And the last market state should be "STATE_SETTLED" for the market "ETH/DEC19" 116 And the last market state should be "STATE_PENDING" for the market "ETH/DEC20" 117 And the insurance pool balance should be "0" for the market "ETH/DEC19" 118 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 119 And the global insurance pool balance should be "1000" for the asset "ETH" 120 121 And the parties submit the following liquidity provision: 122 | id | party | market id | commitment amount | fee | lp type | 123 | lp1 | lpprov | ETH/DEC20 | 1905000000000000 | 0.1 | submission | 124 | lp1 | lpprov | ETH/DEC20 | 1905000000000000 | 0.1 | submission | 125 126 # successor market should still be in opening auction, no insurance pool balance is transferred 127 When the parties place the following orders: 128 | party | market id | side | volume | price | resulting trades | type | tif | reference | 129 | trader1 | ETH/DEC20 | buy | 5 | 1001 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-1 | 130 | trader1 | ETH/DEC20 | buy | 5 | 900 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-2 | 131 | trader1 | ETH/DEC20 | buy | 1 | 100 | 0 | TYPE_LIMIT | TIF_GTC | t1-b-3 | 132 | trader2 | ETH/DEC20 | sell | 5 | 1200 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 133 | trader2 | ETH/DEC20 | sell | 1 | 100000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-2 | 134 | trader2 | ETH/DEC20 | sell | 5 | 951 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-3 | 135 When the opening auction period ends for market "ETH/DEC20" 136 Then the market data for the market "ETH/DEC20" should be: 137 | mark price | trading mode | auction trigger | target stake | supplied stake | open interest | 138 | 976 | TRADING_MODE_CONTINUOUS | AUCTION_TRIGGER_UNSPECIFIED | 134907600000 | 1905000000000000 | 5 | 139 # Average entry valuation, though the stake is less/different is not carried over 140 When the network moves ahead "2" blocks 141 And the liquidity provider fee shares for the market "ETH/DEC20" should be: 142 | party | equity like share | average entry valuation | 143 | lpprov | 1 | 1905000000000000 | 144 145 And the last market state should be "STATE_SETTLED" for the market "ETH/DEC19" 146 And the last market state should be "STATE_ACTIVE" for the market "ETH/DEC20" 147 And the insurance pool balance should be "0" for the market "ETH/DEC19" 148 And the insurance pool balance should be "1000" for the market "ETH/DEC20" 149 And the global insurance pool balance should be "1000" for the asset "ETH"