code.vegaprotocol.io/vega@v0.79.0/core/integration/features/verified/rewards_lp_fees.feature (about)

     1  Feature: Rewards for liquidity fees recieved
     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        | referrer1                                                        | USD-1-10 | 10000000    |
    32        | referee1                                                         | USD-1-10 | 10000000    |
    33        | referee2                                                         | USD-1-10 | 10000000    |
    34        | referee3                                                         | USD-1-10 | 10000000    |
    35        | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USD-1-10 | 10000000    |
    36  
    37      # Exit opening auctions
    38      Given the parties submit the following liquidity provision:
    39        | id  | party  | market id    | commitment amount | fee  | lp type    |
    40        | lp1 | lpprov | ETH/USD-1-10 | 1000000           | 0.01 | submission |
    41      And the parties place the following pegged iceberg orders:
    42        | party  | market id    | peak size | minimum visible size | side | pegged reference | volume | offset |
    43        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | buy  | BID              | 10000  | 1      |
    44        | lpprov | ETH/USD-1-10 | 5000      | 1000                 | sell | ASK              | 10000  | 1      |
    45      When the parties place the following orders:
    46        | party | market id    | side | volume | price | resulting trades | type       | tif     |
    47        | aux1  | ETH/USD-1-10 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    48        | aux1  | ETH/USD-1-10 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    49        | aux2  | ETH/USD-1-10 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    50        | aux2  | ETH/USD-1-10 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    51      And the opening auction period ends for market "ETH/USD-1-10"
    52      When the network moves ahead "1" blocks
    53      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD-1-10"
    54  
    55      # Create the teams
    56      Given the parties create the following referral codes:
    57        | party     | code            | is_team | team  |
    58        | referrer1 | referral-code-1 | true    | team1 |
    59      And the parties apply the following referral codes:
    60        | party  | code            | is_team | team  |
    61        | lpprov | referral-code-1 | true    | team1 |
    62      And the team "team1" has the following members:
    63        | party     |
    64        | referrer1 |
    65        | lpprov    |
    66  
    67    Scenario: Party funds reward pool with lp received fees and dispatch metric scoping individuals
    68  
    69      Given the parties submit the following recurring transfers:
    70        | id | from                                                             | from_account_type    | to                                                               | to_account_type                      | entity_scope | asset    | amount | start_epoch | end_epoch | factor | metric                           | metric_asset | markets      |
    71        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | INDIVIDUALS  | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_LP_FEES_RECEIVED | USD-1-10     | ETH/USD-1-10 |
    72      And the parties place the following orders:
    73        | party    | market id    | side | volume | price | resulting trades | type       | tif     |
    74        | aux1     | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    75        | referee1 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    76        | aux1     | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    77        | referee2 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    78        | aux1     | ETH/USD-1-10 | sell | 5      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    79        | referee3 | ETH/USD-1-10 | buy  | 5      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
    80      When the network moves ahead "1" epochs
    81      # Confirm lpprov did indeed receive fees
    82      Then the following transfers should happen:
    83        | from   | to     | from account                   | to account                     | market id    | amount | asset    |
    84        |        | lpprov | ACCOUNT_TYPE_FEES_LIQUIDITY    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/USD-1-10 | 2500   | USD-1-10 |
    85        | lpprov | lpprov | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL           | ETH/USD-1-10 | 2500   | USD-1-10 |
    86      # We would expect the lp to recieve the full reward
    87      Then parties should have the following vesting account balances:
    88        | party  | asset    | balance |
    89        | lpprov | USD-1-10 | 10000   |
    90  
    91  
    92    Scenario: Party funds reward pool with lp received fees dispatch metric and scoping teams
    93  
    94      Given the parties submit the following recurring transfers:
    95        | id | from                                                             | from_account_type    | to                                                               | to_account_type                      | entity_scope | teams | ntop | asset    | amount | start_epoch | end_epoch | factor | metric                           | metric_asset | markets      |
    96        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | TEAMS        | team1 | 1    | USD-1-10 | 10000  | 1           |           | 1      | DISPATCH_METRIC_LP_FEES_RECEIVED | USD-1-10     | ETH/USD-1-10 |
    97      And the parties place the following orders:
    98        | party    | market id    | side | volume | price | resulting trades | type       | tif     |
    99        | aux1     | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   100        | referee1 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   101        | aux1     | ETH/USD-1-10 | sell | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   102        | referee2 | ETH/USD-1-10 | buy  | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   103        | aux1     | ETH/USD-1-10 | sell | 5      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   104        | referee3 | ETH/USD-1-10 | buy  | 5      | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   105      When the network moves ahead "1" epochs
   106      # Confirm lpprov did indeed receive fees
   107      Then the following transfers should happen:
   108        | from   | to     | from account                   | to account                     | market id    | amount | asset    |
   109        |        | lpprov | ACCOUNT_TYPE_FEES_LIQUIDITY    | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ETH/USD-1-10 | 2500   | USD-1-10 |
   110        | lpprov | lpprov | ACCOUNT_TYPE_LP_LIQUIDITY_FEES | ACCOUNT_TYPE_GENERAL           | ETH/USD-1-10 | 2500   | USD-1-10 |
   111      # We would expect the lp to recieve the full reward
   112      Then parties should have the following vesting account balances:
   113        | party  | asset    | balance |
   114        | lpprov | USD-1-10 | 10000   |
   115  
   116  
   117  
   118  
   119  
   120  
   121  
   122