fix: simulations for custom modules' genesis params #43

Merged
0xmuralik merged 5 commits from murali/simulation_genesis into main 2022-11-01 05:10:17 +00:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 055e323f3b - Show all commits

View File

@ -7,11 +7,13 @@ import (
"github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/types/module"
"github.com/cerc-io/laconicd/x/bond/types" "github.com/cerc-io/laconicd/x/bond/types"
sdk "github.com/cosmos/cosmos-sdk/types"
) )
// RandomizedGenState generates a random GenesisState // RandomizedGenState generates a random GenesisState
func RandomizedGenState(simState *module.SimulationState) { 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, "", " ") bz, err := json.MarshalIndent(bondGenesis, "", " ")
if err != nil { if err != nil {

View File

@ -8,3 +8,10 @@ func DefaultGenesisState() *GenesisState {
Bonds: []*Bond{}, Bonds: []*Bond{},
} }
} }
func NewGenesisState(params Params, bonds []*Bond) *GenesisState {
return &GenesisState{
Params: params,
Bonds: bonds,
}
}