Skip to content

Commit

Permalink
feat(mint): migrate minter params by removing not used key
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux authored and ccamel committed Dec 4, 2023
1 parent 8bae962 commit e62215a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion x/mint/migrations/v3/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func MigrateStore(ctx sdk.Context,

logger.Debug("starting module migration")

logger.Debug("migrate mint params")
logger.Debug("migrate old mint params with new params")

var oldParams oldTypes.Params
d := store.Get(types.ParamsKey)
Expand All @@ -38,6 +38,22 @@ func MigrateStore(ctx sdk.Context,
}
store.Set(types.ParamsKey, bz)

logger.Debug("migrate minter store")

var oldMinter oldTypes.Minter
d = store.Get(types.MinterKey)
err = cdc.Unmarshal(d, &oldMinter)
if err != nil {
return err
}

newMinter := types.NewMinter(oldMinter.Inflation, oldMinter.AnnualProvisions)
bz, err = cdc.Marshal(&newMinter)
if err != nil {
return err
}
store.Set(types.MinterKey, bz)

logger.Debug("module migration done")

return nil
Expand Down

0 comments on commit e62215a

Please sign in to comment.