code.vegaprotocol.io/vega@v0.79.0/core/integration/features/pap/0097-PAPU-022.feature (about) 1 Feature: Given the program currently has earmarked funds for an auction but is not yet in the auction, if a program's expiry timestamp is reached, the program will be cancelled, the earmarked funds released and no further auctions will take place. (0097-PAPU-022). 2 Background: 3 Given time is updated to "2024-09-24T00:00:00Z" 4 And the average block duration is "2" 5 Given the log normal risk model named "log-normal-risk-model": 6 | risk aversion | tau | mu | r | sigma | 7 | 0.000001 | 0.1 | 0 | 0 | 1.0 | 8 And the following network parameters are set: 9 | name | value | 10 | market.value.windowLength | 60s | 11 | network.markPriceUpdateMaximumFrequency | 0s | 12 | limits.markets.maxPeggedOrders | 6 | 13 | market.auction.minimumDuration | 1 | 14 | market.fee.factors.infrastructureFee | 0.001 | 15 | market.fee.factors.makerFee | 0.004 | 16 | spam.protection.max.stopOrdersPerMarket | 5 | 17 | validators.epoch.length | 60m | 18 And the liquidity monitoring parameters: 19 | name | triggering ratio | time window | scaling factor | 20 | lqm-params | 1.0 | 20s | 1 | 21 And the fees configuration named "fees-config-1": 22 | maker fee | infrastructure fee | 23 | 0.0004 | 0.001 | 24 And the price monitoring named "price-monitoring": 25 | horizon | probability | auction extension | 26 | 3600 | 0.99 | 30 | 27 And the liquidity sla params named "SLA-22": 28 | price range | commitment min time fraction | performance hysteresis epochs | sla competition factor | 29 | 0.5 | 0.6 | 1 | 1.0 | 30 And the following network parameters are set: 31 | name | value | 32 | limits.markets.maxPeggedOrders | 2 | 33 And the following assets are registered: 34 | id | decimal places | 35 | ETH | 0 | 36 37 And the spot markets: 38 | id | name | base asset | quote asset | liquidity monitoring | risk model | auction duration | fees | price monitoring | sla params | 39 | BTC/ETH | BTC/ETH | BTC | ETH | lqm-params | log-normal-risk-model | 2 | fees-config-1 | price-monitoring | SLA-22 | 40 41 Given the parties deposit on asset's general account the following amount: 42 | party | asset | amount | 43 | party1 | ETH | 1000000000 | 44 | party2 | ETH | 1000000000 | 45 | party3 | ETH | 1000000000 | 46 | party1 | BTC | 1000000000 | 47 | party3 | BTC | 1000000000 | 48 | lpprov | ETH | 1000000000 | 49 | lpprov | BTC | 1000000000 | 50 51 When the parties submit the following liquidity provision: 52 | id | party | market id | commitment amount | fee | lp type | 53 | lp1 | lpprov | BTC/ETH | 937000 | 0.1 | submission | 54 | lp1 | lpprov | BTC/ETH | 937000 | 0.1 | 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 | lpprov | BTC/ETH | 2 | 1 | buy | MID | 50 | 100 | 58 | lpprov | BTC/ETH | 2 | 1 | sell | MID | 50 | 100 | 59 60 # place orders and generate trades - slippage 100 61 And the parties place the following orders: 62 | party | market id | side | volume | price | resulting trades | type | tif | reference | 63 | party2 | BTC/ETH | buy | 1 | 950000 | 0 | TYPE_LIMIT | TIF_GTC | t2-b-1 | 64 | party1 | BTC/ETH | buy | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GFA | t1-b-1 | 65 | party3 | BTC/ETH | sell | 1 | 1000000 | 0 | TYPE_LIMIT | TIF_GTC | t2-s-1 | 66 67 When the opening auction period ends for market "BTC/ETH" 68 69 And the following trades should be executed: 70 | buyer | price | size | seller | 71 | party1 | 1000000 | 1 | party3 | 72 And the mark price should be "1000000" for the market "BTC/ETH" 73 74 And the composite price oracles from "0xCAFECAFE2": 75 | name | price property | price type | price decimals | 76 | price_oracle | prices.ETH.value | TYPE_INTEGER | 0 | 77 78 And the time triggers oracle spec is: 79 | name | initial | every | 80 | auction_schedule | 1727136030 | 30 | 81 | auction_vol_snap_schedule | 1727136000 | 30 | 82 83 And the parties deposit on asset's general account the following amount: 84 | party | asset | amount | 85 | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | BTC | 50000 | 86 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: pap expires (0097-PAPU-022) 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 | 10s | 1.01 | auction_schedule | auction_vol_snap_schedule | 60s | 100 | 200 | 1727136050 | 97 98 Then the oracles broadcast data with block time signed with "0xCAFECAFE2": 99 | name | value | time offset | 100 | prices.ETH.value | 1000000 | -1s | 101 102 # volume snapshot is taken 103 And the network moves ahead "16" blocks 104 Then the automated purchase program for market "BTC/ETH" should have a snapshot balance of "200" 105 106 # the auction trigger is ticked after the expiration 107 And the network moves ahead "16" blocks 108 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/ETH" 109 110 # the program is cancelled, funds are unearmarked and the balance remained fully in the source account 111 And the buy back fees balance should be "5000" for the asset "BTC" 112 And the active pap id should be "none" for the market "BTC/ETH" 113 And the active pap order id should be "none" for the market "BTC/ETH"