Skip to content

Commit

Permalink
fix: upgrade fw
Browse files Browse the repository at this point in the history
  • Loading branch information
fmorency committed Nov 25, 2024
1 parent 140487a commit 4074bc6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 67 deletions.
8 changes: 2 additions & 6 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,14 @@ import (

"github.com/liftedinit/manifest-ledger/app/upgrades"
"github.com/liftedinit/manifest-ledger/app/upgrades/next"
"github.com/liftedinit/manifest-ledger/app/upgrades/noop"
)

// Upgrades list of chain upgrades
var Upgrades = []upgrades.Upgrade{next.NewUpgrade()}
var Upgrades []upgrades.Upgrade

// RegisterUpgradeHandlers registers the chain upgrade handlers
func (app *ManifestApp) RegisterUpgradeHandlers() {
if len(Upgrades) == 0 {
// always have a unique upgrade registered for the current version to test in system tests
Upgrades = append(Upgrades, noop.NewUpgrade(app.Version()))
}
Upgrades = append(Upgrades, next.NewUpgrade(app.Version()))

keepers := upgrades.AppKeepers{AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper}
// register all upgrade handlers
Expand Down
30 changes: 3 additions & 27 deletions app/upgrades/next/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import (
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 {
func NewUpgrade(name string) upgrades.Upgrade {
return upgrades.Upgrade{
UpgradeName: "umfx-denom-metadata",
UpgradeName: name,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{},
Expand All @@ -26,32 +25,9 @@ func NewUpgrade() upgrades.Upgrade {
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *upgrades.AppKeepers,
_ *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)
}
}
34 changes: 0 additions & 34 deletions app/upgrades/noop/upgrades.go

This file was deleted.

0 comments on commit 4074bc6

Please sign in to comment.