code.vegaprotocol.io/vega@v0.79.0/core/integration/features/rewards/0056-REWA-170.feature (about)

     1  Feature: If an AMM sub-key earns rewards, they are transferred into the sub-keys vesting account and locked for the appropriate period before vesting
     2  
     3    Background:
     4      Given the average block duration is "1"      
     5      And the following network parameters are set:
     6        | name                                                | value |
     7        | market.value.windowLength                           | 60s   |
     8        | validators.epoch.length                             | 10s   |
     9        | market.value.windowLength                           | 60s   |
    10        | network.markPriceUpdateMaximumFrequency             | 2s    |
    11        | limits.markets.maxPeggedOrders                      | 6     |
    12        | market.auction.minimumDuration                      | 1     |
    13        | market.fee.factors.infrastructureFee                | 0.001 |
    14        | market.fee.factors.makerFee                         | 0.004 |
    15        | spam.protection.max.stopOrdersPerMarket             | 5     |
    16        | market.liquidity.equityLikeShareFeeFraction         | 1     |
    17  	    | market.amm.minCommitmentQuantum                     | 1     |
    18        | market.liquidity.bondPenaltyParameter               | 0.2   |
    19        | market.liquidity.stakeToCcyVolume                   | 1     |
    20        | market.liquidity.successorLaunchWindowLength        | 1h    |
    21        | market.liquidity.sla.nonPerformanceBondPenaltySlope | 0.1   |
    22        | market.liquidity.sla.nonPerformanceBondPenaltyMax   | 0.6   |
    23        | validators.epoch.length                             | 10s   |
    24        | market.liquidity.earlyExitPenalty                   | 0.25  |
    25        | market.liquidity.maximumLiquidityFeeFactorLevel     | 0.25  |
    26        | rewards.vesting.baseRate                            | 0.1   |
    27        | rewards.vesting.minimumTransfer                     | 1     |
    28  
    29      And the following assets are registered:
    30        | id  | decimal places |
    31        | USD | 0              |
    32      And the fees configuration named "fees-config-1":
    33        | maker fee | infrastructure fee |
    34        | 0.0004    | 0.001              |
    35      And the markets:
    36        | id        | quote name | asset | risk model                    | margin calculator         | auction duration | fees          | price monitoring | data source config     | linear slippage factor | quadratic slippage factor | sla params    |
    37        | ETH/MAR22 | USD        | USD   | default-log-normal-risk-model | default-margin-calculator | 2                | fees-config-1 | default-basic    | default-eth-for-future | 1e0                    | 0                         | default-basic |
    38  
    39    @VAMM
    40    Scenario: 
    41      Given the parties deposit on asset's general account the following amount:
    42        | party                                                            | asset | amount  |
    43        | party1                                                           | USD   |  100000 |
    44        | party2                                                           | USD   |  100000 |
    45        | party3                                                           | USD   |  100000 |
    46        | vamm1                                                            | USD   |  100000 |
    47        | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | VEGA  | 1000000 |
    48      And the parties submit the following recurring transfers:
    49        | id | from                                                             | from_account_type    | to                                                               | to_account_type                         | asset | amount | start_epoch | end_epoch | factor | metric                              | metric_asset | markets   |
    50        | 1  | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | VEGA  | 10000  | 1           |           | 1      | DISPATCH_METRIC_MAKER_FEES_RECEIVED | USD          | ETH/MAR22 |
    51  
    52      When the network moves ahead "4" blocks
    53      Then the current epoch is "0"
    54  
    55      When the parties place the following orders:
    56        | party  | market id | side | volume | price | resulting trades | type       | tif     |
    57        | party1 | ETH/MAR22 | buy  | 1      | 1     | 0                | TYPE_LIMIT | TIF_GTC |
    58        | party1 | ETH/MAR22 | buy  | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |
    59        | party2 | ETH/MAR22 | sell | 1      | 100   | 0                | TYPE_LIMIT | TIF_GTC |
    60        | party2 | ETH/MAR22 | sell | 1      | 200   | 0                | TYPE_LIMIT | TIF_GTC |
    61      And the opening auction period ends for market "ETH/MAR22"
    62      Then the following trades should be executed:
    63        | buyer  | price | size | seller |
    64        | party1 | 100   | 1    | party2 |
    65      And the market data for the market "ETH/MAR22" should be:
    66        | mark price | trading mode            |
    67        | 100        | TRADING_MODE_CONTINUOUS |
    68      
    69      When the parties submit the following AMM:
    70        | party | market id | amount | slippage | base | lower bound | upper bound | lower leverage | upper leverage | proposed fee |
    71        | vamm1 | ETH/MAR22 | 100000 | 0.1      | 100  | 85          | 150         | 0.25           | 0.25           | 0.01         |
    72      Then the AMM pool status should be:
    73        | party | market id | amount | status        | base | lower bound | upper bound | lower leverage | upper leverage |
    74        | vamm1 | ETH/MAR22 | 100000 | STATUS_ACTIVE | 100  | 85          | 150         | 0.25           | 0.25           |
    75      And set the following AMM sub account aliases:
    76        | party | market id | alias     |
    77        | vamm1 | ETH/MAR22 | vamm1-acc |
    78      And the following transfers should happen:
    79        | from  | from account         | to        | to account           | market id | amount | asset | is amm | type                  |
    80        | vamm1 | ACCOUNT_TYPE_GENERAL | vamm1-acc | ACCOUNT_TYPE_GENERAL |           | 100000 | USD   | true   | TRANSFER_TYPE_AMM_LOW |
    81  
    82      When the network moves ahead "11" blocks
    83      Then the current epoch is "1"
    84  
    85      When the parties place the following orders:
    86        | party  | market id | side | volume | price | resulting trades | type        | tif     |
    87        | party1 | ETH/MAR22 | buy  | 1      | 0     | 1                | TYPE_MARKET | TIF_FOK |
    88      Then the following trades should be executed:
    89        | buyer  | price | size | seller                                                           | buyer maker fee |
    90        | party1 | 100   | 1    | 137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba | 1               |
    91  
    92      When the network moves ahead "11" blocks
    93      Then the current epoch is "2"
    94      And "137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba" should have vesting account balance of "10000" for asset "VEGA"
    95  
    96      When the network moves ahead "11" blocks
    97      Then the current epoch is "3"
    98      And "137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba" should have vesting account balance of "5000" for asset "VEGA"
    99      And "137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba" should have vested account balance of "5000" for asset "VEGA"
   100  
   101      When the network moves ahead "11" blocks
   102      Then the current epoch is "4"
   103      And "137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba" should have vesting account balance of "0" for asset "VEGA"
   104      And "137112507e25d3845a56c47db15d8ced0f28daa8498a0fd52648969c4b296aba" should have vested account balance of "10000" for asset "VEGA"