Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import (
"github.com/noble-assets/noble/v12/api"
"github.com/noble-assets/noble/v12/jester"
"github.com/noble-assets/noble/v12/upgrade"
"github.com/noble-assets/noble/v12/upgrade/v12alpha2"
"github.com/spf13/cast"

_ "cosmossdk.io/x/evidence"
Expand Down Expand Up @@ -478,6 +479,14 @@ func (app *App) RegisterUpgradeHandler() error {
app.HyperlaneKeeper.IsmKeeper,
),
)
app.UpgradeKeeper.SetUpgradeHandler(
v12alpha2.UpgradeName,
v12alpha2.CreateUpgradeHandler(
app.ModuleManager,
app.Configurator(),
app.FTFKeeper,
),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ modules:
- account: dollar/yield
- account: hyperlane
- account: warp
permissions: [ burner, minter ]
authority: authority # Utilize our custom x/authority module.
- name: authz
config:
Expand Down
23 changes: 23 additions & 0 deletions upgrade/v12alpha2/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2025 NASD Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v12alpha2

// UpgradeName is the name of this specific software upgrade used on-chain.
const UpgradeName = "v12.0.0-alpha.2"

// DevnetChainID is the Chain ID of the Noble devnet.
const DevnetChainID = "duke-1"
57 changes: 57 additions & 0 deletions upgrade/v12alpha2/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2025 NASD Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package v12alpha2

import (
"context"
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"
ftfkeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper"
ftftypes "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authoritytypes "github.com/noble-assets/authority/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
ftfKeeper *ftfkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
chainID := sdk.UnwrapSDKContext(ctx).ChainID()
if chainID != DevnetChainID {
return vm, fmt.Errorf("%s upgrade not allowed to execute on %s chain", UpgradeName, chainID)
}

vm, err := mm.RunMigrations(ctx, cfg, vm)
if err != nil {
return vm, err
}

// Because the paused store was not intialized in the devnet genesis,
// it must be configured here for USDC transfers to be successful.
ftfKeeper.SetPaused(ctx, ftftypes.Paused{Paused: false})

// Because the owner store was not initialized in the devnet genesis,
// it must be configured here for USDC issuance to be successful.
ftfKeeper.SetOwner(ctx, ftftypes.Owner{Address: authoritytypes.ModuleAddress.String()})

return vm, nil
}
}