Skip to content

Commit

Permalink
Move all keeper params to expected keepers interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
tnv1 committed Jul 8, 2024
1 parent 423321a commit 3a0634f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
20 changes: 8 additions & 12 deletions x/feeabs/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand All @@ -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
Expand Down
23 changes: 16 additions & 7 deletions x/feeabs/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}

0 comments on commit 3a0634f

Please sign in to comment.