code.vegaprotocol.io/vega@v0.79.0/core/integration/features/capped-futures/0016-PFUT-018.feature (about)

     1  Feature: Settle capped futures market with a price within correct range
     2  
     3    Background:
     4      Given time is updated to "2019-11-30T00:00:00Z"
     5      And the average block duration is "1"
     6  
     7      And the oracle spec for settlement data filtering data from "0xCAFECAFE1" named "ethDec21Oracle":
     8        | property         | type         | binding         |
     9        | prices.ETH.value | TYPE_INTEGER | settlement data |
    10  
    11      And the oracle spec for trading termination filtering data from "0xCAFECAFE1" named "ethDec21Oracle":
    12        | property           | type         | binding             |
    13        | trading.terminated | TYPE_BOOLEAN | trading termination |
    14  
    15      And the settlement data decimals for the oracle named "ethDec21Oracle" is given in "0" decimal places
    16  
    17      And the following network parameters are set:
    18        | name                                         | value |
    19        | market.auction.minimumDuration               | 1     |
    20        | network.markPriceUpdateMaximumFrequency      | 0s    |
    21        | market.liquidity.successorLaunchWindowLength | 1s    |
    22        | limits.markets.maxPeggedOrders               | 4     |
    23  
    24      And the fees configuration named "fees-config-1":
    25        | maker fee | infrastructure fee |
    26        | 0.005     | 0.02               |
    27      And the price monitoring named "price-monitoring-1":
    28        | horizon | probability | auction extension |
    29        | 1       | 0.99        | 300               |
    30      And the simple risk model named "simple-risk-model-1":
    31        | long | short | max move up | min move down | probability of trading |
    32        | 0.2  | 0.1   | 100         | -100          | 0.1                    |
    33  
    34      And the markets:
    35        | id        | quote name | asset | risk model          | margin calculator         | auction duration | fees          | price monitoring   | data source config | linear slippage factor | quadratic slippage factor | sla params      | max price cap | fully collateralised | binary |
    36        | ETH/DEC21 | ETH        | ETH   | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | ethDec21Oracle     | 0.25                   | 0                         | default-futures | 1500          | false                | false  |
    37      
    38    @SLABug @NoPerp @Capped
    39    Scenario: 0016-PFUT-018: Settlement happened when market is being closed - happens when the oracle price is < max price cap, higher prices are ignored.
    40      Given the initial insurance pool balance is "10000" for all the markets
    41      And the parties deposit on asset's general account the following amount:
    42        | party    | asset | amount    |
    43        | party1   | ETH   | 10000     |
    44        | party2   | ETH   | 1000      |
    45        | party3   | ETH   | 5000      |
    46        | aux1     | ETH   | 100000    |
    47        | aux2     | ETH   | 100000    |
    48        | party-lp | ETH   | 100000000 |
    49  
    50      And the parties submit the following liquidity provision:
    51        | id  | party    | market id | commitment amount | fee | lp type    |
    52        | lp2 | party-lp | ETH/DEC21 | 3000000           | 0   | submission |
    53      And the parties place the following pegged iceberg orders:
    54        | party    | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    55        | party-lp | ETH/DEC21 | 60000     | 30000                | buy  | BID              | 180000 | 10     |
    56        | party-lp | ETH/DEC21 | 60000     | 30000                | sell | ASK              | 180000 | 10     |
    57  
    58      When the parties place the following orders:
    59        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
    60        | aux1  | ETH/DEC21 | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    61        | aux2  | ETH/DEC21 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    62        | aux1  | ETH/DEC21 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    63        | aux2  | ETH/DEC21 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-8     |
    64      And the network moves ahead "2" blocks
    65  
    66      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21"
    67  
    68      And the market state should be "STATE_ACTIVE" for the market "ETH/DEC21"
    69  
    70      Then the network moves ahead "2" blocks
    71  
    72      # The market considered here ("ETH/DEC19") relies on "0xCAFECAFE" oracle, checking that broadcasting events from "0xCAFECAFE1" should have no effect on it apart from insurance pool transfer
    73      And the oracles broadcast data signed with "0xCAFECAFE1":
    74        | name               | value |
    75        | trading.terminated | true  |
    76  
    77      And the network moves ahead "2" blocks
    78  
    79      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
    80  
    81      When the oracles broadcast data signed with "0xCAFECAFE1":
    82        | name             | value |
    83        | prices.ETH.value | 2000  |
    84  
    85      And the network moves ahead "2" blocks
    86      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
    87      # Make sure this does not settle the market
    88      And the last market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
    89  
    90      # within the price range
    91      When the oracles broadcast data signed with "0xCAFECAFE1":
    92        | name             | value |
    93        | prices.ETH.value | 1499  |
    94  
    95      And the network moves ahead "2" blocks
    96      # Now the market shows as settled
    97      Then the last market state should be "STATE_SETTLED" for the market "ETH/DEC21"
    98  
    99