Skip to content

Commit

Permalink
Merge pull request #141 from terra-money/fix/ibc-hooks-callback
Browse files Browse the repository at this point in the history
fix: ibc-hooks callback not triggering wasm callback
  • Loading branch information
Greg Junge authored May 29, 2023
2 parents 9eb34c5 + 1911657 commit 72b2801
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,24 @@ func NewTerraApp(
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(alliancetypes.RouterKey, alliance.NewAllianceProposalHandler(app.AllianceKeeper))

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(
keys[ibchookstypes.StoreKey],
)
app.IBCHooksKeeper = &hooksKeeper
wasmHooks := ibchooks.NewWasmHooks(&hooksKeeper, nil, terraappconfig.AccountAddressPrefix) // The contract keeper needs to be set later
app.Ics20WasmHooks = &wasmHooks
app.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
app.IBCKeeper.ChannelKeeper,
app.Ics20WasmHooks,
)

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec,
keys[ibctransfertypes.StoreKey],
app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper,
app.HooksICS4Wrapper,
app.IBCKeeper.ChannelKeeper,
&app.IBCKeeper.PortKeeper,
app.AccountKeeper,
Expand All @@ -514,18 +526,6 @@ func NewTerraApp(
)
transferIBCModule := ibctransfer.NewIBCModule(app.TransferKeeper)

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(
keys[ibchookstypes.StoreKey],
)
app.IBCHooksKeeper = &hooksKeeper
wasmHooks := ibchooks.NewWasmHooks(&hooksKeeper, nil, terraappconfig.AccountAddressPrefix) // The contract keeper needs to be set later
app.Ics20WasmHooks = &wasmHooks
app.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
app.IBCKeeper.ChannelKeeper,
app.Ics20WasmHooks,
)

// Hooks Middleware
hooksTransferStack := ibchooks.NewIBCMiddleware(&transferIBCModule, &app.HooksICS4Wrapper)
app.TransferStack = &hooksTransferStack
Expand Down
2 changes: 1 addition & 1 deletion x/ibc-hooks/wasm_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (h WasmHooks) SendPacketOverride(i ICS4Middleware, ctx sdk.Context, chanCap
} else {
icsdata.Memo = stringMetadata
}
dataBytes, err := json.Marshal(data)
dataBytes, err := json.Marshal(icsdata)
if err != nil {
return 0, sdkerrors.Wrap(err, "Send packet with callback error")
}
Expand Down

0 comments on commit 72b2801

Please sign in to comment.