Skip to content

Commit 76599a9

Browse files
authored
Merge branch 'develop' into total_fee_ACs
2 parents 157c70f + 3a47950 commit 76599a9

File tree

2 files changed

+108
-4
lines changed

2 files changed

+108
-4
lines changed

core/integration/features/rewards/return_volatility_rewards.feature

Lines changed: 103 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ Feature: Return volatility rewards
317317
And "party1" should have vesting account balance of "9000" for asset "VEGA"
318318

319319
Scenario: multiple multiple (0056-REWA-090,0056-REWA-093,0056-REWA-094)
320-
# not that this test is also demonstrating multiple transfers to the same reward account but with different dispatch strategies, though same metric and same metric asset,
321-
# being handled sepearately, eventially contributing to the same accounts different amounts as calculated by the distribution strategy.
320+
# not that this test is also demonstrating multiple transfers to the same reward account but with different dispatch strategies, though same metric and same metric asset,
321+
# being handled sepearately, eventially contributing to the same accounts different amounts as calculated by the distribution strategy.
322322
Given the parties submit the following recurring transfers:
323323
| id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | window_length | distribution_strategy | entity_scope | individual_scope | staking_requirement | notional_requirement | ranks |
324324
| 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca466da6b2ddf | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY | VEGA | 10000 | 1 | | 1 | DISPATCH_METRIC_RETURN_VOLATILITY | ETH | | 2 | 2 | PRO_RATA | INDIVIDUALS | ALL | 0 | 0 | |
@@ -408,7 +408,7 @@ Feature: Return volatility rewards
408408

409409
# rank rewards from transfer2:
410410
# aux1 = 2500
411-
# aux2 = 2500
411+
# aux2 = 2500
412412
# party1 = 5000
413413

