Skip to content

Commit

Permalink
chore: add v014 upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
angelorc committed Feb 7, 2023
1 parent 5075506 commit e5847ac
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package app
import (
"fmt"
v013 "github.com/bitsongofficial/go-bitsong/app/upgrades/v013"
v014 "github.com/bitsongofficial/go-bitsong/app/upgrades/v014"
"strings"

v010 "github.com/bitsongofficial/go-bitsong/app/upgrades/v010"
Expand Down Expand Up @@ -843,6 +844,15 @@ func (app *BitsongApp) setupUpgradeStoreLoaders() {
// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

// v14 Upgrade
if upgradeInfo.Name == v014.UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
storeUpgrades := store.StoreUpgrades{}

// configure store loader that checks if version == upgradeHeight and applies store upgrades
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades))
}

}

func (app *BitsongApp) setupUpgradeHandlers() {
Expand All @@ -860,6 +870,11 @@ func (app *BitsongApp) setupUpgradeHandlers() {
v013.UpgradeName,
v013.CreateUpgradeHandler(app.mm, app.configurator, &app.wasmKeeper),
)

app.UpgradeKeeper.SetUpgradeHandler(
v014.UpgradeName,
v014.CreateUpgradeHandler(app.mm, app.configurator),
)
}

// RegisterSwaggerAPI registers swagger route with API Server
Expand Down
5 changes: 5 additions & 0 deletions app/upgrades/v014/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v014

const (
UpgradeName = "v014"
)
13 changes: 13 additions & 0 deletions app/upgrades/v014/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package v014

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

func CreateUpgradeHandler(mm *module.Manager, configurator module.Configurator) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit e5847ac

Please sign in to comment.