code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/reward_cap.feature (about) 1 Feature: Capping distributed rewards at a multiple of fees paid 2 3 Tests checks: 4 - the cap_reward_fee_multiple correctly caps rewards distributed 5 to parties to a multiple of the total fees paid by each respective party. 6 - reallocation of unallocated rewards is attempted upto 10 times. 7 - unallocated rewards are carried over to the next epoch. 8 9 Background: 10 11 # Initialise the network and register the assets 12 Given time is updated to "2023-01-01T00:00:00Z" 13 And the average block duration is "1" 14 And the following network parameters are set: 15 | name | value | 16 | market.fee.factors.makerFee | 0.0005 | 17 | market.fee.factors.infrastructureFee | 0.0015 | 18 And the following assets are registered: 19 | id | decimal places | quantum | 20 | USD-1-10 | 1 | 10 | 21 22 # Initialise the parties and deposit assets 23 Given the parties deposit on asset's general account the following amount: 24 | party | asset | amount | 25 | lp | USD-1-10 | 10000000000 | 26 | aux1 | USD-1-10 | 10000000000 | 27 | aux2 | USD-1-10 | 10000000000 | 28 | party1 | USD-1-10 | 10000000000 | 29 | party2 | USD-1-10 | 10000000000 | 30 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-1-10 | 10000000000 | 31 32 # Setup the market in continuous trading 33 And the markets: 34 | 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 | 35 | 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 | 36 37 Given the parties submit the following liquidity provision: 38 | id | party | market id | commitment amount | fee | lp type | 39 | lp1 | lp | ETH/USD-1-10 | 1000000 | 0.008 | submission | 40 And the parties place the following orders: 41 | party | market id | side | volume | price | resulting trades | type | tif | 42 | aux1 | ETH/USD-1-10 | buy | 1 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 43 | aux1 | ETH/USD-1-10 | buy | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 44 | aux2 | ETH/USD-1-10 | sell | 1 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 45 | aux2 | ETH/USD-1-10 | sell | 1 | 1100 | 0 | TYPE_LIMIT | TIF_GTC | 46 When the opening auction period ends for market "ETH/USD-1-10" 47 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD-1-10" 48 49 50 Scenario Outline: Capping distributed rewards at a multiple of fees paid (0057-TRAN-070)(0057-TRAN-071) 51 52 # Start a new epoch then generate trades 53 Given the network moves ahead "1" epochs 54 And the parties place the following orders: 55 | party | market id | side | volume | price | resulting trades | type | tif | 56 | aux1 | ETH/USD-1-10 | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 57 | party1 | ETH/USD-1-10 | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 58 | aux1 | ETH/USD-1-10 | buy | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 59 | party2 | ETH/USD-1-10 | sell | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 60 When the network moves ahead "1" blocks 61 Then the following trades should be executed: 62 | buyer | price | size | seller | buyer fee | seller fee | 63 | party1 | 1000 | 10 | aux1 | 1000 | 0 | 64 | aux1 | 1000 | 20 | party2 | 0 | 2000 | 65 # Setup a recurring transfer funding a reward pool 66 Given the current epoch is "1" 67 And the parties submit the following recurring transfers: 68 | id | from | from_account_type | to | to_account_type | entity_scope | individual_scope | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | cap_reward_fee_multiple | lock_period | 69 | 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS | ALL | USD-1-10 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10 | ETH/USD-1-10 | <cap_reward_fee_multiple> | 100 | 70 When the network moves ahead "1" epochs 71 Then parties should have the following vesting account balances: 72 | party | asset | balance | 73 | party1 | USD-1-10 | <party1_rewards> | 74 | party2 | USD-1-10 | <party2_rewards> | 75 76 Examples: 77 | cap_reward_fee_multiple | party1_rewards | party2_rewards | 78 | 0.1 | 100 | 200 | 79 | 1 | 1000 | 2000 | 80 | 10 | 3333 | 6666 | 81 82 83 Scenario Outline: Attempting to reallocate rewards after a party hits the cap and carrying over unallocated rewards (0057-TRAN-072)(0057-TRAN-073) 84 85 # Start a new epoch then generate trades 86 Given the network moves ahead "1" epochs 87 And the parties place the following orders: 88 | party | market id | side | volume | price | resulting trades | type | tif | 89 | party1 | ETH/USD-1-10 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 90 | aux1 | ETH/USD-1-10 | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 91 | party2 | ETH/USD-1-10 | sell | 20 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 92 | aux1 | ETH/USD-1-10 | buy | 20 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 93 | party1 | ETH/USD-1-10 | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 94 | party2 | ETH/USD-1-10 | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 95 When the network moves ahead "1" blocks 96 Then the following trades should be executed: 97 | buyer | price | size | seller | buyer fee | seller fee | 98 | party1 | 1000 | 10 | aux1 | 0 | 1000 | 99 | aux1 | 1000 | 20 | party2 | 2000 | 0 | 100 | party1 | 1000 | 10 | party2 | 0 | 1000 | 101 102 # Setup a recurring transfer funding a reward pool 103 Given the current epoch is "1" 104 And the parties submit the following recurring transfers: 105 | id | from | from_account_type | to | to_account_type | entity_scope | individual_scope | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | cap_reward_fee_multiple | lock_period | 106 | 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | INDIVIDUALS | ALL | USD-1-10 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_RECEIVED | USD-1-10 | ETH/USD-1-10 | <cap_reward_fee_multiple> | 100 | 107 When the network moves ahead "1" epochs 108 Then parties should have the following vesting account balances: 109 | party | asset | balance | 110 | party1 | USD-1-10 | <epoch1_party1_rewards> | 111 | party2 | USD-1-10 | <epoch1_party2_rewards> | 112 113 # In the second epoch both parties generate the same maker fees and pay a large amount of fees 114 And the parties place the following orders: 115 | party | market id | side | volume | price | resulting trades | type | tif | 116 | party1 | ETH/USD-1-10 | buy | 1000 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 117 | party2 | ETH/USD-1-10 | sell | 1000 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 118 | party2 | ETH/USD-1-10 | buy | 1000 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 119 | party1 | ETH/USD-1-10 | sell | 1000 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 120 When the network moves ahead "1" blocks 121 Then the following trades should be executed: 122 | buyer | price | size | seller | buyer fee | seller fee | 123 | party1 | 1000 | 1000 | party2 | 0 | 100000 | 124 | party2 | 1000 | 1000 | party1 | 0 | 100000 | 125 126 # In the next epoch unallocated rewards from the previous epoch are distributed 127 Given the current epoch is "2" 128 When the network moves ahead "1" epochs 129 Then parties should have the following vesting account balances: 130 | party | asset | balance | 131 | party1 | USD-1-10 | <epoch2_party1_rewards> | 132 | party1 | USD-1-10 | <epoch2_party2_rewards> | 133 134 Examples: 135 | cap_reward_fee_multiple | epoch1_party1_rewards | epoch1_party2_rewards | epoch2_party1_rewards | epoch2_party2_rewards | 136 | 1 | 0 | 1000 | 9500 | 9500 | 137 | 5 | 0 | 5000 | 7500 | 7500 | 138 | 10 | 0 | 9990 | 5005 | 5005 |