code.vegaprotocol.io/vega@v0.79.0/core/integration/features/capped-futures/0016-PFUT-020.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 oracle spec for settlement data filtering data from "0xCAFECAFE2" named "ethDec22Oracle":
    18        | property         | type         | binding         |
    19        | prices.ETH.value | TYPE_INTEGER | settlement data |
    20  
    21      And the oracle spec for trading termination filtering data from "0xCAFECAFE2" named "ethDec22Oracle":
    22        | property           | type         | binding             |
    23        | trading.terminated | TYPE_BOOLEAN | trading termination |
    24  
    25      And the settlement data decimals for the oracle named "ethDec21Oracle" is given in "0" decimal places
    26  
    27      And the oracle spec for settlement data filtering data from "0xCAFECAFE3" named "ethDec23Oracle":
    28        | property         | type         | binding         |
    29        | prices.ETH.value | TYPE_INTEGER | settlement data |
    30  
    31      And the oracle spec for trading termination filtering data from "0xCAFECAFE3" named "ethDec23Oracle":
    32        | property           | type         | binding             |
    33        | trading.terminated | TYPE_BOOLEAN | trading termination |
    34  
    35      And the settlement data decimals for the oracle named "ethDec21Oracle" is given in "0" decimal places
    36  
    37      And the following network parameters are set:
    38        | name                                         | value |
    39        | market.auction.minimumDuration               | 1     |
    40        | network.markPriceUpdateMaximumFrequency      | 0s    |
    41        | market.liquidity.successorLaunchWindowLength | 1s    |
    42        | limits.markets.maxPeggedOrders               | 4     |
    43  
    44      And the fees configuration named "fees-config-1":
    45        | maker fee | infrastructure fee |
    46        | 0.005     | 0.02               |
    47      And the price monitoring named "price-monitoring-1":
    48        | horizon | probability | auction extension |
    49        | 1       | 0.99        | 300               |
    50      And the simple risk model named "simple-risk-model-1":
    51        | long | short | max move up | min move down | probability of trading |
    52        | 0.2  | 0.1   | 100         | -100          | 0.1                    |
    53  
    54      And the markets:
    55        | 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 |
    56        | 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                | true   |
    57        | ETH/DEC22 | ETH        | ETH   | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | ethDec22Oracle     | 0.25                   | 0                         | default-futures | 1500          | false                | true   |
    58        | ETH/DEC23 | ETH        | ETH   | simple-risk-model-1 | default-margin-calculator | 1                | fees-config-1 | price-monitoring-1 | ethDec23Oracle     | 0.25                   | 0                         | default-futures | 1500          | false                | true   |
    59  
    60    @SLABug @NoPerp @Capped
    61    Scenario: 0016-PFUT-020: When `max_price` is specified, the `binary_settlement` flag is set to `true` and the final settlement price candidate received from the oracle is greater than `0` and less than  `max_price` the value gets ignored, next a value of `0` comes in from the settlement oracle and market settles correctly.
    62      Given the initial insurance pool balance is "10000" for all the markets
    63      And the parties deposit on asset's general account the following amount:
    64        | party    | asset | amount    |
    65        | party1   | ETH   | 10000     |
    66        | party2   | ETH   | 1000      |
    67        | party3   | ETH   | 5000      |
    68        | aux1     | ETH   | 100000    |
    69        | aux2     | ETH   | 100000    |
    70        | party-lp | ETH   | 100000000 |
    71  
    72      And the parties submit the following liquidity provision:
    73        | id  | party    | market id | commitment amount | fee | lp type    |
    74        | lp1 | party-lp | ETH/DEC21 | 300000            | 0   | submission |
    75        | lp2 | party-lp | ETH/DEC22 | 300000            | 0   | submission |
    76        | lp3 | party-lp | ETH/DEC23 | 300000            | 0   | submission |
    77      And the parties place the following pegged iceberg orders:
    78        | party    | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    79        | party-lp | ETH/DEC21 | 6000      | 3000                 | buy  | BID              | 18000  | 10     |
    80        | party-lp | ETH/DEC21 | 6000      | 3000                 | sell | ASK              | 18000  | 10     |
    81        | party-lp | ETH/DEC22 | 6000      | 3000                 | buy  | BID              | 18000  | 10     |
    82        | party-lp | ETH/DEC22 | 6000      | 3000                 | sell | ASK              | 18000  | 10     |
    83        | party-lp | ETH/DEC23 | 6000      | 3000                 | buy  | BID              | 18000  | 10     |
    84        | party-lp | ETH/DEC23 | 6000      | 3000                 | sell | ASK              | 18000  | 10     |
    85  
    86      When the parties place the following orders:
    87        | party | market id | side | volume | price | resulting trades | type       | tif     | reference |
    88        | aux1  | ETH/DEC21 | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    89        | aux2  | ETH/DEC21 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    90        | aux1  | ETH/DEC21 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    91        | aux2  | ETH/DEC21 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-8     |
    92        | aux1  | ETH/DEC22 | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    93        | aux2  | ETH/DEC22 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    94        | aux1  | ETH/DEC22 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    95        | aux2  | ETH/DEC22 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-8     |
    96        | aux1  | ETH/DEC23 | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    97        | aux2  | ETH/DEC23 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    98        | aux1  | ETH/DEC23 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    99        | aux2  | ETH/DEC23 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-8     |
   100      And the network moves ahead "2" blocks
   101  
   102      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21"
   103      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC22"
   104      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC23"
   105      And the market state should be "STATE_ACTIVE" for the market "ETH/DEC21"
   106      And the market state should be "STATE_ACTIVE" for the market "ETH/DEC22"
   107      And the market state should be "STATE_ACTIVE" for the market "ETH/DEC23"
   108  
   109      Then the network moves ahead "2" blocks
   110  
   111      # 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
   112      And the oracles broadcast data signed with "0xCAFECAFE1":
   113        | name               | value |
   114        | trading.terminated | true  |
   115      And the oracles broadcast data signed with "0xCAFECAFE2":
   116        | name               | value |
   117        | trading.terminated | true  |
   118      And the oracles broadcast data signed with "0xCAFECAFE3":
   119        | name               | value |
   120        | trading.terminated | true  |
   121      And the network moves ahead "2" blocks
   122  
   123      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
   124      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC22"
   125      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC23"
   126  
   127      When the oracles broadcast data signed with "0xCAFECAFE1":
   128        | name             | value |
   129        | prices.ETH.value | 0     |
   130      When the oracles broadcast data signed with "0xCAFECAFE2":
   131        | name             | value |
   132        | prices.ETH.value | 100   |
   133      When the oracles broadcast data signed with "0xCAFECAFE3":
   134        | name             | value |
   135        | prices.ETH.value | 1500  |
   136  
   137      And the network moves ahead "2" blocks
   138    
   139      Then the last market state should be "STATE_SETTLED" for the market "ETH/DEC21"
   140      Then the last market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC22"
   141      Then the last market state should be "STATE_SETTLED" for the market "ETH/DEC23"
   142