-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Adds testnet v1rc5 upgrade handler
- Loading branch information
1 parent
5899e59
commit e4cf59c
Showing
3 changed files
with
54 additions
and
9 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
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,39 @@ | ||
package testnet | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
"github.com/babylonlabs-io/babylon/app/keepers" | ||
"github.com/babylonlabs-io/babylon/app/upgrades" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
) | ||
|
||
const ( | ||
UpgradeName = "v1rc5" | ||
) | ||
|
||
func CreateUpgrade() upgrades.Upgrade { | ||
return upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler(), | ||
} | ||
} | ||
|
||
// CreateUpgradeHandler upgrade handler for launch. | ||
func CreateUpgradeHandler() upgrades.UpgradeHandlerCreator { | ||
return func(mm *module.Manager, cfg module.Configurator, keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { | ||
return func(context context.Context, _plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
ctx := sdk.UnwrapSDKContext(context) | ||
|
||
migrations, err := mm.RunMigrations(ctx, cfg, fromVM) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to run migrations: %w", err) | ||
} | ||
|
||
return migrations, nil | ||
} | ||
} | ||
} |