mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 10:05:18 +00:00
use collateral params from cdp state (#550)
This commit is contained in:
parent
ba3b353ee9
commit
a44068d08d
@ -10,18 +10,28 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/types/module"
|
"github.com/cosmos/cosmos-sdk/types/module"
|
||||||
"github.com/cosmos/cosmos-sdk/x/simulation"
|
"github.com/cosmos/cosmos-sdk/x/simulation"
|
||||||
|
|
||||||
|
"github.com/kava-labs/kava/x/cdp"
|
||||||
"github.com/kava-labs/kava/x/incentive/types"
|
"github.com/kava-labs/kava/x/incentive/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CollateralDenoms = [3]string{"bnb", "xrp", "btc"}
|
CollateralDenoms = []string{}
|
||||||
RewardDenom = "ukava"
|
RewardDenom = "ukava"
|
||||||
MaxTotalAssetReward = sdk.NewInt(1000000000)
|
MaxTotalAssetReward = sdk.NewInt(1000000000)
|
||||||
)
|
)
|
||||||
|
|
||||||
// RandomizedGenState generates a random GenesisState for incentive module
|
// RandomizedGenState generates a random GenesisState for incentive module
|
||||||
func RandomizedGenState(simState *module.SimulationState) {
|
func RandomizedGenState(simState *module.SimulationState) {
|
||||||
|
|
||||||
|
// Get collateral asset denoms from existing CDP genesis state and pass to incentive params
|
||||||
|
var cdpGenesis cdp.GenesisState
|
||||||
|
simState.Cdc.MustUnmarshalJSON(simState.GenState[cdp.ModuleName], &cdpGenesis)
|
||||||
|
for _, collateral := range cdpGenesis.Params.CollateralParams {
|
||||||
|
CollateralDenoms = append(CollateralDenoms, collateral.Denom)
|
||||||
|
}
|
||||||
params := genParams(simState.Rand)
|
params := genParams(simState.Rand)
|
||||||
|
|
||||||
|
// Generate random reward and claim periods
|
||||||
rewardPeriods := genRewardPeriods(simState.Rand, simState.GenTimestamp, params.Rewards)
|
rewardPeriods := genRewardPeriods(simState.Rand, simState.GenTimestamp, params.Rewards)
|
||||||
claimPeriods := genClaimPeriods(rewardPeriods)
|
claimPeriods := genClaimPeriods(rewardPeriods)
|
||||||
claimPeriodIDs := genNextClaimPeriodIds(claimPeriods)
|
claimPeriodIDs := genNextClaimPeriodIds(claimPeriods)
|
||||||
|
Loading…
Reference in New Issue
Block a user