mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 00:05:18 +00:00
fix test setup to use new Multipliers type (#984)
This commit is contained in:
parent
63c8421a81
commit
20560a16d7
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user