code.vegaprotocol.io/vega@v0.79.0/core/integration/features/rewards/0083-RFPR-068.feature (about)

     1  Feature: Team Rewards
     2  
     3    Background:
     4  
     5      # Initialise the network
     6      Given time is updated to "2023-01-01T00:00:00Z"
     7      And the average block duration is "1"
     8      And the following network parameters are set:
     9        | name                                    | value |
    10        | market.fee.factors.makerFee             | 0.001 |
    11        | network.markPriceUpdateMaximumFrequency | 0s    |
    12        | market.auction.minimumDuration          | 1     |
    13        | validators.epoch.length                 | 60s   |
    14        | limits.markets.maxPeggedOrders          | 4     |
    15        | referralProgram.minStakedVegaTokens     | 0     |
    16        | rewards.team.minEpochsInTeam            | 5     |
    17  
    18      # Initialise the markets
    19      And the following assets are registered:
    20        | id       | decimal places | quantum |
    21        | USD-1-10 | 1              | 10      |
    22      And the markets:
    23        | 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 |
    24        | 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                       |
    25  
    26      # Initialise the parties
    27      Given the parties deposit on asset's general account the following amount:
    28        | party                                                            | asset    | amount      |
    29        | lpprov                                                           | USD-1-10 | 10000000000 |
    30        | aux1                                                             | USD-1-10 | 10000000    |
    31        | aux2                                                             | USD-1-10 | 10000000    |
    32        | aux3                                                             | USD-1-10 | 10000000000 |
    33        | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-1-10 | 10000000000 |
    34        | party1                                                           | USD-1-10 | 10000000000 |
    35        | party2                                                           | USD-1-10 | 10000000000 |
    36        | party3                                                           | USD-1-10 | 10000000000 |
    37  
    38      # Exit opening auctions
    39      Given the parties submit the following liquidity provision:
    40        | id  | party  | market id    | commitment amount | fee  | lp type    |
    41        | lp1 | lpprov | ETH/USD-1-10 | 1000000           | 0.01 | submission |
    42      And the parties place the following pegged iceberg orders:
    43        | party  | market id    | peak size | minimum visible size | side | pegged reference | volume | offset |
    44        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | buy  | BID              | 10000  | 1      |
    45        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | sell | ASK              | 10000  | 1      |
    46      When the parties place the following orders:
    47        | party | market id    | side | volume | price | resulting trades | type       | tif     |
    48        | aux1  | ETH/USD-1-10 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    49        | aux1  | ETH/USD-1-10 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    50        | aux2  | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    51        | aux2  | ETH/USD-1-10 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    52      And the opening auction period ends for market "ETH/USD-1-10"
    53      When the network moves ahead "1" blocks
    54      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD-1-10"
    55  
    56      # Create a team
    57      And the following teams with referees are created:
    58        | referrer  | prefix | code            | team name | referees | balance  | asset    |
    59        | referrer1 | ref1   | referral-code-1 | team1     | 1        | 10000000 | USD-1-10 |
    60  
    61    @TeamStep
    62    Scenario: (0083-RFPR-068) Assert that a user joining a team is not eligible for rewards until the number of epochs since joining the team as specified in the rewards.team.minEpochsInTeam network parameter has passed.
    63    
    64      Given the parties submit the following recurring transfers:
    65        | id | from                                                             | from_account_type    | to                                                               | to_account_type                     | entity_scope | individual_scope | asset    | amount | start_epoch | end_epoch | factor | metric                          | metric_asset | markets      | ntop |
    66        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS  | TEAMS              | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 3 |
    67        # 2 individuals not in a team, 2 in a team, same metrics
    68        # all the individuals can receive rewards =10k/4 = 2,500 each
    69  
    70      When the network moves ahead "1" epochs
    71      And the parties apply the following referral codes:
    72        | party    | code            | is_team | team  |
    73        | referee1 | referral-code-1 | true    | team1 |
    74      Given the parties deposit on asset's general account the following amount:
    75        | party      | asset    | amount      |
    76        | referee1   | USD-1-10 | 10000000000 |
    77  
    78  
    79      # at this point we have two people in the team, ref1-0001 join in epoch 1 and referee1 in epoch 3
    80      # a team member must be in the team for 5 epochs before getting any rewards until then
    81      # no one gets rewards
    82     When the network moves ahead "3" epochs
    83  
    84      And the parties place the following orders:
    85        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
    86        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    87        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    88        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    89        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    90        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    91        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    92        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    93        | referee1 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    94      When the network moves ahead "1" epochs
    95      Then parties should have the following vesting account balances:
    96        | party     | asset    | balance |
    97        | ref1-0001 | USD-1-10 | 0       |
    98        | referee1 | USD-1-10  | 0       |
    99  
   100      # this epoch we expect rewards for only ref1-0001
   101      And the parties place the following orders:
   102        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   103        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   104        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   105        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   106        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   107        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   108        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   109        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   110        | referee1 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   111  
   112      When the network moves ahead "1" epochs
   113      Then parties should have the following vesting account balances:
   114        | party     | asset    | balance |
   115        | ref1-0001 | USD-1-10 | 10000   |
   116        | referee1 | USD-1-10  | 0     |
   117  
   118  
   119      And the parties place the following orders:
   120        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   121        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   122        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   123        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   124        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   125        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   126        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   127        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   128        | referee1  | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   129  
   130      When the network moves ahead "1" epochs
   131      Then parties should have the following vesting account balances:
   132        | party     | asset    | balance |
   133        | ref1-0001 | USD-1-10 | 15000   |
   134        | referee1 | USD-1-10  | 5000    |
   135  
   136  @TeamStep
   137    Scenario: (0083-RFPR-068) Setting min epoch to 0 means rewards straight away
   138  
   139      And the following network parameters are set:
   140        | name                                    | value |
   141        | rewards.team.minEpochsInTeam            | 0     |
   142  
   143      Given the parties submit the following recurring transfers:
   144        | id | from                                                             | from_account_type    | to                                                               | to_account_type                     | entity_scope | individual_scope | asset    | amount | start_epoch | end_epoch | factor | metric                          | metric_asset | markets      | ntop |
   145        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS  | TEAMS              | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 3 |
   146  
   147      And the parties place the following orders:
   148        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   149        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   150        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   151        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   152        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   153        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   154        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   155        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   156      
   157      When the network moves ahead "1" epochs
   158      Then parties should have the following vesting account balances:
   159        | party     | asset    | balance |
   160        | ref1-0001 | USD-1-10 | 10000   |
   161  
   162  @TeamStep
   163    Scenario: (0083-RFPR-068) Setting min epoch to 1 means one *whole* epoch in a team to get rewards
   164  
   165      And the following network parameters are set:
   166        | name                                    | value |
   167        | rewards.team.minEpochsInTeam            | 1     |
   168  
   169      Given the parties submit the following recurring transfers:
   170        | id | from                                                             | from_account_type    | to                                                               | to_account_type                     | entity_scope | individual_scope | asset    | amount | start_epoch | end_epoch | factor | metric                          | metric_asset | markets      | ntop |
   171        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS  | TEAMS              | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 3 |
   172  
   173      And the parties place the following orders:
   174        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   175        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   176        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   177        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   178        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   179        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   180        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   181        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   182      
   183      When the network moves ahead "1" epochs
   184      Then parties should have the following vesting account balances:
   185        | party     | asset    | balance |
   186        | ref1-0001 | USD-1-10 | 0   |
   187  
   188  
   189      And the parties place the following orders:
   190        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   191        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   192        | party1    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   193        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   194        | party2    | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   195        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   196        | ref1-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   197        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   198  
   199  
   200     When the network moves ahead "1" epochs
   201      Then parties should have the following vesting account balances:
   202        | party     | asset    | balance |
   203        | ref1-0001 | USD-1-10 | 10000   |