Indeed, I wasn’t aware of this point, but after some research I found that Gaia does initialize the Callbacks middleware with an IBC handler for CosmWasm, both for IBC transfers (ICS-20) and for ICA:
https://github.com/cosmos/gaia/blob/main/app/keepers/keepers.go#L519
On the contract side, in order to receive these callbacks you need to implement new dedicated entrypoints, as described in the CosmWasm documentation:
https://cosmwasm.cosmos.network/ibc/extensions/callbacks
Finally, the middleware uses the information passed in the memo field of IBC transactions. The IBC-Go documentation explains how to format this field so that the Callbacks module can properly trigger the expected call:
https://ibc.cosmos.network/main/middleware/callbacks/end-users/
Example:
{
"src_callback": {
"address": "callbackAddressString",
"gas_limit": "userDefinedGasLimitString"
},
"dest_callback": {
"address": "callbackAddressString",
"gas_limit": "userDefinedGasLimitString"
}
}
The key difference is that, unlike IBC-Hooks, a contract must be explicitly modified in order to support callbacks.
But you’re right, it’s probably better not to combine both solutions and instead use Callbacks, which seems to be the standard solution developed by the IBC team.
I’d be curious to hear feedback from teams that make heavy use of IBC-Hooks to know whether the callback mechanism is a limitation for them.