-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: umfx denom metadata migration (#103)
- Loading branch information
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package next | ||
|
||
import ( | ||
"context" | ||
|
||
storetypes "cosmossdk.io/store/types" | ||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/types/module" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
|
||
"github.com/liftedinit/manifest-ledger/app/upgrades" | ||
) | ||
|
||
func NewUpgrade() upgrades.Upgrade { | ||
return upgrades.Upgrade{ | ||
UpgradeName: "umfx-denom-metadata", | ||
CreateUpgradeHandler: CreateUpgradeHandler, | ||
StoreUpgrades: storetypes.StoreUpgrades{ | ||
Added: []string{}, | ||
Deleted: []string{}, | ||
}, | ||
} | ||
} | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
keepers *upgrades.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx context.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
metadata := banktypes.Metadata{ | ||
Description: "The Manifest Network token", | ||
DenomUnits: []*banktypes.DenomUnit{ | ||
{ | ||
Denom: "umfx", | ||
Exponent: 0, | ||
Aliases: []string{}, | ||
}, | ||
{ | ||
Denom: "mfx", | ||
Exponent: 6, | ||
Aliases: []string{}, | ||
}, | ||
}, | ||
Base: "umfx", | ||
Display: "MFX", | ||
Symbol: "MFX", | ||
Name: "Manifest Network Token", | ||
} | ||
|
||
// Set the new metadata in the bank keeper | ||
keepers.BankKeeper.SetDenomMetaData(ctx, metadata) | ||
|
||
return mm.RunMigrations(ctx, configurator, fromVM) | ||
} | ||
} |
This file contains 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