-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
2 deletions.
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,15 @@ | ||
package v21 | ||
|
||
import ( | ||
"github.com/cosmos/gaia/v21/app/upgrades" | ||
) | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name. | ||
UpgradeName = "v21" | ||
) | ||
|
||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
} |
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 v21 | ||
|
||
import ( | ||
"context" | ||
|
||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
|
||
"github.com/cosmos/gaia/v21/app/keepers" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
keepers *keepers.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(c context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
ctx := sdk.UnwrapSDKContext(c) | ||
ctx.Logger().Info("Starting module migrations...") | ||
|
||
vm, err := mm.RunMigrations(ctx, configurator, vm) | ||
if err != nil { | ||
return vm, err | ||
} | ||
|
||
ctx.Logger().Info("Upgrade v21 complete") | ||
return vm, nil | ||
} | ||
} |