-
Notifications
You must be signed in to change notification settings - Fork 181
/
handler.go
28 lines (22 loc) · 981 Bytes
/
handler.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
package ica
import (
"fmt"
sdk "github.com/okex/exchain/libs/cosmos-sdk/types"
sdkerrors "github.com/okex/exchain/libs/cosmos-sdk/types/errors"
controllerkeeper "github.com/okex/exchain/libs/ibc-go/modules/apps/27-interchain-accounts/controller/keeper"
hostkeeper "github.com/okex/exchain/libs/ibc-go/modules/apps/27-interchain-accounts/host/keeper"
tmtypes "github.com/okex/exchain/libs/tendermint/types"
)
func NewHandler(hostKeeper *hostkeeper.Keeper, ck *controllerkeeper.Keeper) sdk.Handler {
return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) {
if !tmtypes.HigherThanVenus4(ctx.BlockHeight()) {
errMsg := fmt.Sprintf("ibc ica is not supported at height %d", ctx.BlockHeight())
return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg)
}
ctx.SetEventManager(sdk.NewEventManager())
switch msg := msg.(type) {
default:
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized ica message type: %T", msg)
}
}
}