2022-10-27 07:14:59 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
|
|
|
|
|
|
"github.com/cerc-io/laconicd/x/bond/types"
|
2022-10-27 08:24:25 +00:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2022-10-27 07:14:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// RandomizedGenState generates a random GenesisState
|
|
|
|
func RandomizedGenState(simState *module.SimulationState) {
|
2022-10-27 08:24:25 +00:00
|
|
|
bondParams := types.NewParams(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))))
|
|
|
|
bondGenesis := types.NewGenesisState(bondParams, []*types.Bond{})
|
2022-10-27 07:14:59 +00:00
|
|
|
|
|
|
|
bz, err := json.MarshalIndent(bondGenesis, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
|
|
|
|
|
|
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(bondGenesis)
|
|
|
|
}
|