Skip to content

Commit

Permalink
mv11 handler added
Browse files Browse the repository at this point in the history
  • Loading branch information
cgsingh33 committed May 9, 2023
1 parent 0f9caf7 commit 3cb30f0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ import (
cwasm "github.com/comdex-official/comdex/app/wasm"

tv11 "github.com/comdex-official/comdex/app/upgrades/testnet/v11"
mv11 "github.com/comdex-official/comdex/app/upgrades/mainnet/v11"
)

const (
Expand Down Expand Up @@ -1342,17 +1343,24 @@ func (a *App) ModuleAccountsPermissions() map[string][]string {
}

func (a *App) registerUpgradeHandlers() {
a.UpgradeKeeper.SetUpgradeHandler(
tv11.UpgradeName,
tv11.CreateUpgradeHandlerV11(a.mm, a.configurator),
)
// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
// This will read that value, and execute the preparations for the upgrade.
upgradeInfo, err := a.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
}
if upgradeInfo.Name == tv11.UpgradeName {
a.UpgradeKeeper.SetUpgradeHandler(
tv11.UpgradeName,
tv11.CreateUpgradeHandlerV11(a.mm, a.configurator),
)
} else if upgradeInfo.Name == mv11.UpgradeName {
a.UpgradeKeeper.SetUpgradeHandler(
mv11.UpgradeName,
mv11.CreateUpgradeHandlerV11(a.mm, a.configurator, a.LiquidityKeeper, a.AssetKeeper, a.BankKeeper, a.AccountKeeper, a.Rewardskeeper, a.ICAHostKeeper),
)
}

var storeUpgrades *storetypes.StoreUpgrades

Expand All @@ -1370,6 +1378,10 @@ func upgradeHandlers(upgradeInfo storetypes.UpgradeInfo, a *App, storeUpgrades *
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{ibchookstypes.StoreKey},
}
case upgradeInfo.Name == mv11.UpgradeName && !a.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height):
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{ibchookstypes.StoreKey},
}
}
return storeUpgrades
}
2 changes: 1 addition & 1 deletion app/upgrades/mainnet/v11/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func RefundFeeForAccidentallyCreatedPirToOwner(
}
}

func CreateUpgradeHandlerV10(
func CreateUpgradeHandlerV11(
mm *module.Manager,
configurator module.Configurator,
liquidityKeeper liquiditykeeper.Keeper,
Expand Down

0 comments on commit 3cb30f0

Please sign in to comment.