Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chain upgrade handler v6.5.0 #474

Merged
merged 1 commit into from
Mar 26, 2024
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
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank"

"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades/v6_4_91"
"github.com/notional-labs/composable/v6/app/upgrades/v6_5_0"

// bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

Expand Down Expand Up @@ -147,7 +147,7 @@ var (
// https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34
EnableSpecificProposals = ""

Upgrades = []upgrades.Upgrade{v6_4_91.Upgrade}
Upgrades = []upgrades.Upgrade{v6_5_0.Upgrade}
Forks = []upgrades.Fork{}
)

Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@

appKeepers.StakingMiddlewareKeeper = stakingmiddleware.NewKeeper(appCodec, appKeepers.keys[stakingmiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String())
appKeepers.IbcTransferMiddlewareKeeper = ibctransfermiddleware.NewKeeper(appCodec, appKeepers.keys[ibctransfermiddlewaretypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String(),
[]string{"centauri1ay9y5uns9khw2kzaqr3r33v2pkuptfnnr93j5j",

Check failure on line 199 in app/keepers/keepers.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
"centauri14lz7gaw92valqjearnye4shex7zg2p05mlx9q0",
"centauri1r2zlh2xn85v8ljmwymnfrnsmdzjl7k6w6lytan",
"centauri10556m38z4x6pqalr9rl5ytf3cff8q46nk85k9m",

"centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9",
// "centauri1wkjvpgkuchq0r8425g4z4sf6n85zj5wtmqzjv9",

// "centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs",
})
Expand Down
21 changes: 21 additions & 0 deletions app/upgrades/v6_5_0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v6_5_0

import (
store "github.com/cosmos/cosmos-sdk/store/types"
"github.com/notional-labs/composable/v6/app/upgrades"
ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types"
)

const (
// UpgradeName defines the on-chain upgrade name for the composable upgrade.
UpgradeName = "v6_5_0"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{ibctransfermiddleware.StoreKey},
Deleted: []string{},
},
}
47 changes: 47 additions & 0 deletions app/upgrades/v6_5_0/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package v6_5_0

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/notional-labs/composable/v6/app/keepers"
"github.com/notional-labs/composable/v6/app/upgrades"
ibctransfermiddleware "github.com/notional-labs/composable/v6/x/ibctransfermiddleware/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ upgrades.BaseAppParamManager,
_ codec.Codec,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
custommiddlewareparams := ibctransfermiddleware.DefaultGenesisState()
keepers.IbcTransferMiddlewareKeeper.SetParams(ctx, custommiddlewareparams.Params)

// remove broken proposals
BrokenProposals := [3]uint64{2, 6, 11}
for _, proposal_id := range BrokenProposals {
_, ok := keepers.GovKeeper.GetProposal(ctx, proposal_id)
if ok {
keepers.GovKeeper.DeleteProposal(ctx, proposal_id)
}

}

// burn extra ppica in escrow account
// this ppica is unused because it is a native token stored in escrow account
// it was unnecessarily minted to match pica escrowed on picasso to ppica minted
// in genesis, to make initial native ppica transferrable to picasso
amount, ok := sdk.NewIntFromString("1066669217167120000000")
if ok {
coins := sdk.Coins{sdk.NewCoin("ppica", amount)}
keepers.BankKeeper.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32("centauri12k2pyuylm9t7ugdvz67h9pg4gmmvhn5vmvgw48"), "gov", coins)
keepers.BankKeeper.BurnCoins(ctx, "gov", coins)
}
return mm.RunMigrations(ctx, configurator, vm)
}
}
Loading