-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dreamer
committed
Feb 23, 2024
1 parent
39fdf6c
commit 69a320d
Showing
5 changed files
with
169 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
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,42 @@ | ||
package v300 | ||
|
||
const ( | ||
authzMsgExec = "/cosmos.authz.v1beta1.MsgExec" | ||
authzMsgGrant = "/cosmos.authz.v1beta1.MsgGrant" | ||
authzMsgRevoke = "/cosmos.authz.v1beta1.MsgRevoke" | ||
bankMsgSend = "/cosmos.bank.v1beta1.MsgSend" | ||
bankMsgMultiSend = "/cosmos.bank.v1beta1.MsgMultiSend" | ||
distrMsgSetWithdrawAddr = "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress" | ||
distrMsgWithdrawValidatorCommission = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" | ||
distrMsgFundCommunityPool = "/cosmos.distribution.v1beta1.MsgFundCommunityPool" | ||
distrMsgWithdrawDelegatorReward = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward" | ||
feegrantMsgGrantAllowance = "/cosmos.feegrant.v1beta1.MsgGrantAllowance" | ||
feegrantMsgRevokeAllowance = "/cosmos.feegrant.v1beta1.MsgRevokeAllowance" | ||
legacyGovMsgVoteWeighted = "/cosmos.gov.v1beta1.MsgVoteWeighted" | ||
legacyGovMsgSubmitProposal = "/cosmos.gov.v1beta1.MsgSubmitProposal" | ||
legacyGovMsgDeposit = "/cosmos.gov.v1beta1.MsgDeposit" | ||
legacyGovMsgVote = "/cosmos.gov.v1beta1.MsgVote" | ||
govMsgVoteWeighted = "/cosmos.gov.v1.MsgVoteWeighted" | ||
govMsgSubmitProposal = "/cosmos.gov.v1.MsgSubmitProposal" | ||
govMsgDeposit = "/cosmos.gov.v1.MsgDeposit" | ||
govMsgVote = "/cosmos.gov.v1.MsgVote" | ||
stakingMsgEditValidator = "/cosmos.staking.v1beta1.MsgEditValidator" | ||
stakingMsgDelegate = "/cosmos.staking.v1beta1.MsgDelegate" | ||
stakingMsgUndelegate = "/cosmos.staking.v1beta1.MsgUndelegate" | ||
stakingMsgBeginRedelegate = "/cosmos.staking.v1beta1.MsgBeginRedelegate" | ||
stakingMsgCreateValidator = "/cosmos.staking.v1beta1.MsgCreateValidator" | ||
vestingMsgCreateVestingAccount = "/cosmos.vesting.v1beta1.MsgCreateVestingAccount" | ||
ibcMsgTransfer = "/ibc.applications.transfer.v1.MsgTransfer" | ||
nftMsgIssueDenom = "/irismod.nft.MsgIssueDenom" | ||
nftMsgTransferDenom = "/irismod.nft.MsgTransferDenom" | ||
nftMsgMintNFT = "/irismod.nft.MsgMintNFT" | ||
nftMsgEditNFT = "/irismod.nft.MsgEditNFT" | ||
nftMsgTransferNFT = "/irismod.nft.MsgTransferNFT" | ||
nftMsgBurnNFT = "/irismod.nft.MsgBurnNFT" | ||
mtMsgIssueDenom = "/irismod.mt.MsgIssueDenom" | ||
mtMsgTransferDenom = "/irismod.mt.MsgTransferDenom" | ||
mtMsgMintMT = "/irismod.mt.MsgMintMT" | ||
mtMsgEditMT = "/irismod.mt.MsgEditMT" | ||
mtMsgTransferMT = "/irismod.mt.MsgTransferMT" | ||
mtMsgBurnMT = "/irismod.mt.MsgBurnMT" | ||
) |
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,89 @@ | ||
package v300 | ||
|
||
import ( | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" | ||
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" | ||
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" | ||
icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" | ||
|
||
"github.com/irisnet/irishub/v2/app/upgrades" | ||
) | ||
|
||
// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal | ||
var Upgrade = upgrades.Upgrade{ | ||
UpgradeName: "v3.0", | ||
UpgradeHandlerConstructor: upgradeHandlerConstructor, | ||
StoreUpgrades: &storetypes.StoreUpgrades{ | ||
Added: []string{icahosttypes.StoreKey}, | ||
}, | ||
} | ||
|
||
func upgradeHandlerConstructor( | ||
m *module.Manager, | ||
c module.Configurator, | ||
app upgrades.AppKeepers, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
// initialize ICS27 module | ||
initICAModule(ctx,m, fromVM) | ||
return app.ModuleManager.RunMigrations(ctx, c, fromVM) | ||
} | ||
} | ||
|
||
func initICAModule(ctx sdk.Context,m *module.Manager, fromVM module.VersionMap) { | ||
icaModule := m.Modules[icatypes.ModuleName].(ica.AppModule) | ||
fromVM[icatypes.ModuleName] = icaModule.ConsensusVersion() | ||
controllerParams := icacontrollertypes.Params{} | ||
hostParams := icahosttypes.Params{ | ||
HostEnabled: true, | ||
AllowMessages: []string{ | ||
authzMsgExec, | ||
authzMsgGrant, | ||
authzMsgRevoke, | ||
bankMsgSend, | ||
bankMsgMultiSend, | ||
distrMsgSetWithdrawAddr, | ||
distrMsgWithdrawValidatorCommission, | ||
distrMsgFundCommunityPool, | ||
distrMsgWithdrawDelegatorReward, | ||
feegrantMsgGrantAllowance, | ||
feegrantMsgRevokeAllowance, | ||
legacyGovMsgVoteWeighted, | ||
legacyGovMsgSubmitProposal, | ||
legacyGovMsgDeposit, | ||
legacyGovMsgVote, | ||
govMsgVoteWeighted, | ||
govMsgSubmitProposal, | ||
govMsgDeposit, | ||
govMsgVote, | ||
stakingMsgEditValidator, | ||
stakingMsgDelegate, | ||
stakingMsgUndelegate, | ||
stakingMsgBeginRedelegate, | ||
stakingMsgCreateValidator, | ||
vestingMsgCreateVestingAccount, | ||
ibcMsgTransfer, | ||
nftMsgIssueDenom, | ||
nftMsgTransferDenom, | ||
nftMsgMintNFT, | ||
nftMsgEditNFT, | ||
nftMsgTransferNFT, | ||
nftMsgBurnNFT, | ||
mtMsgIssueDenom, | ||
mtMsgTransferDenom, | ||
mtMsgMintMT, | ||
mtMsgEditMT, | ||
mtMsgTransferMT, | ||
mtMsgBurnMT, | ||
}, | ||
} | ||
|
||
ctx.Logger().Info("start to init interchainaccount module...") | ||
icaModule.InitModule(ctx, controllerParams, hostParams) | ||
ctx.Logger().Info("start to run module migrations...") | ||
} |