-
Notifications
You must be signed in to change notification settings - Fork 388
Description
Motivation
Currently, it is quite difficult and error prone to handle funds sent to your contract through IBC using the destination callback. You need to handle the protobuf encoded packet data (both the v1 and v2 layout for the forseeable future and new versions would likely break the contract). You also have to make sure that you are actually the recipient and it's easy to check the denom incorrectly because the packet format has a different notion of denom than we do.
Example code: https://cosmwasm.cosmos.network/ibc/extensions/callbacks#destination-callback
Proposed solution
To tackle all the problems, I propose to introduce a new optional funds: Vec<Coin>
parameter to the ibc_destination_callback
entrypoint (like we already did for migrate
). This would only be filled if:
- the callback is for an IBC Transfer, and
- the transfer was sent to the contract address
Otherwise, we pass an empty Vec. If the parameter is not present in the contract entrypoint, we just silently ignore it (same behaviour as right now).