Skip to content

Commit

Permalink
update mt module
Browse files Browse the repository at this point in the history
  • Loading branch information
avery committed Oct 30, 2024
1 parent 09ff039 commit d469f37
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion modules/mt/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand Down
3 changes: 2 additions & 1 deletion modules/mt/keeper/mt.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

errorsmod "cosmossdk.io/errors"
storetypes "cosmossdk.io/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

Expand Down Expand Up @@ -45,7 +46,7 @@ func (k Keeper) GetMT(ctx sdk.Context, denomID, mtID string) (mt exported.MT, er
func (k Keeper) GetMTs(ctx sdk.Context, denomID string) (mts []exported.MT) {
store := ctx.KVStore(k.storeKey)

iterator := sdk.KVStorePrefixIterator(store, types.KeyMT(denomID, ""))
iterator := storetypes.KVStorePrefixIterator(store, types.KeyMT(denomID, ""))
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var baseMT types.MT
Expand Down
10 changes: 1 addition & 9 deletions modules/mt/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,6 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
// ConsensusVersion implements AppModule/ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 { return 1 }

// BeginBlock performs a no-op.
func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {}

// EndBlock returns the end blocker for the MT module. It returns no validator updates.
func (AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate {
return []abci.ValidatorUpdate{}
}

// ____________________________________________________________________________

// AppModuleSimulation functions
Expand All @@ -166,7 +158,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) {
}

// RegisterStoreDecoder registers a decoder for MT module's types
func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) {
sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc)
}

Expand Down
4 changes: 2 additions & 2 deletions modules/mt/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ func RandomizedGenState(simState *module.SimulationState) {
}

accs := simState.Accounts[:accLen]
simState.AppParams.GetOrGenerate(simState.Cdc, "mt", &collections, simState.Rand,
simState.AppParams.GetOrGenerate("mt", &collections, simState.Rand,
func(r *rand.Rand) {
collections = genCollections(r, accs)
},
)

simState.AppParams.GetOrGenerate(simState.Cdc, "mt", &owners, simState.Rand,
simState.AppParams.GetOrGenerate("mt", &owners, simState.Rand,
func(r *rand.Rand) {
owners = genOwners(r, collections, accs)
},
Expand Down
24 changes: 12 additions & 12 deletions modules/mt/simulation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,41 +36,41 @@ func WeightedOperations(
var weightIssueDenom, weightMint, weightEdit, weightBurn, weightTransfer, weightTransferDenom int

appParams.GetOrGenerate(
cdc, OpWeightMsgIssueDenom, &weightIssueDenom, nil,
OpWeightMsgIssueDenom, &weightIssueDenom, nil,
func(_ *rand.Rand) {
weightIssueDenom = 50
},
)

appParams.GetOrGenerate(
cdc, OpWeightMsgMintMT, &weightMint, nil,
OpWeightMsgMintMT, &weightMint, nil,
func(_ *rand.Rand) {
weightMint = 100
},
)

appParams.GetOrGenerate(
cdc, OpWeightMsgEditMT, &weightEdit, nil,
OpWeightMsgEditMT, &weightEdit, nil,
func(_ *rand.Rand) {
weightEdit = 50
},
)

appParams.GetOrGenerate(
cdc, OpWeightMsgTransferMT, &weightTransfer, nil,
OpWeightMsgTransferMT, &weightTransfer, nil,
func(_ *rand.Rand) {
weightTransfer = 50
},
)

appParams.GetOrGenerate(
cdc, OpWeightMsgBurnMT, &weightBurn, nil,
OpWeightMsgBurnMT, &weightBurn, nil,
func(_ *rand.Rand) {
weightBurn = 10
},
)
appParams.GetOrGenerate(
cdc, OpWeightMsgTransferDenom, &weightTransferDenom, nil,
OpWeightMsgTransferDenom, &weightTransferDenom, nil,
func(_ *rand.Rand) {
weightTransferDenom = 10
},
Expand Down Expand Up @@ -170,7 +170,7 @@ func SimulateMsgIssueDenom(
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down Expand Up @@ -265,7 +265,7 @@ func SimulateMsgMintMT(k keeper.Keeper, ak mt.AccountKeeper, bk mt.BankKeeper) s
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down Expand Up @@ -353,7 +353,7 @@ func SimulateMsgEditMT(k keeper.Keeper, ak mt.AccountKeeper, bk mt.BankKeeper) s
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down Expand Up @@ -458,7 +458,7 @@ func SimulateMsgTransferMT(
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down Expand Up @@ -542,7 +542,7 @@ func SimulateMsgBurnMT(k keeper.Keeper, ak mt.AccountKeeper, bk mt.BankKeeper) s
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down Expand Up @@ -632,7 +632,7 @@ func SimulateMsgTransferDenom(
), nil, err
}

return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil
return simtypes.NewOperationMsg(msg, true, ""), nil, nil
}
}

Expand Down

0 comments on commit d469f37

Please sign in to comment.