randomize bond params

This commit is contained in:
0xmuralik 2022-10-27 13:54:25 +05:30
parent 9ea31b81f5
commit 055e323f3b
2 changed files with 10 additions and 1 deletions

View File

@ -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 {

View File

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