IWormholeReceiver
Interface for a contract which can receive Wormhole messages.
Functions
receiveWormholeMessages
When a send
is performed with this contract as the target, this function will be
invoked by the WormholeRelayer contract
NOTE: This function should be restricted such that only the Wormhole Relayer contract can call it.
We also recommend that this function:
- Stores all received
deliveryHash
s in a mapping(bytes32 => bool)
, and on every call, checks that deliveryHash has not already been stored in the map (This is to prevent other users maliciously trying to relay the same message) - Checks that
sourceChain
andsourceAddress
are indeed who you expect to have requested the calling ofsend
on the source chain The invocation of this function corresponding to thesend
request will have msg.value equal to the receiverValue specified in the send request. If the invocation of this function reverts or exceeds the gas limit specified by the send requester, this delivery will result in aReceiverFailure
.
function receiveWormholeMessages(
bytes memory payload,
bytes[] memory additionalVaas,
bytes32 sourceAddress,
uint16 sourceChain,
bytes32 deliveryHash
)
external
payable;
Parameters
Name | Type | Description |
---|---|---|
payload | bytes | - an arbitrary message which was included in the delivery by the requester. |
additionalVaas | bytes[] | - Additional VAAs which were requested to be included in this delivery. They are guaranteed to all be included and in the same order as was specified in the delivery request. |
sourceAddress | bytes32 | - the (wormhole format) address on the sending chain which requested this delivery. |
sourceChain | uint16 | - the wormhole chain ID where this delivery was requested. |
deliveryHash | bytes32 | - the VAA hash of the deliveryVAA. NOTE: These signedVaas are NOT verified by the Wormhole core contract prior to being provided to this call. Always make sure parseAndVerify() is called on the Wormhole core contract before trusting the content of a raw VAA, otherwise the VAA may be invalid or malicious. |