code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/rewards-over-window.feature (about) 1 Feature: Maker fees paid reward metric calculated correctly for time window 2 3 # Test checks bug where previous maker fees received were being stored in place of 4 # maker fees paid in the market activity tracker. 5 6 Background: 7 8 # Initialise the network 9 Given time is updated to "2023-01-01T00:00:00Z" 10 And the average block duration is "1" 11 And the following network parameters are set: 12 | name | value | 13 | market.fee.factors.makerFee | 0.001 | 14 | network.markPriceUpdateMaximumFrequency | 0s | 15 | market.auction.minimumDuration | 1 | 16 | validators.epoch.length | 60s | 17 | limits.markets.maxPeggedOrders | 4 | 18 | referralProgram.minStakedVegaTokens | 0 | 19 20 # Initialise the markets 21 And the following assets are registered: 22 | id | decimal places | quantum | 23 | USD-1-10 | 1 | 10 | 24 And the markets: 25 | id | quote name | asset | risk model | margin calculator | auction duration | fees | price monitoring | data source config | linear slippage factor | quadratic slippage factor | sla params | decimal places | position decimal places | 26 | ETH/USD-1-10 | ETH | USD-1-10 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 27 28 # Initialise the parties 29 Given the parties deposit on asset's general account the following amount: 30 | party | asset | amount | 31 | lpprov | USD-1-10 | 10000000000 | 32 | aux1 | USD-1-10 | 10000000 | 33 | aux2 | USD-1-10 | 10000000 | 34 | referrer1 | USD-1-10 | 10000000 | 35 | referee1 | USD-1-10 | 10000000 | 36 | referee2 | USD-1-10 | 10000000 | 37 | referee3 | USD-1-10 | 10000000 | 38 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-1-10 | 10000000 | 39 40 # Exit opening auctions 41 Given the parties submit the following liquidity provision: 42 | id | party | market id | commitment amount | fee | lp type | 43 | lp1 | lpprov | ETH/USD-1-10 | 1000000 | 0.01 | submission | 44 And the parties place the following pegged iceberg orders: 45 | party | market id | peak size | minimum visible size | side | pegged reference | volume | offset | 46 | lpprov | ETH/USD-1-10 | 5000 | 1000 | buy | BID | 10000 | 1 | 47 | lpprov | ETH/USD-1-10 | 5000 | 1000 | sell | ASK | 10000 | 1 | 48 When the parties place the following orders: 49 | party | market id | side | volume | price | resulting trades | type | tif | 50 | aux1 | ETH/USD-1-10 | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 51 | aux1 | ETH/USD-1-10 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 52 | aux1 | ETH/USD-1-10 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 53 | aux2 | ETH/USD-1-10 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 54 And the opening auction period ends for market "ETH/USD-1-10" 55 When the network moves ahead "1" blocks 56 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD-1-10" 57 58 # Create the teams 59 Given the parties create the following referral codes: 60 | party | code | is_team | team | 61 | referrer1 | referral-code-1 | true | team1 | 62 | referrer2 | referral-code-2 | true | team2 | 63 And the parties apply the following referral codes: 64 | party | code | is_team | team | 65 | referee1 | referral-code-1 | true | team1 | 66 | referee2 | referral-code-2 | true | team2 | 67 | referee3 | referral-code-2 | true | team2 | 68 And the team "team1" has the following members: 69 | party | 70 | referrer1 | 71 | referee1 | 72 And the team "team2" has the following members: 73 | party | 74 | referrer2 | 75 | referee2 | 76 | referee3 | 77 78 79 Scenario: Party funds pool with recurring transfer scoping individuals 80 81 Given the parties submit the following recurring transfers: 82 | id | from | from_account_type | to | to_account_type | entity_scope | teams | ntop | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | window_length | 83 | 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | | 1 | USD-1-10 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10 | ETH/USD-1-10 | 2 | 84 And the parties place the following orders: 85 | party | market id | side | volume | price | resulting trades | type | tif | 86 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 87 | referee1 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 88 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 89 | referee2 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 90 | referrer1 | ETH/USD-1-10 | sell | 5 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 91 | referee3 | ETH/USD-1-10 | buy | 5 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 92 When the network moves ahead "1" epochs 93 94 Then "referee1" should have vesting account balance of "4000" for asset "USD-1-10" 95 And "referee2" should have vesting account balance of "4000" for asset "USD-1-10" 96 And "referee3" should have vesting account balance of "2000" for asset "USD-1-10" 97 98 99 Scenario: Party funds pool with recurring transfer scoping individuals with transfer interval 5 100 101 Given the parties submit the following recurring transfers: 102 | id | from | from_account_type | to | to_account_type | entity_scope | teams | ntop | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | window_length | transfer_interval | 103 | 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | | 1 | USD-1-10 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10 | ETH/USD-1-10 | 5 | 5 | 104 And the parties place the following orders: 105 | party | market id | side | volume | price | resulting trades | type | tif | 106 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 107 | referee1 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 108 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 109 | referee2 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 110 | referrer1 | ETH/USD-1-10 | sell | 5 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 111 | referee3 | ETH/USD-1-10 | buy | 5 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 112 113 When the network moves ahead "5" epochs 114 Then "referee1" should have vesting account balance of "4000" for asset "USD-1-10" 115 And "referee2" should have vesting account balance of "4000" for asset "USD-1-10" 116 And "referee3" should have vesting account balance of "2000" for asset "USD-1-10" 117 118 And the parties place the following orders: 119 | party | market id | side | volume | price | resulting trades | type | tif | 120 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 121 | referee1 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 122 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 123 | referee2 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 124 | referrer1 | ETH/USD-1-10 | sell | 5 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 125 | referee3 | ETH/USD-1-10 | buy | 5 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 126 127 When the network moves ahead "5" epochs 128 Then "referee1" should have vesting account balance of "8000" for asset "USD-1-10" 129 And "referee2" should have vesting account balance of "8000" for asset "USD-1-10" 130 And "referee3" should have vesting account balance of "4000" for asset "USD-1-10" 131 132 133 Scenario: Party funds pool with recurring transfer scoping teams 134 135 Given the parties submit the following recurring transfers: 136 | id | from | from_account_type | to | to_account_type | entity_scope | teams | ntop | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | window_length | 137 | 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS | | 1 | USD-1-10 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10 | ETH/USD-1-10 | 2 | 138 And the parties place the following orders: 139 | party | market id | side | volume | price | resulting trades | type | tif | 140 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 141 | referee1 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 142 | referrer1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 143 | referee2 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 144 | referrer1 | ETH/USD-1-10 | sell | 5 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 145 | referee3 | ETH/USD-1-10 | buy | 5 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 146 When the network moves ahead "1" epochs 147 148 # NB: the change here is because before we were returning the score for fees paid for 0 so when choosing the top n members we'd be looking at the top 2 scores out of the 3 149 # so team2 would get a score of 0.6, now they get 0.3, and team1 gets 0.4 so team1 gets 0.4/0.7 and team2 gets 0.3/0.7 150 Then "referee1" should have vesting account balance of "5714" for asset "USD-1-10" 151 And "referee2" should have vesting account balance of "2142" for asset "USD-1-10" 152 And "referee3" should have vesting account balance of "2142" for asset "USD-1-10"