From 20560a16d76b0587355bac2e1c3ff6b60c7ce6c1 Mon Sep 17 00:00:00 2001 From: Ruaridh Date: Wed, 4 Aug 2021 19:02:59 +0100 Subject: [PATCH] fix test setup to use new Multipliers type (#984) --- x/incentive/keeper/rewards_borrow_test.go | 9 +++++---- x/incentive/keeper/rewards_supply_test.go | 9 +++++---- x/incentive/keeper/rewards_usdx_test.go | 21 ++++++++++++--------- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/x/incentive/keeper/rewards_borrow_test.go b/x/incentive/keeper/rewards_borrow_test.go index 28e6a4f2..a502aec6 100644 --- a/x/incentive/keeper/rewards_borrow_test.go +++ b/x/incentive/keeper/rewards_borrow_test.go @@ -48,9 +48,10 @@ func (suite *BorrowIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin incentBuilder := testutil.NewIncentiveGenesisBuilder(). WithGenesisTime(suite.genesisTime). - WithMultipliers(types.Multipliers{ - types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier - }). + WithMultipliers(types.MultipliersPerDenom{{ + Denom: "hard", + Multipliers: types.Multipliers{types.NewMultiplier(types.Large, 12, d("1.0"))}, // keep payout at 1.0 to make maths easier + }}). WithSimpleBorrowRewardPeriod("bnb", cs(c("hard", 1e6))) // only borrow rewards suite.StartChain( @@ -78,7 +79,7 @@ func (suite *BorrowIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin suite.NextBlockAfter(1e6 * time.Second) // about 12 days // User claims all their rewards - suite.NoError(suite.DeliverIncentiveMsg(types.NewMsgClaimHardReward(userA, "large", nil))) + suite.NoError(suite.DeliverIncentiveMsg(types.NewMsgClaimHardReward(userA, types.NewSelection("hard", "large")))) // The users has always had 100% of borrows, so they should receive all rewards for the previous two blocks. // Total rewards for each block is block duration * rewards per second diff --git a/x/incentive/keeper/rewards_supply_test.go b/x/incentive/keeper/rewards_supply_test.go index eb527775..fef7ba54 100644 --- a/x/incentive/keeper/rewards_supply_test.go +++ b/x/incentive/keeper/rewards_supply_test.go @@ -48,9 +48,10 @@ func (suite *SupplyIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin incentBuilder := testutil.NewIncentiveGenesisBuilder(). WithGenesisTime(suite.genesisTime). - WithMultipliers(types.Multipliers{ - types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier - }). + WithMultipliers(types.MultipliersPerDenom{{ + Denom: "hard", + Multipliers: types.Multipliers{types.NewMultiplier(types.Large, 12, d("1.0"))}, // keep payout at 1.0 to make maths easier + }}). WithSimpleSupplyRewardPeriod("bnb", cs(c("hard", 1e6))) // only borrow rewards suite.StartChain( @@ -79,7 +80,7 @@ func (suite *SupplyIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin suite.NextBlockAfter(1e6 * time.Second) // about 12 days // User claims all their rewards - suite.NoError(suite.DeliverIncentiveMsg(types.NewMsgClaimHardReward(userA, "large", nil))) + suite.NoError(suite.DeliverIncentiveMsg(types.NewMsgClaimHardReward(userA, types.NewSelection("hard", "large")))) // The users has always had 100% of deposits, so they should receive all rewards for the previous two blocks. // Total rewards for each block is block duration * rewards per second diff --git a/x/incentive/keeper/rewards_usdx_test.go b/x/incentive/keeper/rewards_usdx_test.go index a7c5e8a4..e805b1bc 100644 --- a/x/incentive/keeper/rewards_usdx_test.go +++ b/x/incentive/keeper/rewards_usdx_test.go @@ -58,9 +58,10 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncing( incentBuilder := testutil.NewIncentiveGenesisBuilder(). WithGenesisTime(suite.genesisTime). - WithMultipliers(types.Multipliers{ - types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier - }). + WithMultipliers(types.MultipliersPerDenom{{ + Denom: types.USDXMintingRewardDenom, + Multipliers: types.Multipliers{types.NewMultiplier(types.Large, 12, d("1.0"))}, // keep payout at 1.0 to make maths easier + }}). WithSimpleUSDXRewardPeriod("bnb-a", c(types.USDXMintingRewardDenom, 1e6)) suite.StartChain( @@ -116,9 +117,10 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsWithoutSyncin incentBuilder := testutil.NewIncentiveGenesisBuilder(). WithGenesisTime(suite.genesisTime). - WithMultipliers(types.Multipliers{ - types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier - }). + WithMultipliers(types.MultipliersPerDenom{{ + Denom: types.USDXMintingRewardDenom, + Multipliers: types.Multipliers{types.NewMultiplier(types.Large, 12, d("1.0"))}, // keep payout at 1.0 to make maths easier + }}). WithSimpleUSDXRewardPeriod(collateralType, c(types.USDXMintingRewardDenom, 1e6)) suite.StartChain( @@ -162,9 +164,10 @@ func (suite *USDXIntegrationTests) TestReinstatingRewardParamsDoesNotTriggerOver incentBuilder := testutil.NewIncentiveGenesisBuilder(). WithGenesisTime(suite.genesisTime). - WithMultipliers(types.Multipliers{ - types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier - }). + WithMultipliers(types.MultipliersPerDenom{{ + Denom: types.USDXMintingRewardDenom, + Multipliers: types.Multipliers{types.NewMultiplier(types.Large, 12, d("1.0"))}, // keep payout at 1.0 to make maths easier + }}). WithSimpleUSDXRewardPeriod("bnb-a", c(types.USDXMintingRewardDenom, 1e6)) suite.StartChain(