Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move all keeper params to expected keepers interface. #216

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading