-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2982 from irisnet/feat/v4-upgrade-plan
feat: add v4 upgrade plan
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package v400 | ||
|
||
import ( | ||
"context" | ||
|
||
storetypes "cosmossdk.io/store/types" | ||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
|
||
"github.com/irisnet/irishub/v4/app/upgrades" | ||
) | ||
|
||
// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal | ||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: "v4.0.0", | ||
UpgradeHandlerConstructor: upgradeHandlerConstructor, | ||
StoreUpgrades: &storetypes.StoreUpgrades{}, | ||
} | ||
|
||
func upgradeHandlerConstructor( | ||
m *module.Manager, | ||
c module.Configurator, | ||
box upgrades.Toolbox, | ||
) upgradetypes.UpgradeHandler { | ||
return func(context context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
ctx := sdk.UnwrapSDKContext(context) | ||
ctx.Logger().Info("execute a upgrade plan...") | ||
return box.ModuleManager.RunMigrations(ctx, c, fromVM) | ||
} | ||
} |