fix test setup to use new Multipliers type (#984)

This commit is contained in:
Ruaridh 2021-08-04 19:02:59 +01:00 committed by GitHub
parent 63c8421a81
commit 20560a16d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 17 deletions

View File

@ -48,9 +48,10 @@ func (suite *BorrowIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
incentBuilder := testutil.NewIncentiveGenesisBuilder(). incentBuilder := testutil.NewIncentiveGenesisBuilder().
WithGenesisTime(suite.genesisTime). WithGenesisTime(suite.genesisTime).
WithMultipliers(types.Multipliers{ WithMultipliers(types.MultipliersPerDenom{{
types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier 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 WithSimpleBorrowRewardPeriod("bnb", cs(c("hard", 1e6))) // only borrow rewards
suite.StartChain( suite.StartChain(
@ -78,7 +79,7 @@ func (suite *BorrowIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
suite.NextBlockAfter(1e6 * time.Second) // about 12 days suite.NextBlockAfter(1e6 * time.Second) // about 12 days
// User claims all their rewards // 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. // 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 // Total rewards for each block is block duration * rewards per second

View File

@ -48,9 +48,10 @@ func (suite *SupplyIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
incentBuilder := testutil.NewIncentiveGenesisBuilder(). incentBuilder := testutil.NewIncentiveGenesisBuilder().
WithGenesisTime(suite.genesisTime). WithGenesisTime(suite.genesisTime).
WithMultipliers(types.Multipliers{ WithMultipliers(types.MultipliersPerDenom{{
types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier 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 WithSimpleSupplyRewardPeriod("bnb", cs(c("hard", 1e6))) // only borrow rewards
suite.StartChain( suite.StartChain(
@ -79,7 +80,7 @@ func (suite *SupplyIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncin
suite.NextBlockAfter(1e6 * time.Second) // about 12 days suite.NextBlockAfter(1e6 * time.Second) // about 12 days
// User claims all their rewards // 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. // 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 // Total rewards for each block is block duration * rewards per second

View File

@ -58,9 +58,10 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsAfterSyncing(
incentBuilder := testutil.NewIncentiveGenesisBuilder(). incentBuilder := testutil.NewIncentiveGenesisBuilder().
WithGenesisTime(suite.genesisTime). WithGenesisTime(suite.genesisTime).
WithMultipliers(types.Multipliers{ WithMultipliers(types.MultipliersPerDenom{{
types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier 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)) WithSimpleUSDXRewardPeriod("bnb-a", c(types.USDXMintingRewardDenom, 1e6))
suite.StartChain( suite.StartChain(
@ -116,9 +117,10 @@ func (suite *USDXIntegrationTests) TestSingleUserAccumulatesRewardsWithoutSyncin
incentBuilder := testutil.NewIncentiveGenesisBuilder(). incentBuilder := testutil.NewIncentiveGenesisBuilder().
WithGenesisTime(suite.genesisTime). WithGenesisTime(suite.genesisTime).
WithMultipliers(types.Multipliers{ WithMultipliers(types.MultipliersPerDenom{{
types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier 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)) WithSimpleUSDXRewardPeriod(collateralType, c(types.USDXMintingRewardDenom, 1e6))
suite.StartChain( suite.StartChain(
@ -162,9 +164,10 @@ func (suite *USDXIntegrationTests) TestReinstatingRewardParamsDoesNotTriggerOver
incentBuilder := testutil.NewIncentiveGenesisBuilder(). incentBuilder := testutil.NewIncentiveGenesisBuilder().
WithGenesisTime(suite.genesisTime). WithGenesisTime(suite.genesisTime).
WithMultipliers(types.Multipliers{ WithMultipliers(types.MultipliersPerDenom{{
types.NewMultiplier(types.MultiplierName("large"), 12, d("1.0")), // keep payout at 1.0 to make maths easier 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)) WithSimpleUSDXRewardPeriod("bnb-a", c(types.USDXMintingRewardDenom, 1e6))
suite.StartChain( suite.StartChain(