Skip to content

Commit

Permalink
activate custom ibc module for cosmos chain. chain works.
Browse files Browse the repository at this point in the history
  • Loading branch information
RustNinja committed Feb 21, 2024
1 parent acdbf54 commit 808854b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 20 deletions.
6 changes: 4 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import (
ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
customibctransfer "github.com/notional-labs/composable/v6/custom/ibc-transfer"
customstaking "github.com/notional-labs/composable/v6/custom/staking"
"github.com/spf13/cast"
icq "github.com/strangelove-ventures/async-icq/v7"
Expand Down Expand Up @@ -334,7 +335,8 @@ func NewComposableApp(
enabledProposals,
)

transferModule := transfer.NewAppModule(app.TransferKeeper)
// transferModule := transfer.NewAppModule(app.TransferKeeper)
transferModule := customibctransfer.NewAppModule(appCodec, app.TransferKeeper)
routerModule := router.NewAppModule(app.RouterKeeper)
transfermiddlewareModule := transfermiddleware.NewAppModule(&app.TransferMiddlewareKeeper)
txBoundaryModule := txBoundary.NewAppModule(appCodec, app.TxBoundaryKeepper)
Expand Down Expand Up @@ -589,7 +591,7 @@ func (app *ComposableApp) GetStakingKeeper() ibctestingtypes.StakingKeeper {

// GetIBCKeeper implements the TestingApp interface.
func (app *ComposableApp) GetTransferKeeper() *ibctransferkeeper.Keeper {
return &app.TransferKeeper
return &app.TransferKeeper.Keeper
}

// GetIBCKeeper implements the TestingApp interface.
Expand Down
17 changes: 11 additions & 6 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ import (
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"

// ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"

// ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
ibchost "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
customibctransferkeeper "github.com/notional-labs/composable/v6/custom/ibc-transfer/keeper"
icq "github.com/strangelove-ventures/async-icq/v7"
icqkeeper "github.com/strangelove-ventures/async-icq/v7/keeper"
icqtypes "github.com/strangelove-ventures/async-icq/v7/types"
Expand Down Expand Up @@ -133,7 +137,7 @@ type AppKeepers struct {
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
TransferKeeper customibctransferkeeper.Keeper
ICQKeeper icqkeeper.Keeper
ICAHostKeeper icahostkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
Expand Down Expand Up @@ -288,7 +292,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.GetSubspace(transfermiddlewaretypes.ModuleName),
appCodec,
&appKeepers.RatelimitKeeper,
&appKeepers.TransferKeeper,
&appKeepers.TransferKeeper.Keeper,
appKeepers.BankKeeper,
authorityAddress,
)
Expand All @@ -299,7 +303,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
authorityAddress,
)

appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper(
appKeepers.TransferKeeper = customibctransferkeeper.NewKeeper(
appCodec, appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
&appKeepers.TransferMiddlewareKeeper, // ICS4Wrapper
Expand All @@ -308,13 +312,14 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.AccountKeeper,
appKeepers.BankKeeper,
appKeepers.ScopedTransferKeeper,
// &appKeepers.StakingMiddlewareKeeper,x
)

appKeepers.RouterKeeper = routerkeeper.NewKeeper(
appCodec,
appKeepers.keys[routertypes.StoreKey],
appKeepers.GetSubspace(routertypes.ModuleName),
appKeepers.TransferKeeper,
appKeepers.TransferKeeper.Keeper,
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.DistrKeeper,
appKeepers.BankKeeper,
Expand All @@ -334,7 +339,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(appKeepers.TransferKeeper.Keeper)
scopedICQKeeper := appKeepers.CapabilityKeeper.ScopeToModule(icqtypes.ModuleName)

appKeepers.ICQKeeper = icqkeeper.NewKeeper(
Expand Down
2 changes: 1 addition & 1 deletion app/test_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s TestSupport) GovKeeper() govkeeper.Keeper {
}

func (s TestSupport) TransferKeeper() ibctransferkeeper.Keeper {
return s.app.TransferKeeper
return s.app.TransferKeeper.Keeper
}

func (s TestSupport) Wasm08Keeper() wasm08.Keeper {
Expand Down
22 changes: 11 additions & 11 deletions custom/ibc-transfer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"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"
stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper"
// stakingmiddleware "github.com/notional-labs/composable/v6/x/stakingmiddleware/keeper"
)

type Keeper struct {
ibctransferkeeper.Keeper
cdc codec.BinaryCodec
Stakingmiddleware *stakingmiddleware.Keeper
authority string
cdc codec.BinaryCodec
// Stakingmiddleware *stakingmiddleware.Keeper
// authority string
}

func NewKeeper(
Expand All @@ -27,19 +27,19 @@ func NewKeeper(
channelKeeper types.ChannelKeeper,
portKeeper types.PortKeeper,
authKeeper types.AccountKeeper,
ak types.AccountKeeper,
// ak types.AccountKeeper,
bk types.BankKeeper,
scopedKeeper exported.ScopedKeeper,
authority string,
stakingmiddleware *stakingmiddleware.Keeper,
// authority string,
// stakingmiddleware *stakingmiddleware.Keeper,
//return type from this function is different from the staking keeper.

Check failure on line 35 in custom/ibc-transfer/keeper/keeper.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
//todo double check if this is correct
) Keeper {
keeper := Keeper{
Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper),
authority: authority,
Stakingmiddleware: stakingmiddleware,
cdc: cdc,
Keeper: ibctransferkeeper.NewKeeper(cdc, key, paramSpace, ics4Wrapper, channelKeeper, portKeeper, authKeeper, bk, scopedKeeper),
// authority: authority,
// Stakingmiddleware: stakingmiddleware,
cdc: cdc,
}
return keeper
}

0 comments on commit 808854b

Please sign in to comment.