code.vegaprotocol.io/vega@v0.79.0/core/integration/features/rewards/spot-rewards.feature (about) 1 Feature: Distributing rewards to parties based on trading activity in Spot markets 2 3 Parties actively trading on Spot markets should be eligible to recieve 4 rewards based on the maker fees they pay or receive as well as any 5 liquidity fees received. 6 7 Tests validate trading activity contributes correctly to each metric 8 on Spot markets. 9 10 Background: 11 12 # Initialise the network 13 Given the following network parameters are set: 14 | name | value | 15 | validators.epoch.length | 60s | 16 | market.fee.factors.makerFee | 0.01 | 17 And the following assets are registered: 18 | id | decimal places | quantum | 19 | USDT.0.1 | 0 | 1 | 20 | BTC.0.1 | 0 | 1 | 21 | ETH.0.1 | 0 | 1 | 22 And the average block duration is "1" 23 24 # Setup the parties 25 Given the parties deposit on asset's general account the following amount: 26 | party | asset | amount | 27 | lp1 | BTC.0.1 | 10000000 | 28 | lp2 | BTC.0.1 | 10000000 | 29 | aux1 | BTC.0.1 | 10000000 | 30 | aux2 | BTC.0.1 | 10000000 | 31 | buyer1 | BTC.0.1 | 10000000 | 32 | buyer2 | BTC.0.1 | 10000000 | 33 | seller1 | BTC.0.1 | 10000000 | 34 | seller2 | BTC.0.1 | 10000000 | 35 | lp1 | ETH.0.1 | 10000000 | 36 | lp2 | ETH.0.1 | 10000000 | 37 | aux1 | ETH.0.1 | 10000000 | 38 | aux2 | ETH.0.1 | 10000000 | 39 | buyer1 | ETH.0.1 | 10000000 | 40 | buyer2 | ETH.0.1 | 10000000 | 41 | seller1 | ETH.0.1 | 10000000 | 42 | seller2 | ETH.0.1 | 10000000 | 43 | lp1 | USDT.0.1 | 10000000000 | 44 | lp2 | USDT.0.1 | 10000000000 | 45 | aux1 | USDT.0.1 | 10000000000 | 46 | aux2 | USDT.0.1 | 10000000000 | 47 | buyer1 | USDT.0.1 | 10000000000 | 48 | buyer2 | USDT.0.1 | 10000000000 | 49 | seller1 | USDT.0.1 | 10000000000 | 50 | seller2 | USDT.0.1 | 10000000000 | 51 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | USDT.0.1 | 10000000000 | 52 53 # Setup the BTC/USDT (zero dp) and ETH/USDT (non-zero dp) spot markets and the GOLD/USDT leveraged market (future or perpetual depending on test) 54 Given the spot markets: 55 | id | name | base asset | quote asset | risk model | auction duration | fees | price monitoring | decimal places | position decimal places | sla params | 56 | BTC/USDT | BTC/USDT | BTC.0.1 | USDT.0.1 | default-log-normal-risk-model | 1 | default-none | default-none | 0 | 0 | default-basic | 57 | ETH/USDT | ETH/USDT | ETH.0.1 | USDT.0.1 | default-log-normal-risk-model | 1 | default-none | default-none | 1 | 1 | default-basic | 58 And the markets: 59 | 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 | 60 | GOLD/USDT | USDT | USDT.0.1 | default-log-normal-risk-model | default-margin-calculator | 1 | default-none | default-none | default-eth-for-future | 1e-3 | 0 | default-futures | 0 | 0 | 61 And the parties submit the following liquidity provision: 62 | id | party | market id | commitment amount | fee | lp type | 63 | lp1-BTC | lp1 | BTC/USDT | 10000 | 0.01 | submission | 64 | lp1-ETH | lp1 | ETH/USDT | 10000 | 0.01 | submission | 65 | lp2-BTC | lp2 | BTC/USDT | 10000 | 0.01 | submission | 66 | lp2-ETH | lp2 | ETH/USDT | 10000 | 0.01 | submission | 67 | lp1-GOLD | lp1 | GOLD/USDT | 10000 | 0.01 | submission | 68 | lp2-GOLD | lp2 | GOLD/USDT | 10000 | 0.01 | submission | 69 # On the BTC/USDT market, only lp1 will meet their commitment and receive liquidity rewards 70 When the parties place the following orders: 71 | party | market id | side | volume | price | resulting trades | type | tif | 72 | lp1 | BTC/USDT | buy | 10 | 990 | 0 | TYPE_LIMIT | TIF_GTC | 73 | aux1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 74 | aux2 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 75 | lp1 | BTC/USDT | sell | 10 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | 76 # On the ETH/USDT market, only lp1 will meet their commitment and receive liquidity rewards 77 And the parties place the following orders: 78 | party | market id | side | volume | price | resulting trades | type | tif | 79 | lp1 | ETH/USDT | buy | 100 | 9990 | 0 | TYPE_LIMIT | TIF_GTC | 80 | aux1 | ETH/USDT | buy | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 81 | aux2 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 82 | lp1 | ETH/USDT | sell | 100 | 10010 | 0 | TYPE_LIMIT | TIF_GTC | 83 # On the GOLD/USDT market, only lp2 will meet their commitment and receive liquidity rewards 84 And the parties place the following orders: 85 | party | market id | side | volume | price | resulting trades | type | tif | 86 | lp2 | GOLD/USDT | buy | 10 | 999 | 0 | TYPE_LIMIT | TIF_GTC | 87 | aux1 | GOLD/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 88 | aux2 | GOLD/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 89 | lp2 | GOLD/USDT | sell | 10 | 1010 | 0 | TYPE_LIMIT | TIF_GTC | 90 And the network moves ahead "2" blocks 91 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "BTC/USDT" 92 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USDT" 93 And the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "GOLD/USDT" 94 95 96 Scenario: In multiple spot markets, buyers pay maker fees and earn maker fees paid rewards. (0056-REWA-152) 97 98 # Set-up a recurring transfer 99 Given the current epoch is "0" 100 And the parties submit the following recurring transfers: 101 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 102 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USDT.0.1 | | 100 | 103 And the network moves ahead "1" epochs 104 105 # Generate trades on two different markets using a different number of decimal places 106 When the parties place the following orders: 107 | party | market id | side | volume | price | resulting trades | type | tif | 108 | seller1 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 109 | buyer1 | BTC/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 110 And the parties place the following orders: 111 | party | market id | side | volume | price | resulting trades | type | tif | 112 | seller2 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 113 | buyer2 | ETH/USDT | buy | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 114 Then the following trades should be executed: 115 | buyer | seller | price | size | buyer maker fee | seller maker fee | 116 | buyer1 | seller1 | 1000 | 10 | 100 | 0 | 117 | buyer2 | seller2 | 10000 | 100 | 100 | 0 | 118 119 # Move to the end of the epoch - buyer1 and buyer2 receive equal 120 # rewards as they paid the same maker fees on their respective 121 # spot market. 122 Given the network moves ahead "1" epochs 123 Then parties should have the following vesting account balances: 124 | party | asset | balance | 125 | buyer1 | USDT.0.1 | 5000 | 126 | buyer2 | USDT.0.1 | 5000 | 127 | seller1 | USDT.0.1 | 0 | 128 | seller2 | USDT.0.1 | 0 | 129 130 131 Scenario: In multiple spot market, sellers pay maker fees and earn maker fees paid rewards. (0056-REWA-153) 132 133 # Set-up a recurring transfer 134 Given the current epoch is "0" 135 And the parties submit the following recurring transfers: 136 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 137 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USDT.0.1 | | 100 | 138 And the network moves ahead "1" epochs 139 140 # Generate trades on two different markets using a different number of decimal places 141 When the parties place the following orders: 142 | party | market id | side | volume | price | resulting trades | type | tif | 143 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 144 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 145 And the parties place the following orders: 146 | party | market id | side | volume | price | resulting trades | type | tif | 147 | buyer2 | ETH/USDT | buy | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 148 | seller2 | ETH/USDT | sell | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 149 Then the following trades should be executed: 150 | buyer | seller | price | size | buyer maker fee | seller maker fee | 151 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 152 | buyer2 | seller2 | 10000 | 100 | 0 | 100 | 153 154 # Move to the end of the epoch - seller1 and seller2 receive equal 155 # rewards as they paid the same maker fees on their respective 156 # spot market. 157 Given the network moves ahead "1" epochs 158 Then parties should have the following vesting account balances: 159 | party | asset | balance | 160 | buyer1 | USDT.0.1 | 0 | 161 | buyer1 | USDT.0.1 | 0 | 162 | seller1 | USDT.0.1 | 5000 | 163 | seller1 | USDT.0.1 | 5000 | 164 165 166 Scenario: In multiple spot markets, buyers receive maker fees and earn maker fees received rewards. (0056-REWA-154) 167 168 # Set-up a recurring transfer 169 Given the current epoch is "0" 170 And the parties submit the following recurring transfers: 171 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 172 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_RECEIVED | USDT.0.1 | | 100 | 173 And the network moves ahead "1" epochs 174 175 # Generate trades on two different markets using a different number of decimal places 176 When the parties place the following orders: 177 | party | market id | side | volume | price | resulting trades | type | tif | 178 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 179 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 180 And the parties place the following orders: 181 | party | market id | side | volume | price | resulting trades | type | tif | 182 | buyer2 | ETH/USDT | buy | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 183 | seller2 | ETH/USDT | sell | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 184 Then the following trades should be executed: 185 | buyer | seller | price | size | buyer maker fee | seller maker fee | 186 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 187 | buyer2 | seller2 | 10000 | 100 | 0 | 100 | 188 189 # Move to the end of the epoch - buyer1 and buyer2 receive equal 190 # rewards as they received the same maker fees on their respective 191 # spot market. 192 Given the network moves ahead "1" epochs 193 Then parties should have the following vesting account balances: 194 | party | asset | balance | 195 | buyer1 | USDT.0.1 | 5000 | 196 | buyer2 | USDT.0.1 | 5000 | 197 | seller1 | USDT.0.1 | 0 | 198 | seller2 | USDT.0.1 | 0 | 199 200 201 Scenario: In multiple spot markets, sellers receive maker fees and earn maker fees received rewards. (0056-REWA-155) 202 203 # Set-up a recurring transfer 204 Given the current epoch is "0" 205 And the parties submit the following recurring transfers: 206 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 207 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_RECEIVED | USDT.0.1 | | 100 | 208 And the network moves ahead "1" epochs 209 210 # Generate trades on two different markets using a different number of decimal places 211 When the parties place the following orders: 212 | party | market id | side | volume | price | resulting trades | type | tif | 213 | seller1 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 214 | buyer1 | BTC/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 215 And the parties place the following orders: 216 | party | market id | side | volume | price | resulting trades | type | tif | 217 | seller2 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 218 | buyer2 | ETH/USDT | buy | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 219 Then the following trades should be executed: 220 | buyer | seller | price | size | buyer maker fee | seller maker fee | 221 | buyer1 | seller1 | 1000 | 10 | 100 | 0 | 222 | buyer2 | seller2 | 10000 | 100 | 100 | 0 | 223 224 # Move to the end of the epoch - seller1 and seller2 receive equal 225 # rewards as they received the same maker fees on their respective 226 # spot market. 227 Given the network moves ahead "1" epochs 228 Then parties should have the following vesting account balances: 229 | party | asset | balance | 230 | buyer1 | USDT.0.1 | 0 | 231 | buyer2 | USDT.0.1 | 0 | 232 | seller1 | USDT.0.1 | 5000 | 233 | seller2 | USDT.0.1 | 5000 | 234 235 236 Scenario: In multiple spot markets, liquidity providers who receive liquidity fees, earn liquidity fees received rewards. (0056-REWA-156) 237 238 # Set-up a recurring transfer 239 Given the current epoch is "0" 240 And the parties submit the following recurring transfers: 241 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 242 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_LP_FEES_RECEIVED | USDT.0.1 | | 100 | 243 And the network moves ahead "1" epochs 244 245 # Generate trades on two different markets using a different number of decimal places 246 When the parties place the following orders: 247 | party | market id | side | volume | price | resulting trades | type | tif | 248 | seller1 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 249 | buyer1 | BTC/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 250 And the parties place the following orders: 251 | party | market id | side | volume | price | resulting trades | type | tif | 252 | seller2 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 253 | buyer2 | ETH/USDT | buy | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 254 Then the following trades should be executed: 255 | buyer | seller | price | size | buyer liquidity fee | seller liquidity fee | 256 | buyer1 | seller1 | 1000 | 10 | 100 | 0 | 257 | buyer2 | seller2 | 10000 | 100 | 100 | 0 | 258 259 # Move to the end of the epoch - lp1 receives all the rewards as 260 # they were the only lp to meet their commitment. 261 Given the network moves ahead "1" epochs 262 Then parties should have the following vesting account balances: 263 | party | asset | balance | 264 | lp1 | USDT.0.1 | 10000 | 265 | lp2 | USDT.0.1 | 0 | 266 | buyer1 | USDT.0.1 | 0 | 267 | buyer2 | USDT.0.1 | 0 | 268 | seller1 | USDT.0.1 | 0 | 269 | seller2 | USDT.0.1 | 0 | 270 271 272 Scenario Outline: Given spot markets where the base asset matches the dispatch metric of a reward, rewards will not be paid out as fees are paid in the quote asset. (0056-REWA-157)(0056-REWA-158)(0056-REWA-159)(0056-REWA-160)(0056-REWA-161) 273 274 # Set-up a recurring transfer 275 Given the current epoch is "0" 276 And the parties submit the following recurring transfers: 277 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 278 | reward-btc | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | <account type> | USDT.0.1 | 10000 | 1 | | 1 | <dispatch metric> | BTC.0.1 | | 100 | 279 | reward-eth | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | <account type> | USDT.0.1 | 10000 | 1 | | 1 | <dispatch metric> | ETH.0.1 | | 100 | 280 And the network moves ahead "1" epochs 281 282 # Generate trades on two different markets using a different number of decimal places 283 When the parties place the following orders: 284 | party | market id | side | volume | price | resulting trades | type | tif | 285 | seller1 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 286 | buyer1 | BTC/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 287 | buyer2 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 288 | seller2 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 289 And the parties place the following orders: 290 | party | market id | side | volume | price | resulting trades | type | tif | 291 | seller1 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 292 | buyer1 | ETH/USDT | buy | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 293 | buyer2 | ETH/USDT | buy | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 294 | seller2 | ETH/USDT | sell | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 295 Then the following trades should be executed: 296 | buyer | seller | price | size | buyer maker fee | seller maker fee | buyer liquidity fee | seller liquidity fee | 297 | buyer1 | seller1 | 1000 | 10 | 100 | 0 | 100 | 0 | 298 | buyer2 | seller2 | 1000 | 10 | 0 | 100 | 0 | 100 | 299 | buyer1 | seller1 | 10000 | 100 | 100 | 0 | 100 | 0 | 300 | buyer2 | seller2 | 10000 | 100 | 0 | 100 | 0 | 100 | 301 302 # Move to the end of the epoch - no parties should receive any 303 # rewards as the asset for metric scoped the base asset. 304 Given the network moves ahead "1" epochs 305 Then parties should have the following vesting account balances: 306 | party | asset | balance | 307 | lp1 | USDT.0.1 | 0 | 308 | buyer1 | USDT.0.1 | 0 | 309 | buyer2 | USDT.0.1 | 0 | 310 | seller1 | USDT.0.1 | 0 | 311 | seller2 | USDT.0.1 | 0 | 312 313 Examples: 314 | account type | dispatch metric | 315 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | DISPATCH_METRIC_MAKER_FEES_PAID | 316 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | DISPATCH_METRIC_MAKER_FEES_RECEIVED | 317 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | DISPATCH_METRIC_LP_FEES_RECEIVED | 318 319 320 Scenario Outline: Given spot markets, trading activity does not contribute to metrics which can not be evaluated. (0056-REWA-162)(0056-REWA-163)(0056-REWA-164) 321 322 # Set-up a recurring transfer 323 Given the current epoch is "0" 324 And the parties submit the following recurring transfers: 325 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 326 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | <account type> | USDT.0.1 | 10000 | 1 | | 1 | <dispatch metric> | USDT.0.1 | | 100 | 327 And the network moves ahead "1" epochs 328 329 # Generate trades on two different markets using a different number of decimal places 330 Then the trading mode should be "TRADING_MODE_CONTINUOUS" for the market "ETH/USDT" 331 When the parties place the following orders: 332 | party | market id | side | volume | price | resulting trades | type | tif | 333 | seller1 | BTC/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 334 | buyer1 | BTC/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 335 And the parties place the following orders: 336 | party | market id | side | volume | price | resulting trades | type | tif | 337 | seller2 | ETH/USDT | sell | 100 | 10000 | 0 | TYPE_LIMIT | TIF_GTC | 338 | buyer2 | ETH/USDT | buy | 100 | 10000 | 1 | TYPE_LIMIT | TIF_GTC | 339 Then the following trades should be executed: 340 | buyer | seller | price | size | buyer maker fee | seller maker fee | 341 | buyer1 | seller1 | 1000 | 10 | 100 | 0 | 342 | buyer2 | seller2 | 10000 | 100 | 100 | 0 | 343 344 # Move to the end of the epoch - no parties should receive any 345 # rewards as the dispatch metric can not be evaluated on a Spot 346 # market. 347 Given the network moves ahead "1" epochs 348 Then parties should have the following vesting account balances: 349 | party | asset | balance | 350 | buyer1 | USDT.0.1 | 0 | 351 | buyer2 | USDT.0.1 | 0 | 352 | seller1 | USDT.0.1 | 0 | 353 | seller2 | USDT.0.1 | 0 | 354 355 Examples: 356 | account type | dispatch metric | 357 | ACCOUNT_TYPE_REWARD_AVERAGE_NOTIONAL | DISPATCH_METRIC_AVERAGE_NOTIONAL | 358 | ACCOUNT_TYPE_REWARD_RELATIVE_RETURN | DISPATCH_METRIC_RELATIVE_RETURN | 359 | ACCOUNT_TYPE_REWARD_REALISED_RETURN | DISPATCH_METRIC_REALISED_RETURN | 360 361 362 Scenario: Given a maker fees paid reward, contributions from a spot market are correctly aggregated with markets allowing leverage. (0056-REWA-165) 363 364 # Set-up a recurring transfer 365 Given the current epoch is "0" 366 And the parties submit the following recurring transfers: 367 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 368 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_PAID | USDT.0.1 | | 100 | 369 And the network moves ahead "1" epochs 370 371 # Generate trades on the spot market 372 Given the parties place the following orders: 373 | party | market id | side | volume | price | resulting trades | type | tif | 374 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 375 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 376 Then the following trades should be executed: 377 | buyer | seller | price | size | buyer maker fee | seller liquidity fee | 378 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 379 380 Given clear trade events 381 382 # Generate trades on the leveraged market 383 Given the parties place the following orders: 384 | party | market id | side | volume | price | resulting trades | type | tif | 385 | seller2 | GOLD/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 386 | buyer2 | GOLD/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 387 Then the following trades should be executed: 388 | buyer | seller | price | size | buyer liquidity fee | seller maker fee | 389 | buyer2 | seller2 | 1000 | 10 | 100 | 0 | 390 391 # Move to the end of the epoch - seller1 and buyer2 should receive 392 # equal rewards as they PAID an equal amount of maker fees on the 393 # spot and leveraged markets respectively. 394 Given the network moves ahead "1" epochs 395 Then parties should have the following vesting account balances: 396 | party | asset | balance | 397 | buyer1 | USDT.0.1 | 0 | 398 | seller1 | USDT.0.1 | 5000 | 399 | buyer2 | USDT.0.1 | 5000 | 400 | seller2 | USDT.0.1 | 0 | 401 402 403 Scenario: Given a maker fees received reward, contributions from a spot market are correctly aggregated with markets allowing leverage. (0056-REWA-166) 404 405 # Set-up a recurring transfer 406 Given the current epoch is "0" 407 And the parties submit the following recurring transfers: 408 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 409 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_MAKER_FEES_RECEIVED | USDT.0.1 | | 100 | 410 And the network moves ahead "1" epochs 411 412 # Generate trades on the spot market 413 Given the parties place the following orders: 414 | party | market id | side | volume | price | resulting trades | type | tif | 415 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 416 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 417 Then the following trades should be executed: 418 | buyer | seller | price | size | buyer maker fee | seller liquidity fee | 419 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 420 421 Given clear trade events 422 423 # Generate trades on the leveraged market 424 Given the parties place the following orders: 425 | party | market id | side | volume | price | resulting trades | type | tif | 426 | seller2 | GOLD/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 427 | buyer2 | GOLD/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 428 Then the following trades should be executed: 429 | buyer | seller | price | size | buyer liquidity fee | seller maker fee | 430 | buyer2 | seller2 | 1000 | 10 | 100 | 0 | 431 432 # Move to the end of the epoch - buyer1 and seller2 should receive 433 # equal rewards as they received an equal amount of maker fees on 434 # the spot and leveraged markets respectively. 435 Given the network moves ahead "1" epochs 436 Then parties should have the following vesting account balances: 437 | party | asset | balance | 438 | buyer1 | USDT.0.1 | 5000 | 439 | seller1 | USDT.0.1 | 0 | 440 | buyer2 | USDT.0.1 | 0 | 441 | seller2 | USDT.0.1 | 5000 | 442 443 444 Scenario: Given a liquidity fees received reward, contributions from a spot market are correctly aggregated with markets allowing leverage. (0056-REWA-167). Given the following dispatch metrics, if no `eligible keys` list is specified in the recurring transfer, all parties meeting other eligibility criteria should receive a score 0056-REWA-202. 445 # Set-up a recurring transfer 446 Given the current epoch is "0" 447 And the parties submit the following recurring transfers: 448 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | 449 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_LP_FEES_RECEIVED | USDT.0.1 | | 100 | 450 And the network moves ahead "1" epochs 451 452 # Generate trades on the spot market 453 Given the parties place the following orders: 454 | party | market id | side | volume | price | resulting trades | type | tif | 455 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 456 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 457 Then the following trades should be executed: 458 | buyer | seller | price | size | buyer maker fee | seller liquidity fee | 459 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 460 461 Given clear trade events 462 463 # Generate trades on the leveraged market 464 Given the parties place the following orders: 465 | party | market id | side | volume | price | resulting trades | type | tif | 466 | seller2 | GOLD/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 467 | buyer2 | GOLD/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 468 Then the following trades should be executed: 469 | buyer | seller | price | size | buyer liquidity fee | seller maker fee | 470 | buyer2 | seller2 | 1000 | 10 | 100 | 0 | 471 472 # Move to the end of the epoch - LP1 and LP2 should receive equal 473 # rewards as they received an equal amount of liquidity fees from 474 # the spot and leveraged markets respectively. 475 Given the network moves ahead "1" epochs 476 Then parties should have the following vesting account balances: 477 | party | asset | balance | 478 | lp1 | USDT.0.1 | 5000 | 479 | lp2 | USDT.0.1 | 5000 | 480 481 Scenario: Given the following dispatch metrics, if an `eligible keys` list is specified in the recurring transfer, only parties included in the list and meeting other eligibility criteria should receive a score 0056-REWA-213. 482 # Set-up a recurring transfer 483 Given the current epoch is "0" 484 And the parties submit the following recurring transfers: 485 | id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | eligible_keys | 486 | reward | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES | USDT.0.1 | 10000 | 1 | | 1 | DISPATCH_METRIC_LP_FEES_RECEIVED | USDT.0.1 | | 100 | lp1 | 487 And the network moves ahead "1" epochs 488 489 # Generate trades on the spot market 490 Given the parties place the following orders: 491 | party | market id | side | volume | price | resulting trades | type | tif | 492 | buyer1 | BTC/USDT | buy | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 493 | seller1 | BTC/USDT | sell | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 494 Then the following trades should be executed: 495 | buyer | seller | price | size | buyer maker fee | seller liquidity fee | 496 | buyer1 | seller1 | 1000 | 10 | 0 | 100 | 497 498 Given clear trade events 499 500 # Generate trades on the leveraged market 501 Given the parties place the following orders: 502 | party | market id | side | volume | price | resulting trades | type | tif | 503 | seller2 | GOLD/USDT | sell | 10 | 1000 | 0 | TYPE_LIMIT | TIF_GTC | 504 | buyer2 | GOLD/USDT | buy | 10 | 1000 | 1 | TYPE_LIMIT | TIF_GTC | 505 Then the following trades should be executed: 506 | buyer | seller | price | size | buyer liquidity fee | seller maker fee | 507 | buyer2 | seller2 | 1000 | 10 | 100 | 0 | 508 509 # Move to the end of the epoch - LP1 and LP2 should receive equal but only lp1 is in eligible keys so they get it all 510 # rewards as they received an equal amount of liquidity fees from 511 # the spot and leveraged markets respectively. 512 Given the network moves ahead "1" epochs 513 Then parties should have the following vesting account balances: 514 | party | asset | balance | 515 | lp1 | USDT.0.1 | 10000 |