Skip to content

Commit

Permalink
add upgrade handler for v1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
go7066 committed Feb 6, 2023
1 parent d4e2027 commit 13752ae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/TERITORI/teritori-chain/app/upgrades"
v130 "github.com/TERITORI/teritori-chain/app/upgrades/v130"
v131 "github.com/TERITORI/teritori-chain/app/upgrades/v131"
airdrop "github.com/TERITORI/teritori-chain/x/airdrop"
airdropkeeper "github.com/TERITORI/teritori-chain/x/airdrop/keeper"
airdroptypes "github.com/TERITORI/teritori-chain/x/airdrop/types"
Expand Down Expand Up @@ -180,7 +181,7 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v130.Upgrade}
Upgrades = []upgrades.Upgrade{v130.Upgrade, v131.Upgrade}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
Expand Down
20 changes: 20 additions & 0 deletions app/upgrades/v131/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v131

import (
store "github.com/cosmos/cosmos-sdk/store/types"

"github.com/TERITORI/teritori-chain/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v1.3.1"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{},
},
}
18 changes: 18 additions & 0 deletions app/upgrades/v131/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v131

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, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("start to run module migrations...")

return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 13752ae

Please sign in to comment.