Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(sims): Add sims function for token factory module #1802

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ func (app *NibiruApp) initAppModules(
app.DevGasKeeper, app.AccountKeeper,
app.GetSubspace(devgastypes.ModuleName)),
tokenfactory.NewAppModule(
app.TokenFactoryKeeper, app.AccountKeeper,
app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper,
),

crisis.NewAppModule(&app.crisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
Expand Down
14 changes: 12 additions & 2 deletions x/tokenfactory/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,20 @@ type AppModule struct {
AppModuleBasic
keeper keeper.Keeper
ak authkeeper.AccountKeeper
bk types.BankKeeper
}

// NewAppModule creates a new AppModule Object
func NewAppModule(
k keeper.Keeper,
ak authkeeper.AccountKeeper,
bk types.BankKeeper,
) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{},
keeper: k,
ak: ak,
bk: bk,
}
}

Expand Down Expand Up @@ -177,16 +180,23 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc sdkcodec.JSONCodec) json.
return cdc.MustMarshalJSON(gs)
}

// AppModuleSimulation functions

// GenerateGenesisState implements module.AppModuleSimulation.
func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
simulation.RandomizedGenState(simState)
}

// ProposalMsgs returns msgs used for governance proposals for simulations.
func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
return simulation.ProposalMsgs()
}

// RegisterStoreDecoder implements module.AppModuleSimulation.
func (AppModule) RegisterStoreDecoder(sdk.StoreDecoderRegistry) {
}

// WeightedOperations implements module.AppModuleSimulation.
func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return []simtypes.WeightedOperation{}
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
return simulation.WeightedOperations(&simState, am.keeper, am.ak, am.bk)
}
1 change: 1 addition & 0 deletions x/tokenfactory/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (s *ModuleTestSuite) TestAppModule() {
appModule := module.NewAppModule(
bapp.TokenFactoryKeeper,
bapp.AccountKeeper,
bapp.BankKeeper,
)

s.NotPanics(func() {
Expand Down
Loading