Interfaces
Some of the interface differences are:- The callbacks middleware for IBC v2 requires the
Underlying Applicationto implement the newCallbacksCompatibleModuleV2interface. channeltypesv2.Payloadis now used instead ofchanneltypes.Packet- With IBC classic, the
OnRecvPacketcallback returns theack, whereas v2 returns therecvResultwhich is the status of the packet: unspecified, success, failue or asynchronous api.WriteAcknowledgementWrapperis used instead ofICS4Wrapper.WriteAcknowledgement. It is only needed if the lower level application is going to write an asynchronous acknowledgement.
Contract Developers
The wasmd contract keeper enables cosmwasm developers to use the callbacks middleware. The cosmwasm documentation provides information for contract developers. The IBC v2 callbacks implementation uses aPayload but reconstructs an IBC classic Packet to preserve the cosmwasm contract keeper interface. Additionally contracts must now handle the IBC v2 ErrorAcknowledgement sentinel value in the case of a failure.
The callbacks middleware can be used for transfer + action workflows, for example a transfer and swap on recieve. These workflows require knowledge of the ibc denom that has been recieved. To assist with parsing the ics20 packet, helper functions can be found in the solidity-ibc-eureka repository.