Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: migration handler for v2.2 #775

Merged
merged 4 commits into from
Feb 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/stable_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package app

import (
"encoding/json"
"fmt"

abci "github.com/tendermint/tendermint/abci/types"

Expand Down Expand Up @@ -87,6 +88,20 @@ func (app *RegenApp) registerUpgradeHandlers() {
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

upgradeV22xName := "v2.2-upgrade"
app.UpgradeKeeper.SetUpgradeHandler(upgradeV22xName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// get the params
ecoParams, ok := app.ParamsKeeper.GetSubspace(ecocredittypes.ModuleName)
if !ok {
panic(fmt.Sprintf("unable to upgrade: subspace %s not found", ecocredittypes.ModuleName))
}

// set basket creation fee to 1,0000 REGEN
ecoParams.Set(ctx, ecocredittypes.KeyBasketCreationFee, sdk.NewCoins(sdk.NewInt64Coin("uregen", 1e9)))

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(err)
Expand Down