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

     1  Feature: Setting and applying referral reward multipliers
     2  
     3    Background:
     4  
     5      # Initialise timings
     6      Given time is updated to "2023-01-01T00:00:00Z"
     7      And the average block duration is "1"
     8  
     9      # Initialise network parameters
    10      Given the following network parameters are set:
    11        | name                                                    | value      |
    12        | market.fee.factors.infrastructureFee                    | 0.01       |
    13        | market.fee.factors.makerFee                             | 0.01       |
    14        | market.auction.minimumDuration                          | 1          |
    15        | limits.markets.maxPeggedOrders                          | 4          |
    16        | referralProgram.minStakedVegaTokens                     | 0          |
    17        | referralProgram.maxPartyNotionalVolumeByQuantumPerEpoch | 1000000000 |
    18        | referralProgram.maxReferralRewardProportion             | 0.1        |
    19  
    20      # Initialise the staking parameters and the initial staking setup
    21      Given the following network parameters are set:
    22        | name                                       | value |
    23        | validators.delegation.minAmount            | 1     |
    24        | reward.staking.delegation.competitionLevel | 1.1   |
    25        | reward.staking.delegation.minValidators    | 1     |
    26      And the validators:
    27        | id    | staking account balance | pub_key |
    28        | node1 | 1000000                 | pk1     |
    29      And the parties submit the following delegations:
    30        | party | node id | amount |
    31        | pk1   | node1   | 10000  |
    32  
    33      # Initalise the referral program then move forwards an epoch to start the program
    34      Given the referral benefit tiers "rbt":
    35        | minimum running notional taker volume | minimum epochs | referral reward infra factor | referral reward maker factor | referral reward liquidity factor | referral discount infra factor | referral discount maker factor | referral discount liquidity factor |
    36        | 1                                     | 1              | 0.021                        | 0.022                        | 0.023                            | 0.024                          | 0.025                          | 0.026                              |
    37      And the referral staking tiers "rst":
    38        | minimum staked tokens | referral reward multiplier |
    39        | 2000                  | 2                          |
    40        | 3000                  | 10                         |
    41      And the referral program:
    42        | end of program       | window length | benefit tiers | staking tiers |
    43        | 2023-12-12T12:12:12Z | 7             | rbt           | rst           |
    44      And the network moves ahead "1" epochs
    45  
    46      # Initialse the assets and markets
    47      And the following assets are registered:
    48        | id      | decimal places | quantum |
    49        | USD.1.1 | 1              | 1       |
    50      And the markets:
    51        | 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 |
    52        | ETH/USD.1.1 | ETH        | USD.1.1 | default-log-normal-risk-model | default-margin-calculator | 1                | default-none | default-none     | default-eth-for-future | 1e-3                   | 0                         | default-futures | 1              | 1                       |
    53      And the liquidity monitoring parameters:
    54        | name       | triggering ratio | time window | scaling factor |
    55        | lqm-params | 1.0              | 3600s       | 1              |
    56      When the markets are updated:
    57        | id          | liquidity monitoring | linear slippage factor | quadratic slippage factor |
    58        | ETH/USD.1.1 | lqm-params           | 1e-3                   | 0                         |
    59  
    60      # Initialise the parties
    61      Given the parties deposit on asset's general account the following amount:
    62        | party     | asset   | amount     |
    63        | lpprov    | USD.1.1 | 1000000000 |
    64        | aux1      | USD.1.1 | 1000000000 |
    65        | aux2      | USD.1.1 | 1000000000 |
    66        | referrer1 | USD.1.1 | 1000000000 |
    67        | referee1  | USD.1.1 | 1000000000 |
    68        | referee2  | USD.1.1 | 1000000000 |
    69  
    70      # Exit the opening auction
    71      Given the parties submit the following liquidity provision:
    72        | id  | party  | market id   | commitment amount | fee  | lp type    |
    73        | lp1 | lpprov | ETH/USD.1.1 | 1000000           | 0.01 | submission |
    74      And the parties place the following pegged iceberg orders:
    75        | party  | market id   | peak size | minimum visible size | side | pegged reference | volume | offset |
    76        | lpprov | ETH/USD.1.1 | 5000      | 1000                 | buy  | BID              | 10000  | 1      |
    77        | lpprov | ETH/USD.1.1 | 5000      | 1000                 | sell | ASK              | 10000  | 1      |
    78      When the parties place the following orders:
    79        | party | market id   | side | volume | price | resulting trades | type       | tif     |
    80        | aux1  | ETH/USD.1.1 | buy  | 1      | 990   | 0                | TYPE_LIMIT | TIF_GTC |
    81        | aux1  | ETH/USD.1.1 | buy  | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    82        | aux2  | ETH/USD.1.1 | sell | 1      | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
    83        | aux2  | ETH/USD.1.1 | sell | 1      | 1100  | 0                | TYPE_LIMIT | TIF_GTC |
    84      And the opening auction period ends for market "ETH/USD.1.1"
    85      And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USD.1.1"
    86  
    87      # Create the referral set and codes
    88      Given the parties create the following referral codes:
    89        | party     | code            |
    90        | referrer1 | referral-code-1 |
    91      And the parties apply the following referral codes:
    92        | party    | code            |
    93        | referee1 | referral-code-1 |
    94  
    95  
    96    Scenario Outline: Referrer stakes a variable amount and receives a multiplier on their referral rewards (0083-RFPR-046)(0083-RFPR-047)(0029-FEES-023)(0029-FEES-025)
    97      # Expectation: Referral reward multiplier from staking should be set correctly according to the spec
    98  
    99      # Test cases
   100      # - Referrer does not fulfill the smallest 'minimum staking requirement', multiplier should default to 1
   101      # - Referrer does fulfill the smallest 'minimum staking requirement', multiplier should default to the correct value
   102      # - Referrer does fulfill the greatest 'minimum staking requirement', reward should be capped by the network parameter "referralProgram.maxReferralRewardProportion"
   103  
   104      Then the parties deposit on staking account the following amount:
   105        | party     | asset | amount           |
   106        | referrer1 | VEGA  | <staking amount> |
   107      Then the parties submit the following delegations:
   108        | party     | node id | amount           |
   109        | referrer1 | node1   | <staking amount> |
   110  
   111      Given the parties place the following orders:
   112        | party     | market id   | side | volume | price | resulting trades | type       | tif     |
   113        | aux1      | ETH/USD.1.1 | buy  | 10     | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   114        | referrer1 | ETH/USD.1.1 | sell | 10     | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   115      When the network moves ahead "2" epochs
   116      Then the referral set stats for code "referral-code-1" at epoch "2" should have a running volume of 1000:
   117        | party    | reward infra factor | reward maker factor | reward liquidity factor | discount infra factor | discount maker factor | discount liquidity factor |
   118        | referee1 | 0.021               | 0.022               | 0.023                   | 0.024                 | 0.025                 | 0.026                     |
   119  
   120      Given the parties place the following orders:
   121        | party    | market id   | side | volume | price | resulting trades | type       | tif     |
   122        | aux1     | ETH/USD.1.1 | buy  | 100    | 1000  | 0                | TYPE_LIMIT | TIF_GTC |
   123        | referee1 | ETH/USD.1.1 | sell | 100    | 1000  | 1                | TYPE_LIMIT | TIF_GTC |
   124      When the following trades should be executed:
   125        | buyer | price | size | seller   |
   126        | aux1  | 1000  | 100  | referee1 |
   127      Then the following transfers should happen:
   128        | from     | to        | from account                             | to account                               | market id   | amount                     | asset   |
   129        | referee1 | market    | ACCOUNT_TYPE_GENERAL                     | ACCOUNT_TYPE_FEES_MAKER                  | ETH/USD.1.1 | <expected discounted fees> | USD.1.1 |
   130        | referee1 | market    | ACCOUNT_TYPE_GENERAL                     | ACCOUNT_TYPE_FEES_LIQUIDITY              | ETH/USD.1.1 | <expected discounted fees> | USD.1.1 |
   131        | referee1 |           | ACCOUNT_TYPE_GENERAL                     | ACCOUNT_TYPE_FEES_INFRASTRUCTURE         |             | <expected discounted fees> | USD.1.1 |
   132        | referee1 |           | ACCOUNT_TYPE_GENERAL                     | ACCOUNT_TYPE_PENDING_FEE_REFERRAL_REWARD |             | <expected reward>          | USD.1.1 |
   133        |          | referrer1 | ACCOUNT_TYPE_PENDING_FEE_REFERRAL_REWARD | ACCOUNT_TYPE_GENERAL                     |             | <expected reward>          | USD.1.1 |
   134  
   135      Examples:
   136        | staking amount | expected discounted fees | expected reward |
   137        | 1001           | 96                       | 6               |
   138        | 2001           | 94                       | 12              |
   139        | 3001           | 89                       | 27              |