From 3a0634f22ea93604946b157ba2727f85a67999b4 Mon Sep 17 00:00:00 2001 From: tnv1 Date: Mon, 8 Jul 2024 14:44:27 +0700 Subject: [PATCH] Move all keeper params to expected keepers interface. --- x/feeabs/keeper/keeper.go | 20 ++++++++------------ x/feeabs/types/expected_keepers.go | 23 ++++++++++++++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/x/feeabs/keeper/keeper.go b/x/feeabs/keeper/keeper.go index e75b53d9..d29d7149 100644 --- a/x/feeabs/keeper/keeper.go +++ b/x/feeabs/keeper/keeper.go @@ -3,18 +3,14 @@ package keeper import ( "fmt" - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" - channelkeeper "github.com/cosmos/ibc-go/v8/modules/core/04-channel/keeper" - portkeeper "github.com/cosmos/ibc-go/v8/modules/core/05-port/keeper" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types" @@ -24,15 +20,15 @@ type Keeper struct { cdc codec.BinaryCodec storeKey storetypes.StoreKey sk types.StakingKeeper - ak authkeeper.AccountKeeper + ak types.AccountKeeper bk types.BankKeeper transferKeeper ibctransferkeeper.Keeper paramSpace paramtypes.Subspace // ibc keeper - portKeeper *portkeeper.Keeper - channelKeeper channelkeeper.Keeper - scopedKeeper capabilitykeeper.ScopedKeeper + portKeeper types.PortKeeper + channelKeeper types.ChannelKeeper + scopedKeeper types.ScopedKeeper authority string } @@ -42,12 +38,12 @@ func NewKeeper( storeKey storetypes.StoreKey, ps paramtypes.Subspace, sk types.StakingKeeper, - ak authkeeper.AccountKeeper, + ak types.AccountKeeper, bk types.BankKeeper, transferKeeper ibctransferkeeper.Keeper, - channelKeeper channelkeeper.Keeper, - portKeeper *portkeeper.Keeper, - scopedKeeper capabilitykeeper.ScopedKeeper, + channelKeeper types.ChannelKeeper, + portKeeper types.PortKeeper, + scopedKeeper types.ScopedKeeper, authority string, ) Keeper { // set KeyTable if it has not already been set diff --git a/x/feeabs/types/expected_keepers.go b/x/feeabs/types/expected_keepers.go index 5e525268..cd7e1d3e 100644 --- a/x/feeabs/types/expected_keepers.go +++ b/x/feeabs/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( "context" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" connectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -57,19 +58,27 @@ type ConnectionKeeper interface { // PortKeeper defines the expected IBC port keeper. type PortKeeper interface { - BindPort(ctx context.Context, portID string) *capabilitytypes.Capability + BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability } // ScopedKeeper defines the expected scoped keeper. type ScopedKeeper interface { - AuthenticateCapability(ctx context.Context, capability *capabilitytypes.Capability, name string) bool - ClaimCapability(ctx context.Context, capability *capabilitytypes.Capability, name string) error - GetCapability(ctx context.Context, name string) (*capabilitytypes.Capability, bool) + AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool + ClaimCapability(ctx sdk.Context, capability *capabilitytypes.Capability, name string) error + GetCapability(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool) } // ChannelKeeper defines the expected IBC channel keeper. type ChannelKeeper interface { - GetChannel(ctx context.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) - GetNextSequenceSend(ctx context.Context, portID, channelID string) (uint64, bool) - ChanCloseInit(ctx context.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error + GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) + GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool) + SendPacket( + ctx sdk.Context, + chanCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, + ) (sequence uint64, err error) }