diff --git a/app/app.go b/app/app.go index 12a09441..c34f55ff 100644 --- a/app/app.go +++ b/app/app.go @@ -116,6 +116,7 @@ import ( evmante "swisstronik/app/ante" "swisstronik/app/upgrades/v1_0_3" + "swisstronik/app/upgrades/v1_0_4" "swisstronik/docs" "swisstronik/encoding" srvflags "swisstronik/server/flags" @@ -1063,6 +1064,13 @@ func (app *App) setupUpgradeHandlers() { ), ) + app.UpgradeKeeper.SetUpgradeHandler( + v1_0_4.UpgradeName, + v1_0_4.CreateUpgradeHandler( + app.mm, app.configurator, + ), + ) + // When a planned update height is reached, the old binary will panic // writing on disk the height and name of the update that triggered it // This will read that value, and execute the preparations for the upgrade. diff --git a/app/upgrades/v1_0_4/constants.go b/app/upgrades/v1_0_4/constants.go new file mode 100644 index 00000000..2358672e --- /dev/null +++ b/app/upgrades/v1_0_4/constants.go @@ -0,0 +1,5 @@ +package v1_0_4 + +const ( + UpgradeName = "v1.0.4" +) diff --git a/app/upgrades/v1_0_4/upgrades.go b/app/upgrades/v1_0_4/upgrades.go new file mode 100644 index 00000000..4f50d59a --- /dev/null +++ b/app/upgrades/v1_0_4/upgrades.go @@ -0,0 +1,24 @@ +package v1_0_4 + +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, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx.Logger().Info("Starting module migrations...") + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + ctx.Logger().Info("Upgrade complete") + return vm, err + } +}