-
Notifications
You must be signed in to change notification settings - Fork 30
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
1 parent
130a8d6
commit eeb35aa
Showing
2 changed files
with
66 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package app | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" | ||
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" | ||
types "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" | ||
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" | ||
"github.com/cosmos/ibc-go/v7/modules/core/exported" | ||
) | ||
|
||
type IBCTransferKeeper struct { | ||
ibctransferkeeper.Keeper | ||
|
||
storeKey storetypes.StoreKey | ||
cdc codec.BinaryCodec | ||
paramSpace paramtypes.Subspace | ||
|
||
ics4Wrapper porttypes.ICS4Wrapper | ||
channelKeeper types.ChannelKeeper | ||
portKeeper types.PortKeeper | ||
authKeeper types.AccountKeeper | ||
bankKeeper types.BankKeeper | ||
scopedKeeper exported.ScopedKeeper | ||
} | ||
|
||
func (k IBCTransferKeeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error) { | ||
// TODO: Custom IBC Transfer logic | ||
return k.Keeper.Transfer(goCtx, msg) | ||
} | ||
|
||
// NewIBCTransferKeeper creates a new IBC transfer Keeper instance | ||
func NewIBCTransferKeeper( | ||
cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, | ||
ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, | ||
authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper exported.ScopedKeeper, | ||
) IBCTransferKeeper { | ||
// ensure ibc transfer module account is set | ||
if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { | ||
panic("the IBC transfer module account has not been set") | ||
} | ||
|
||
// set KeyTable if it has not already been set | ||
if !paramSpace.HasKeyTable() { | ||
paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) | ||
} | ||
|
||
return IBCTransferKeeper{ | ||
cdc: cdc, | ||
storeKey: key, | ||
paramSpace: paramSpace, | ||
ics4Wrapper: ics4Wrapper, | ||
channelKeeper: channelKeeper, | ||
portKeeper: portKeeper, | ||
authKeeper: authKeeper, | ||
bankKeeper: bankKeeper, | ||
scopedKeeper: scopedKeeper, | ||
} | ||
} |