Created
July 5, 2022 01:09
-
-
Save zeroFruit/f0dbf61bf1843d4766b47eb4d0acb400 to your computer and use it in GitHub Desktop.
Cosmos Dev Series: Cosmos-SDK-based Blockchain Upgrade - x/foo migration handler
This file contains hidden or 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
package keeper // migrations.go | |
type Migrator struct { | |
keeper Keeper | |
} | |
func NewMigrator(keeper Keeper) Migrator { | |
return Migrator{keeper: keeper} | |
} | |
func (m Migrator) Migrate1to2(ctx sdk.Context) error { | |
if err := v2.UpdateParams(ctx, &m.keeper.paramstore); err != nil { | |
return err | |
} | |
return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment