code.vegaprotocol.io/vega@v0.79.0/core/integration/features/capped-futures/0016-PFUT-019.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  
    39    @SLABug @NoPerp @Capped @CIsolated
    40    Scenario: 0016-PFUT-019: When `max_price` is specified and the final settlement price candidate received from the oracle is equal to `max_price` comes and market settles correctly
    41      Given the initial insurance pool balance is "10000" for all the markets
    42      And the parties deposit on asset's general account the following amount:
    43        | party    | asset | amount    |
    44        | party1   | ETH   | 10000     |
    45        | party2   | ETH   | 1000      |
    46        | party3   | ETH   | 5000      |
    47        | party4   | ETH   | 50000     |
    48        | aux1     | ETH   | 100000    |
    49        | aux2     | ETH   | 100000    |
    50        | party-lp | ETH   | 100000000 |
    51  
    52      And the parties submit the following liquidity provision:
    53        | id  | party    | market id | commitment amount | fee | lp type    |
    54        | lp2 | party-lp | ETH/DEC21 | 3000000           | 0   | submission |
    55      And the parties place the following pegged iceberg orders:
    56        | party    | market id | peak size | minimum visible size | side | pegged reference | volume | offset |
    57        | party-lp | ETH/DEC21 | 60000     | 30000                | buy  | BID              | 180000 | 10     |
    58        | party-lp | ETH/DEC21 | 60000     | 30000                | sell | ASK              | 180000 | 10     |
    59  
    60      When the parties place the following orders:
    61        | party  | market id | side | volume | price | resulting trades | type       | tif     | reference |
    62        | aux1   | ETH/DEC21 | buy  | 2      | 999   | 0                | TYPE_LIMIT | TIF_GTC | ref-5     |
    63        | aux2   | ETH/DEC21 | sell | 2      | 1001  | 0                | TYPE_LIMIT | TIF_GTC | ref-6     |
    64        | aux1   | ETH/DEC21 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-7     |
    65        | aux2   | ETH/DEC21 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC | ref-8     |
    66        | party4 | ETH/DEC21 | buy  | 2      | 600   | 0                | TYPE_LIMIT | TIF_GTC | ref-9     |
    67      And the network moves ahead "2" blocks
    68  
    69      Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/DEC21"
    70  
    71      And the parties should have the following account balances:
    72        | party  | asset | market id | margin | general |
    73        | party4 | ETH   | ETH/DEC21 | 480    | 49520   |
    74      And the market state should be "STATE_ACTIVE" for the market "ETH/DEC21"
    75  
    76      When the parties submit update margin mode:
    77        | party  | market    | margin_mode     | margin_factor | error |
    78        | party4 | ETH/DEC21 | isolated margin | 0.5           |       |
    79      Then the parties should have the following account balances:
    80        | party  | asset | market id | margin | general | order margin |
    81        | party4 | ETH   | ETH/DEC21 | 0      | 49400   | 600          |
    82      Then the network moves ahead "2" blocks
    83  
    84      # 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
    85      And the oracles broadcast data signed with "0xCAFECAFE1":
    86        | name               | value |
    87        | trading.terminated | true  |
    88  
    89      And the network moves ahead "2" blocks
    90  
    91      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
    92  
    93      When the oracles broadcast data signed with "0xCAFECAFE1":
    94        | name             | value |
    95        | prices.ETH.value | 2000  |
    96  
    97      And the network moves ahead "2" blocks
    98      Then the market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
    99      # Make sure this does not settle the market
   100      And the last market state should be "STATE_TRADING_TERMINATED" for the market "ETH/DEC21"
   101  
   102      # within the price range
   103      When the oracles broadcast data signed with "0xCAFECAFE1":
   104        | name             | value |
   105        | prices.ETH.value | 1500  |
   106  
   107      And the network moves ahead "2" blocks
   108      # Now the market shows as settled
   109      Then the last market state should be "STATE_SETTLED" for the market "ETH/DEC21"
   110  
   111