Skip to content

Commit

Permalink
add upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 committed Jun 29, 2022
1 parent 1e2b009 commit 77f2d46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ func New(

app.mm.RegisterInvariants(&app.CrisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
app.mm.RegisterServices(module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()))

app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
app.mm.RegisterServices(app.configurator)
// initialize stores
app.MountKVStores(keys)
app.MountTransientStores(tkeys)
Expand Down Expand Up @@ -491,6 +491,9 @@ func New(
app.UpgradeKeeper.SetUpgradeHandler(
"v2",
func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
app.MarketplaceKeeper.SetParams(ctx, marketplacemoduletypes.DefaultParams())
app.MarketplaceKeeper.SetNextAuctionNumber(ctx, 1)

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)
Expand Down
2 changes: 1 addition & 1 deletion x/marketplace/keeper/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (k Keeper) GetNextAuctionNumber(ctx sdk.Context) uint64 {

bz := store.Get(types.PrefixNextAuctionNumber)
if bz == nil {
panic(fmt.Errorf("auction module not initialized -- Should have been done in InitGenesis"))
panic(fmt.Errorf("%s module not initialized -- Should have been done in InitGenesis", types.ModuleName))
} else {
val := gogotypes.UInt64Value{}

Expand Down

0 comments on commit 77f2d46

Please sign in to comment.