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 16 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 x/tokenfactory/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (k Keeper) QueryDenomInfo(
return resp, err
}

bankMetadata, _ := k.bankKeeper.GetDenomMetaData(ctx, denom)
bankMetadata, _ := k.BankKeeper.GetDenomMetaData(ctx, denom)
return &types.QueryDenomInfoResponse{
Admin: tfMetadata.Admin,
Metadata: bankMetadata,
Expand Down
4 changes: 2 additions & 2 deletions x/tokenfactory/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Keeper struct {
Store StoreAPI

// interfaces with other modules
bankKeeper tftypes.BankKeeper
BankKeeper tftypes.BankKeeper
accountKeeper tftypes.AccountKeeper
communityPoolKeeper tftypes.CommunityPoolKeeper

Expand Down Expand Up @@ -61,7 +61,7 @@ func NewKeeper(
bankKeeper: bk,
},
cdc: cdc,
bankKeeper: bk,
BankKeeper: bk,
accountKeeper: ak,
communityPoolKeeper: communityPoolKeeper,
authority: authority,
Expand Down
14 changes: 7 additions & 7 deletions x/tokenfactory/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (k Keeper) mint(
}

coins := sdk.NewCoins(coin)
err := k.bankKeeper.MintCoins(ctx, types.ModuleName, coins)
err := k.BankKeeper.MintCoins(ctx, types.ModuleName, coins)
if err != nil {
return err
}
Expand All @@ -160,12 +160,12 @@ func (k Keeper) mint(
return err
}

if k.bankKeeper.BlockedAddr(mintToAddr) {
if k.BankKeeper.BlockedAddr(mintToAddr) {
return types.ErrBlockedAddress.Wrapf(
"failed to mint to %s", mintToAddr)
}

return k.bankKeeper.SendCoinsFromModuleToAccount(
return k.BankKeeper.SendCoinsFromModuleToAccount(
ctx, types.ModuleName, mintToAddr, coins,
)
}
Expand Down Expand Up @@ -225,19 +225,19 @@ func (k Keeper) burn(
return err
}

if k.bankKeeper.BlockedAddr(burnFromAddr) {
if k.BankKeeper.BlockedAddr(burnFromAddr) {
return types.ErrBlockedAddress.Wrapf(
"failed to burn from %s", burnFromAddr)
}

coins := sdk.NewCoins(coin)
if err = k.bankKeeper.SendCoinsFromAccountToModule(
if err = k.BankKeeper.SendCoinsFromAccountToModule(
ctx, burnFromAddr, types.ModuleName, coins,
); err != nil {
return err
}

return k.bankKeeper.BurnCoins(ctx, types.ModuleName, coins)
return k.BankKeeper.BurnCoins(ctx, types.ModuleName, coins)
}

// SetDenomMetadata: Message handler for the abci.Msg: MsgSetDenomMetadata
Expand Down Expand Up @@ -265,7 +265,7 @@ func (k Keeper) SetDenomMetadata(
)
}

k.bankKeeper.SetDenomMetaData(ctx, txMsg.Metadata)
k.BankKeeper.SetDenomMetaData(ctx, txMsg.Metadata)

return &types.MsgSetDenomMetadataResponse{}, ctx.EventManager().
EmitTypedEvent(&types.EventSetDenomMetadata{
Expand Down
11 changes: 9 additions & 2 deletions x/tokenfactory/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,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)
}
Loading