-
Notifications
You must be signed in to change notification settings - Fork 171
/
upgrades.go
63 lines (56 loc) · 2.56 KB
/
upgrades.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package v11
import (
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/authz"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/CosmosContracts/juno/v19/app/keepers"
)
// CreateV11UpgradeHandler makes an upgrade handler for v11 of Juno
func CreateV11UpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
// update ICA Host to add new messages available
// enumerate all because it's easier to reason about
newIcaHostParams := icahosttypes.Params{
HostEnabled: true,
AllowMessages: []string{
sdk.MsgTypeURL(&ibctransfertypes.MsgTransfer{}), // added in v10
sdk.MsgTypeURL(&banktypes.MsgSend{}),
sdk.MsgTypeURL(&banktypes.MsgMultiSend{}), // this was missed last time
sdk.MsgTypeURL(&stakingtypes.MsgDelegate{}),
sdk.MsgTypeURL(&stakingtypes.MsgUndelegate{}), // added in v10
sdk.MsgTypeURL(&stakingtypes.MsgBeginRedelegate{}),
sdk.MsgTypeURL(&stakingtypes.MsgCreateValidator{}),
sdk.MsgTypeURL(&stakingtypes.MsgEditValidator{}),
sdk.MsgTypeURL(&distrtypes.MsgWithdrawDelegatorReward{}),
sdk.MsgTypeURL(&distrtypes.MsgSetWithdrawAddress{}),
sdk.MsgTypeURL(&distrtypes.MsgWithdrawValidatorCommission{}),
sdk.MsgTypeURL(&distrtypes.MsgFundCommunityPool{}),
sdk.MsgTypeURL(&govv1beta1.MsgVote{}),
sdk.MsgTypeURL(&govv1beta1.MsgVoteWeighted{}), // added in v10
sdk.MsgTypeURL(&authz.MsgExec{}),
sdk.MsgTypeURL(&authz.MsgGrant{}),
sdk.MsgTypeURL(&authz.MsgRevoke{}),
// wasm msgs here
// note we only support three atm (well four inc instantiate2)
sdk.MsgTypeURL(&wasmtypes.MsgStoreCode{}),
sdk.MsgTypeURL(&wasmtypes.MsgInstantiateContract{}),
sdk.MsgTypeURL(&wasmtypes.MsgInstantiateContract2{}), // added in wasmd 0.29.0
sdk.MsgTypeURL(&wasmtypes.MsgExecuteContract{}),
},
}
keepers.ICAHostKeeper.SetParams(ctx, newIcaHostParams)
return mm.RunMigrations(ctx, cfg, vm)
}
}