From fcdbe5d6bdd3787199dd2264fdbbdb92c06cbe6d Mon Sep 17 00:00:00 2001 From: rustdev Date: Thu, 7 Mar 2024 21:50:35 +0000 Subject: [PATCH] create a new chain upgrade handler for chain upgrade. --- app/app.go | 4 ++-- app/upgrades/v6_4_7/constants.go | 21 +++++++++++++++++++++ app/upgrades/v6_4_7/upgrade.go | 23 +++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 app/upgrades/v6_4_7/constants.go create mode 100644 app/upgrades/v6_4_7/upgrade.go diff --git a/app/app.go b/app/app.go index 9f71e5bfe..78be271d3 100644 --- a/app/app.go +++ b/app/app.go @@ -36,7 +36,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/bank" "github.com/notional-labs/composable/v6/app/keepers" - "github.com/notional-labs/composable/v6/app/upgrades/v6_4_6" + "github.com/notional-labs/composable/v6/app/upgrades/v6_4_7" // bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -147,7 +147,7 @@ var ( // https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 EnableSpecificProposals = "" - Upgrades = []upgrades.Upgrade{v6_4_6.Upgrade} + Upgrades = []upgrades.Upgrade{v6_4_7.Upgrade} Forks = []upgrades.Fork{} ) diff --git a/app/upgrades/v6_4_7/constants.go b/app/upgrades/v6_4_7/constants.go new file mode 100644 index 000000000..549c1e41e --- /dev/null +++ b/app/upgrades/v6_4_7/constants.go @@ -0,0 +1,21 @@ +package v6_4_7 + +import ( + store "github.com/cosmos/cosmos-sdk/store/types" + + "github.com/notional-labs/composable/v6/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name for the composable upgrade. + UpgradeName = "v6_4_6" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, + StoreUpgrades: store.StoreUpgrades{ + Added: []string{}, + Deleted: []string{}, + }, +} diff --git a/app/upgrades/v6_4_7/upgrade.go b/app/upgrades/v6_4_7/upgrade.go new file mode 100644 index 000000000..682c58a62 --- /dev/null +++ b/app/upgrades/v6_4_7/upgrade.go @@ -0,0 +1,23 @@ +package v6_4_7 + +import ( + 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/cosmos/cosmos-sdk/codec" + "github.com/notional-labs/composable/v6/app/keepers" + "github.com/notional-labs/composable/v6/app/upgrades" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + _ upgrades.BaseAppParamManager, + _ codec.Codec, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, configurator, vm) + } +}