Skip to content

Commit

Permalink
Merge pull request #383 from comdex-official/testnet-3
Browse files Browse the repository at this point in the history
upgrade for testnet 3
  • Loading branch information
dheerajkd30 authored Aug 5, 2022
2 parents 9d2fe3f + 4e3412e commit 322d605
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ import (

tv1_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v1_0_0"
tv2_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v2_0_0"
tv3_0_0 "github.com/comdex-official/comdex/app/upgrades/testnet/v3_0_0"
)

const (
Expand Down Expand Up @@ -1134,8 +1135,8 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
func (a *App) registerUpgradeHandlers() {

a.UpgradeKeeper.SetUpgradeHandler(
tv2_0_0.UpgradeNameV2,
tv2_0_0.CreateUpgradeHandlerV2(a.mm, a.configurator),
tv3_0_0.UpgradeName,
tv3_0_0.CreateUpgradeHandler(a.mm, a.configurator),
)

// When a planned update height is reached, the old binary will panic
Expand Down Expand Up @@ -1194,6 +1195,7 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades *
icahosttypes.StoreKey,
},
}
case upgradeInfo.Name == tv3_0_0.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
}
return storeUpgrades
}
15 changes: 15 additions & 0 deletions app/upgrades/testnet/v3_0_0/contstants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package v3_0_0

const (
UpgradeName = "v3.0.0"
UpgradeHeight = "" // replace this height
UpgradeInfo = `'{
"binaries": {
"darwin/arm64":"",
"darwin/x86_64":"",
"linux/arm64":"",
"linux/x86_64":"",
"windows/x86_64":""
}
}'`
)
22 changes: 22 additions & 0 deletions app/upgrades/testnet/v3_0_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v3_0_0

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

// CreateUpgradeHandler creates an SDK upgrade handler for v3_0_0
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
newVM, err := mm.RunMigrations(ctx, configurator, fromVM)

if err != nil {
return newVM, err
}
return newVM, err
}
}

0 comments on commit 322d605

Please sign in to comment.