code.vegaprotocol.io/vega@v0.79.0/core/integration/features/rewards/rewards-remix.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  
    17      # Initialise the markets
    18      And the following assets are registered:
    19        | id       | decimal places | quantum |
    20        | USD-1-10 | 1              | 10      |
    21      And the markets:
    22        | 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 |
    23        | 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                       |
    24  
    25      # Initialise the parties
    26      Given the parties deposit on asset's general account the following amount:
    27        | party                                                            | asset    | amount      |
    28        | lpprov                                                           | USD-1-10 | 10000000000 |
    29        | aux1                                                             | USD-1-10 | 10000000    |
    30        | aux2                                                             | USD-1-10 | 10000000    |
    31        | aux3                                                             | USD-1-10 | 10000000000 |
    32        | aux4                                                             | USD-1-10 | 10000000000 |
    33        | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-1-10 | 10000000000 |
    34        | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | USD-1-10 | 10000000000 |
    35        | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | USD-1-10 | 10000000000 |
    36        | party1                                                           | USD-1-10 | 10000000000 |
    37        | party2                                                           | USD-1-10 | 10000000000 |
    38        | party3                                                           | USD-1-10 | 10000000000 |
    39        | party4                                                           | USD-1-10 | 10000000000 |
    40  
    41      # Exit opening auctions
    42      Given the parties submit the following liquidity provision:
    43        | id  | party  | market id    | commitment amount | fee  | lp type    |
    44        | lp1 | lpprov | ETH/USD-1-10 | 1000000           | 0.01 | submission |
    45      And the parties place the following pegged iceberg orders:
    46        | party  | market id    | peak size | minimum visible size | side | pegged reference | volume | offset |
    47        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | buy  | BID              | 10000  | 1      |
    48        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | sell | ASK              | 10000  | 1      |
    49      When the parties place the following orders:
    50        | party | market id    | side | volume | price | resulting trades | type       | tif     |
    51        | aux1  | ETH/USD-1-10 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    52        | aux1  | ETH/USD-1-10 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    53        | aux2  | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    54        | aux2  | ETH/USD-1-10 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    55      And the opening auction period ends for market "ETH/USD-1-10"
    56      When the network moves ahead "1" blocks
    57      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD-1-10"
    58  
    59      # Create the teams, 2 members each ( + referrer)
    60      Given the following teams with referees are created:
    61        | referrer  | prefix | code            | team name | referees | balance  | asset    |
    62        | referrer1 | ref1   | referral-code-1 | team1     | 2        | 10000000 | USD-1-10 |
    63        | referrer2 | ref2   | referral-code-2 | team2     | 2        | 10000000 | USD-1-10 |
    64  
    65    @TeamStep
    66    Scenario: Create a situation where we have parties in different teams, and some not in teams, then change the teams
    67  
    68      # set up some recurring payments, one for both teams, one for individuals only, one for a single team only
    69      Given the parties submit the following recurring transfers:
    70        | id | from                                                             | from_account_type    | to                                                               | to_account_type                     | entity_scope | individual_scope | teams       | ntop | asset    | amount | start_epoch | end_epoch | factor | metric                          | metric_asset | markets      | lock_period |
    71        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS        |                  | team1,team2 | 0.2  | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 1           |
    72        | 2  | f0b40ebdc5b92cf2cf82ff5d0c3f94085d23d5ec2d37d0b929e177c6d4d37e4c | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | INDIVIDUALS  | NOT_IN_TEAM      |             |      | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 1           |
    73        | 3  | a7c4b181ef9bf5e9029a016f854e4ad471208020fd86187d07f0b420004f06a4 | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | TEAMS        |                  | team1       | 1    | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_PAID | USD-1-10     | ETH/USD-1-10 | 1           |
    74      ## Bunch of orders:
    75      # Team1: 20, 10
    76      # Team2: 10, 9
    77      # Non-team: 1, 21, 5
    78      # Non-team: 3, 1 fee of 10k to be distributed as x, 21x, and 5x (where x = 10,000/27 = 370.370370...)
    79      #           giving 370, 7777, 1851
    80      # Team2: 1 fee shared with team1 (n top % 0.2 where team1 == 20, team2 == 10): They split 1/3rd of 10k -> 1666 each
    81      # Team1: 2 fees, 1 is shared between 2 (5k each), the second is 2/3rds shared -> 8,333
    82      And the parties place the following orders:
    83        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
    84        | aux1      | ETH/USD-1-10 | sell | 20     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    85        | ref1-0001 | ETH/USD-1-10 | buy  | 20     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    86        | aux1      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    87        | ref1-0002 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    88        | aux3      | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    89        | ref2-0001 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    90        | aux3      | ETH/USD-1-10 | sell | 9      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    91        | ref2-0002 | ETH/USD-1-10 | buy  | 9      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    92        | aux4      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    93        | party1    | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    94        | aux4      | ETH/USD-1-10 | sell | 21     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    95        | party2    | ETH/USD-1-10 | buy  | 21     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    96        | aux4      | ETH/USD-1-10 | sell | 5      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    97        | party3    | ETH/USD-1-10 | buy  | 5      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    98      When the network moves ahead "1" epochs
    99      Then parties should have the following vesting account balances:
   100        | party     | asset    | balance |
   101        | ref1-0001 | USD-1-10 | 8333    |
   102        | ref1-0002 | USD-1-10 | 8333    |
   103        | ref2-0001 | USD-1-10 | 1666    |
   104        | ref2-0002 | USD-1-10 | 1666    |
   105        | party1    | USD-1-10 | 370     |
   106        | party2    | USD-1-10 | 7777    |
   107        | party3    | USD-1-10 | 1851    |
   108  
   109      # Move party2 to team2, the nop should now force a 5 way split of the fee
   110      When the parties apply the following referral codes:
   111        | party  | code            | is_team | team  |
   112        | party2 | referral-code-2 | true    | team2 |
   113      Then the team "team2" has the following members:
   114        | party     |
   115        | referrer2 |
   116        | ref2-0001 |
   117        | ref2-0002 |
   118        | party2    |
   119      ## Division as follows:
   120      # Team1: 5k each from transfer only applicable to them = 8333 + 5000 = 13333
   121      #       10k split equally across team1 and 2 = 2.5k each = 13333 + 2500 = 15833
   122      # Team2: 5k split 3 ways == 1666 each: ref2-0001 and ref2-0002 = 1666 + 1666 == 3333
   123      #       party2 gets 7777 + 1666 = 9443.66666 ≃ 9444
   124      # Party 1 and 3 + 5k each
   125      And the parties place the following orders:
   126        | party     | market id    | side | volume | price | resulting trades | type       | tif     |
   127        | aux1      | ETH/USD-1-10 | sell | 2      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   128        | ref1-0001 | ETH/USD-1-10 | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   129        | aux1      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   130        | ref1-0002 | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   131        | aux3      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   132        | ref2-0001 | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   133        | aux3      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   134        | ref2-0002 | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   135        | aux4      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   136        | party1    | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   137        | aux4      | ETH/USD-1-10 | sell | 2      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   138        | party2    | ETH/USD-1-10 | buy  | 2      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   139        | aux4      | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   140        | party3    | ETH/USD-1-10 | buy  | 1      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   141      When the network moves ahead "1" epochs
   142      Then parties should have the following vesting account balances:
   143        | party     | asset    | balance |
   144        | ref1-0001 | USD-1-10 | 15833   |
   145        | ref1-0002 | USD-1-10 | 15833   |
   146        | ref2-0001 | USD-1-10 | 3333    |
   147        | ref2-0002 | USD-1-10 | 3333    |
   148        | party1    | USD-1-10 | 5371    |
   149        | party2    | USD-1-10 | 9444    |
   150        | party3    | USD-1-10 | 6852    |