Skip to content

Add special handling for MsgTransfer IBC destination callback #2398

@chipshort

Description

@chipshort

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).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions