-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #474 from ComposableFi/rustdev/upgrade-handler-v6.5.0
add chain upgrade handler v6.5.0
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 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,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{}, | ||
}, | ||
} |
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,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) | ||
} | ||
} |