From 055e323f3bba733ec6eda5a1cda22b403ad8d4fe Mon Sep 17 00:00:00 2001 From: 0xmuralik Date: Thu, 27 Oct 2022 13:54:25 +0530 Subject: [PATCH] randomize bond params --- x/bond/simulation/genesis.go | 4 +++- x/bond/types/genesis.go | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/x/bond/simulation/genesis.go b/x/bond/simulation/genesis.go index 76fdc1b8..a6489b00 100644 --- a/x/bond/simulation/genesis.go +++ b/x/bond/simulation/genesis.go @@ -7,11 +7,13 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cerc-io/laconicd/x/bond/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) // RandomizedGenState generates a random GenesisState func RandomizedGenState(simState *module.SimulationState) { - bondGenesis := types.DefaultGenesisState() + bondParams := types.NewParams(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000))))) + bondGenesis := types.NewGenesisState(bondParams, []*types.Bond{}) bz, err := json.MarshalIndent(bondGenesis, "", " ") if err != nil { diff --git a/x/bond/types/genesis.go b/x/bond/types/genesis.go index 6271b809..1aa9cd4c 100644 --- a/x/bond/types/genesis.go +++ b/x/bond/types/genesis.go @@ -8,3 +8,10 @@ func DefaultGenesisState() *GenesisState { Bonds: []*Bond{}, } } + +func NewGenesisState(params Params, bonds []*Bond) *GenesisState { + return &GenesisState{ + Params: params, + Bonds: bonds, + } +}