memo
field on every ICS20 or ICS721 transfer packet as of IBC v3.4.0. Wasm hooks is an IBC middleware that parses an ICS20 transfer, and if the memo field is of a particular form, executes a wasm contract call. We now detail the memo format for wasm contract calls, and the execution guarantees provided.
MsgExecuteContract
is defined here as the following type:
Sender
: We cannot trust the sender of an IBC packet, the counterparty chain has full ability to lie about it. We cannot risk this sender being confused for a particular user or module address on Osmosis. So we replace the sender with an account to represent the sender prefixed by the channel and a wasm module prefix. This is done by setting the sender to Bech32(Hash(“ibc-wasm-hook-intermediary” || channelID || sender)), where the channelId is the channel id on the local chain.Contract
: This field should be directly obtained from the ICS-20 packet metadataMsg
: This field should be directly obtained from the ICS-20 packet metadata.Funds
: This field is set to the amount of funds being sent over in the ICS 20 packet. One detail is that the denom in the packet is the counterparty chains representation of the denom, so we have to translate it to Osmosis’ representation.memo
is not blankmemo
is valid JSONmemo
has at least one key, with value "wasm"
memo["wasm"]["message"]
has exactly two entries, "contract"
, "msg"
and "fund"
memo["wasm"]["message"]["msg"]
is a valid JSON objectreceiver
== "" || receiver
== memo["wasm"]["contract"]
memo
is not blankmemo
is valid JSONmemo
has at least one key, with name "wasm"
MsgExecuteMessages
in OPchild module.