2022-10-27 07:14:59 +00:00
|
|
|
package simulation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
2022-10-27 08:38:21 +00:00
|
|
|
"time"
|
2022-10-27 07:14:59 +00:00
|
|
|
|
|
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
|
|
|
|
|
|
"github.com/cerc-io/laconicd/x/nameservice/types"
|
2022-10-27 08:38:21 +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:38:21 +00:00
|
|
|
nameserviceParams := types.NewParams(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
|
|
|
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
|
|
|
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
|
|
|
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
|
|
|
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
|
|
|
false,
|
|
|
|
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
|
|
|
time.Duration(simState.Rand.Intn(1000))*time.Second,
|
|
|
|
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
|
|
|
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
|
|
|
sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(int64(simState.Rand.Intn(10000000000)))),
|
|
|
|
)
|
|
|
|
|
|
|
|
nameserviceGenesis := types.NewGenesisState(nameserviceParams, []types.Record{}, []types.AuthorityEntry{}, []types.NameEntry{})
|
2022-10-27 07:14:59 +00:00
|
|
|
|
|
|
|
bz, err := json.MarshalIndent(nameserviceGenesis, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
fmt.Printf("Selected randomly generated %s parameters:\n%s\n", types.ModuleName, bz)
|
|
|
|
|
2022-10-27 08:38:21 +00:00
|
|
|
simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&nameserviceGenesis)
|
2022-10-27 07:14:59 +00:00
|
|
|
}
|