code.vegaprotocol.io/vega@v0.79.0/core/integration/features/pap/0097-PAPU-034.feature (about) 1 Feature: Given an auction trigger occurs, if the price oracle has reported a valid price but the value is stale, then the auction is skipped. (0097-PAPU-034). 2 Background: 3 Given the log normal risk model named "log-normal-risk-model": 4 | risk aversion | tau | mu | r | sigma | 5 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 6 And the following network parameters are set: 7 | name | value | 8 | market.value.windowLength | 60s | 9 | network.markPriceUpdateMaximumFrequency | 0s | 10 | limits.markets.maxPeggedOrders | 6 | 11 | market.auction.minimumDuration | 1 | 12 | market.fee.factors.infrastructureFee | 0.001 | 13 | market.fee.factors.makerFee | 0.004 | 14 | spam.protection.max.stopOrdersPerMarket | 5 | 15 | validators.epoch.length | 60m | 16 And the liquidity monitoring parameters: 17 | name | triggering ratio | time window | scaling factor | 18 | lqm-params | 1.0 | 20s | 1 | 19 And the fees configuration named "fees-config-1": 20 | maker fee | infrastructure fee | 21 | 0.0004 | 0.001 | 22 And the price monitoring named "price-monitoring": 23 | horizon | probability | auction extension | 24 | 3600 | 0.99 | 30 | 25 And the liquidity sla params named "SLA-22": 26 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 27 | 0.5 | 0.6 | 1 | 1.0 | 28 And the following network parameters are set: 29 | name | value | 30 | limits.markets.maxPeggedOrders | 2 | 31 And the following assets are registered: 32 | id | decimal places | 33 | ETH | 0 | 34 35 And the spot markets: 36 | id | name | base asset | quote asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | 37 | BTC/ETH | BTC/ETH | BTC | ETH | lqm-params | log-normal-risk-model | 2 | fees-config-1 | price-monitoring | SLA-22 | 38 39 Given the parties deposit on asset's general account the following amount: 40 | party | asset | amount | 41 | party1 | ETH | 1000000000 | 42 | party2 | ETH | 1000000000 | 43 | party3 | ETH | 1000000000 | 44 | party1 | BTC | 1000000000 | 45 | party3 | BTC | 1000000000 | 46 | lpprov | ETH | 1000000000 | 47 | lpprov | BTC | 1000000000 | 48 49 When the parties submit the following liquidity provision: 50 | id | party | market id | commitment amount | fee | lp type | 51 | lp1 | lpprov | BTC/ETH | 937000 | 0.1 | submission | 52 | lp1 | lpprov | BTC/ETH | 937000 | 0.1 | 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 | lpprov | BTC/ETH | 2 | 1 | buy | MID | 50 | 100 | 56 | lpprov | BTC/ETH | 2 | 1 | sell | MID | 50 | 100 | 57 58 # place orders and generate trades - slippage 100 59 And the parties place the following orders: 60 | party | market id | side | volume | price | resulting trades | type | tif | reference | 61 | party2 | BTC/ETH | buy | 1 | 950000 | 0 | TYPE_LIMIT | TIF_GTC | t2-b-1 | 62 | party1 | BTC/ETH | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 | 63 | party3 | BTC/ETH | sell | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 64 65 When the opening auction period ends for market "BTC/ETH" 66 67 And the following trades should be executed: 68 | buyer | price | size | seller | 69 | party1 | 1000000 | 1 | party3 | 70 And the mark price should be "1000000" for the market "BTC/ETH" 71 72 And the composite price oracles from "0xCAFECAFE2": 73 | name | price property | price type | price decimals | 74 | price_oracle | prices.ETH.value | TYPE_INTEGER | 0 | 75 76 And the time triggers oracle spec is: 77 | name | initial | every | 78 | auction_schedule | 1727136005 | 30 | 79 | auction_vol_snap_schedule | 1727136000 | 30 | 80 81 And the average block duration is "1" 82 83 And the parties deposit on asset's general account the following amount: 84 | party | asset | amount | 85 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | BTC | 50000 | 86 Given time is updated to "2024-09-24T00:00:00Z" 87 And the parties submit the following one off transfers: 88 | id | from | from_account_type | to | to_account_type | asset | amount | delivery_time | 89 | 1 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_BUY_BACK_FEES | BTC | 5000 | 2024-09-23T00:00:00Z | 90 91 And the buy back fees balance should be "5000" for the asset "BTC" 92 93 Scenario: The oracle price is valid for 3 seconds and is stale when the auction kicks in therefore an auction doesn't start (0097-PAPU-034). 94 When the protocol automated purchase is defined as: 95 | id | from | from account type | to account type | market id | price oracle | price oracle staleness tolerance | oracle offset factor | auction schedule oracle | auction volume snapshot schedule oracle | auction duration | minimum auction size | maximum auction size | expiry timestamp | 96 | 12345 | BTC | ACCOUNT_TYPE_BUY_BACK_FEES | ACCOUNT_TYPE_NETWORK_TREASURY | BTC/ETH | price_oracle | 3s | 1.01 | auction_schedule | auction_vol_snap_schedule | 60s | 100 | 200 | 0 | 97 98 # now tick a valid price at t0 99 Then the oracles broadcast data with block time signed with "0xCAFECAFE2": 100 | name | value | time offset | 101 | prices.ETH.value | 1000000 | -1s | 102 103 # the auction should kick in at t0+5s at which point the price is stale 104 And the network moves ahead "5" blocks 105 106 # we do not enter a pap auction 107 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 108 109 # we're now at t0+34, lets tick the oracle price again so that it is valid for the next pap auction round 110 Then the oracles broadcast data with block time signed with "0xCAFECAFE2": 111 | name | value | time offset | 112 | prices.ETH.value | 1000000 | -1s | 113 114 And the network moves ahead "10" blocks 115 # we now have entered a pap auction 116 And the trading mode should be "TRADING_MODE_PROTOCOL_AUTOMATED_PURCHASE_AUCTION" for the market "BTC/ETH" 117