Skip to content

Commit

Permalink
feat: add missing upgrade handler
Browse files Browse the repository at this point in the history
Signed-off-by: Riccardo Montagnin <[email protected]>
  • Loading branch information
RiccardoM committed Sep 2, 2022
1 parent 733827d commit be64afd
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
v410 "github.com/desmos-labs/desmos/v4/app/upgrades/v410"
v420 "github.com/desmos-labs/desmos/v4/app/upgrades/v420"
v430 "github.com/desmos-labs/desmos/v4/app/upgrades/v430"
v441 "github.com/desmos-labs/desmos/v4/app/upgrades/v441"

profilesv4 "github.com/desmos-labs/desmos/v4/x/profiles/legacy/v4"

Expand Down Expand Up @@ -1069,6 +1070,7 @@ func (app *DesmosApp) registerUpgradeHandlers() {
app.registerUpgrade(v410.NewUpgrade(app.mm, app.configurator))
app.registerUpgrade(v420.NewUpgrade(app.mm, app.configurator))
app.registerUpgrade(v430.NewUpgrade(app.mm, app.configurator))
app.registerUpgrade(v441.NewUpgrade(app.mm, app.configurator))
}

// registerUpgrade registers the given upgrade to be supported by the app
Expand Down
46 changes: 46 additions & 0 deletions app/upgrades/v441/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package v441

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/desmos-labs/desmos/v4/app/upgrades"
)

var (
_ upgrades.Upgrade = &Upgrade{}
)

// Upgrade represents the v4.3.0 upgrade
type Upgrade struct {
mm *module.Manager
configurator module.Configurator
}

// NewUpgrade returns a new Upgrade instance
func NewUpgrade(mm *module.Manager, configurator module.Configurator) *Upgrade {
return &Upgrade{
mm: mm,
configurator: configurator,
}
}

// Name implements upgrades.Upgrade
func (u *Upgrade) Name() string {
return "v4.4.1"
}

// Handler implements upgrades.Upgrade
func (u *Upgrade) Handler() upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// Do nothing here as we don't have anything particular in this update
return u.mm.RunMigrations(ctx, u.configurator, fromVM)
}
}

// StoreUpgrades implements upgrades.Upgrade
func (u *Upgrade) StoreUpgrades() *storetypes.StoreUpgrades {
return &storetypes.StoreUpgrades{}
}

0 comments on commit be64afd

Please sign in to comment.