package asset import ( "math/rand" "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" "planetmint-go/testutil/sample" assetsimulation "planetmint-go/x/asset/simulation" "planetmint-go/x/asset/types" ) // avoid unused import issue var ( _ = sample.AccAddress _ = assetsimulation.FindAccount _ = simulation.MsgEntryKind _ = baseapp.Paramspace _ = rand.Rand{} ) const ( opWeightMsgNotarizeAsset = "op_weight_msg_notarize_asset" // TODO: Determine the simulation weight value defaultWeightMsgNotarizeAsset int = 100 // this line is used by starport scaffolding # simapp/module/const ) // GenerateGenesisState creates a randomized GenState of the module. func (AppModule) GenerateGenesisState(simState *module.SimulationState) { accs := make([]string, len(simState.Accounts)) for i, acc := range simState.Accounts { accs[i] = acc.Address.String() } assetGenesis := types.GenesisState{ Params: types.DefaultParams(), // this line is used by starport scaffolding # simapp/module/genesisState } simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&assetGenesis) } // RegisterStoreDecoder registers a decoder. func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { // Implement if needed } // ProposalContents doesn't return any content functions for governance proposals. func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return nil } // WeightedOperations returns the all the gov module operations with their respective weights. func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { operations := make([]simtypes.WeightedOperation, 0) var weightMsgNotarizeAsset int simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgNotarizeAsset, &weightMsgNotarizeAsset, nil, func(_ *rand.Rand) { weightMsgNotarizeAsset = defaultWeightMsgNotarizeAsset }, ) operations = append(operations, simulation.NewWeightedOperation( weightMsgNotarizeAsset, assetsimulation.SimulateMsgNotarizeAsset(am.accountKeeper, am.bankKeeper, am.keeper), )) // this line is used by starport scaffolding # simapp/module/operation return operations } // ProposalMsgs returns msgs used for governance proposals for simulations. func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { return []simtypes.WeightedProposalMsg{ simulation.NewWeightedProposalMsg( opWeightMsgNotarizeAsset, defaultWeightMsgNotarizeAsset, func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { assetsimulation.SimulateMsgNotarizeAsset(am.accountKeeper, am.bankKeeper, am.keeper) return nil }, ), // this line is used by starport scaffolding # simapp/module/OpMsg } }