414414
# total
@@ -421,3 +421,103 @@ Feature: Return volatility rewards
421421
And "aux1" should have vesting account balance of "4238" for asset "VEGA"
422422
And "aux2" should have vesting account balance of "2776" for asset "VEGA"
423423
And "party1" should have vesting account balance of "12984" for asset "VEGA"
424+
425+
426+
Scenario: rank lottery (0056-REWA-190,0056-REWA-191)
427+
Given the following network parameters are set:
428+
| name | value |
429+
| rewards.activityStreak.inactivityLimit | 1 |
430+
| rewards.activityStreak.minQuantumTradeVolume | 1000000000000000 |
431+
| rewards.activityStreak.minQuantumOpenVolume | 10000 |
432+
| rewards.activityStreak.benefitTiers | {"tiers": [{"minimum_activity_streak": 2, "reward_multiplier": "2", "vesting_multiplier": "2"}]} |
433+
434+
Given the parties submit the following recurring transfers:
435+
| id | from | from_account_type | to | to_account_type | asset | amount | start_epoch | end_epoch | factor | metric | metric_asset | markets | lock_period | window_length | distribution_strategy | entity_scope | individual_scope | staking_requirement | notional_requirement | ranks |
436+
| 1 | a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca4ffffffffff | ACCOUNT_TYPE_GENERAL | 0000000000000000000000000000000000000000000000000000000000000000 | ACCOUNT_TYPE_REWARD_RETURN_VOLATILITY | VEGA | 10000 | 1 | | 1 | DISPATCH_METRIC_RETURN_VOLATILITY | ETH | | 2 | 2 | RANK_LOTTERY | INDIVIDUALS | ALL | 0 | 0 | 1:10,2:5 |
437+
438+
Then the network moves ahead "1" epochs
439+
440+
Given time is updated to "2023-09-23T00:00:30Z"
441+
Then the parties place the following orders:
442+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
443+
| party1 | ETH/DEC21 | buy | 10 | 1002 | 0 | TYPE_LIMIT | TIF_GTC | p1-buy1 |
444+
| aux1 | ETH/DEC21 | sell | 10 | 1002 | 1 | TYPE_LIMIT | TIF_GTC | |
445+
446+
Then the parties place the following orders:
447+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
448+
| party2 | ETH/DEC21 | sell | 10 | 1003 | 0 | TYPE_LIMIT | TIF_GTC | p2-sell |
449+
| aux2 | ETH/DEC21 | buy | 10 | 1003 | 1 | TYPE_LIMIT | TIF_GTC | |
450+
451+
Then the parties place the following orders:
452+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
453+
| party1 | ETH/DEC22 | buy | 7 | 2002 | 0 | TYPE_LIMIT | TIF_GTC | p1-buy1 |
454+
| aux1 | ETH/DEC22 | sell | 7 | 2002 | 1 | TYPE_LIMIT | TIF_GTC | |
455+
456+
Then the parties place the following orders:
457+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
458+
| party2 | ETH/DEC22 | sell | 8 | 2003 | 0 | TYPE_LIMIT | TIF_GTC | p2-sell |
459+
| aux2 | ETH/DEC22 | buy | 8 | 2003 | 1 | TYPE_LIMIT | TIF_GTC | |
460+
461+
Then the network moves ahead "1" epochs
462+
463+
Then the parties place the following orders:
464+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
465+
| party1 | ETH/DEC21 | sell | 2 | 1003 | 0 | TYPE_LIMIT | TIF_GTC | p1-buy1 |
466+
| aux1 | ETH/DEC21 | buy | 2 | 1003 | 1 | TYPE_LIMIT | TIF_GTC | |
467+
468+
Then the parties place the following orders:
469+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
470+
| party2 | ETH/DEC21 | buy | 3 | 1004 | 0 | TYPE_LIMIT | TIF_GTC | p2-sell |
471+
| aux2 | ETH/DEC21 | sell | 3 | 1004 | 1 | TYPE_LIMIT | TIF_GTC | |
472+
473+
Then the parties place the following orders:
474+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
475+
| party1 | ETH/DEC22 | sell | 4 | 2003 | 0 | TYPE_LIMIT | TIF_GTC | p1-buy1 |
476+
| aux1 | ETH/DEC22 | buy | 4 | 2003 | 1 | TYPE_LIMIT | TIF_GTC | |
477+
478+
Then the parties place the following orders:
479+
| party | market id | side | volume | price | resulting trades | type | tif | reference |
480+
| party2 | ETH/DEC22 | buy | 6 | 2004 | 0 | TYPE_LIMIT | TIF_GTC | p2-sell |
481+
| aux2 | ETH/DEC22 | sell | 6 | 2004 | 1 | TYPE_LIMIT | TIF_GTC | |
482+
483+
Then the network moves ahead "1" epochs
484+
485+
# looking at the returns of all parties for a window of 2 for only market ETH/DEC21
486+
487+
# epoch1
488+
# market1:
489+
# aux1 return = 4
490+
# aux2 return = -6
491+
# party1 return = 2
492+
# market2:
493+
# aux1 return = 2.2857142857142857
494+
# aux2 return = -3.75
495+
# party1 return = 2
496+
497+
# epoch2
498+
# market1:
499+
# aux1 return = 1
500+
# aux2 return = 0
501+
# party1 return = 1
502+
# party2 return = -1.4285714285714286
503+
# market2:
504+
# aux1 return = 1
505+
# aux2 return = 1
506+
# party1 return = 1
507+
# party2 return = -4
508+
509+
# total:
510+
# aux1 = [6.2857142857142857, 2] => variance = 1/4.5918367346938775 = 0.2177777778
511+
# aux2 = [-9.75, 1] => 1/28.890625 = 0.03461330449
512+
# party1 = [4, 2] => variance = 1
513+
# party2 = [,-5.4285714285714286] => 0
514+
515+
# rank rewards from transfer1 (party1 has a multiplier of 2):
516+
# aux1 = 2500 (rank=5 * multiplier=1 = 5) => 1666
517+
# aux2 = 2500 (rank=5 * multiplier=1 = 5) => 1666
518+
# party1 = 5000 (rank=10 * multiplier=2 = 20) => 6666
519+
520+
And "a3c024b4e23230c89884a54a813b1ecb4cb0f827a38641c66eeca4ffffffffff" should have general account balance of "90000" for asset "VEGA"
521+
And "aux1" should have vesting account balance of "1666" for asset "VEGA"
522+
And "aux2" should have vesting account balance of "1666" for asset "VEGA"
523+
And "party1" should have vesting account balance of "6666" for asset "VEGA"

core/integration/steps/transfers.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,11 @@ func rowToRecurringTransfer(r RowWrapper) *types.RecurringTransfer {
205205
if distStrat == "PRO_RATA" {
206206
distributionStrategy = proto.DistributionStrategy_DISTRIBUTION_STRATEGY_PRO_RATA
207207
} else if distStrat == "RANK" || distStrat == "RANK_LOTTERY" {
208-
distributionStrategy = proto.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK
208+
if distStrat == "RANK" {
209+
distributionStrategy = proto.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK
210+
} else {
211+
distributionStrategy = proto.DistributionStrategy_DISTRIBUTION_STRATEGY_RANK_LOTTERY
212+
}
209213
rankList := strings.Split(r.MustStr("ranks"), ",")
210214
ranks = make([]*proto.Rank, 0, len(rankList))
211215
for _, r := range rankList {

0 commit comments

Comments
 (0)