Skip to content

Commit

Permalink
refactor: using transfer stack
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Apr 18, 2024
1 parent 13f953e commit 2b49a0e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

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

appKeepers.ICQKeeper = icqkeeper.NewKeeper(
Expand All @@ -378,20 +377,25 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
)

icqIBCModule := icq.NewIBCModule(appKeepers.ICQKeeper)
transfermiddlewareStack := transfermiddleware.NewIBCMiddleware(
transferIBCModule,

// Create transfer stack
var transferStack porttypes.IBCModule
transferStack = transfer.NewIBCModule(appKeepers.TransferKeeper.Keeper)

transferStack = transfermiddleware.NewIBCMiddleware(
transferStack,
appKeepers.TransferMiddlewareKeeper,
)

ibcMiddlewareStack := pfm.NewIBCMiddleware(
transfermiddlewareStack,
transferStack = pfm.NewIBCMiddleware(
transferStack,
appKeepers.PfmKeeper,
0,
pfmkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
ratelimitMiddlewareStack := ratelimitmodule.NewIBCMiddleware(appKeepers.RatelimitKeeper, ibcMiddlewareStack)
hooksTransferMiddleware := ibc_hooks.NewIBCMiddleware(ratelimitMiddlewareStack, &appKeepers.HooksICS4Wrapper)
transferStack = ratelimitmodule.NewIBCMiddleware(appKeepers.RatelimitKeeper, transferStack)
transferStack = ibc_hooks.NewIBCMiddleware(transferStack, &appKeepers.HooksICS4Wrapper)

// Create evidence Keeper for to register the IBC light client misbehaviour evidence route
evidenceKeeper := evidencekeeper.NewKeeper(
Expand Down Expand Up @@ -494,7 +498,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
)

ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, hooksTransferMiddleware)
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferStack)
ibcRouter.AddRoute(icqtypes.ModuleName, icqIBCModule)
ibcRouter.AddRoute(wasmtypes.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper, appKeepers.IBCKeeper.ChannelKeeper))
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostStack)
Expand Down

0 comments on commit 2b49a0e

Please sign in to comment.