IWormholeRelayerSend

Git Source

Inherits: IWormholeRelayerBase

The interface to request deliveries

Functions

sendPayloadToEvm

Publishes an instruction for the default delivery provider to relay a payload to the address targetAddress on chain targetChain with gas limit gasLimit and msg.value equal to receiverValue targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, receiverValue, gasLimit) Any refunds (from leftover gas) will be paid to the delivery provider. In order to receive the refunds, use the sendPayloadToEvm function with refundChain and refundAddress as parameters

function sendPayloadToEvm(
    uint16 targetChain,
    address targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 gasLimit
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressaddressaddress to call on targetChain (that implements IWormholeReceiver)
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress.

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

sendPayloadToEvm

Publishes an instruction for the default delivery provider to relay a payload to the address targetAddress on chain targetChain with gas limit gasLimit and msg.value equal to receiverValue Any refunds (from leftover gas) will be sent to refundAddress on chain refundChain targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, receiverValue, gasLimit)

function sendPayloadToEvm(
    uint16 targetChain,
    address targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 gasLimit,
    uint16 refundChain,
    address refundAddress
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressaddressaddress to call on targetChain (that implements IWormholeReceiver)
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress. Any units of gas unused will be refunded according to the targetChainRefundPerGasUnused rate quoted by the delivery provider
refundChainuint16The chain to deliver any refund to, in Wormhole Chain ID format
refundAddressaddressThe address on refundChain to deliver any refund to

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

sendVaasToEvm

Publishes an instruction for the default delivery provider to relay a payload and VAAs specified by vaaKeys to the address targetAddress on chain targetChain with gas limit gasLimit and msg.value equal to receiverValue targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, receiverValue, gasLimit) Any refunds (from leftover gas) will be paid to the delivery provider. In order to receive the refunds, use the sendVaasToEvm function with refundChain and refundAddress as parameters

function sendVaasToEvm(
    uint16 targetChain,
    address targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 gasLimit,
    VaaKey[] memory vaaKeys
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressaddressaddress to call on targetChain (that implements IWormholeReceiver)
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress.
vaaKeysVaaKey[]Additional VAAs to pass in as parameter in call to targetAddress

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

sendVaasToEvm

Publishes an instruction for the default delivery provider to relay a payload and VAAs specified by vaaKeys to the address targetAddress on chain targetChain with gas limit gasLimit and msg.value equal to receiverValue Any refunds (from leftover gas) will be sent to refundAddress on chain refundChain targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, receiverValue, gasLimit)

function sendVaasToEvm(
    uint16 targetChain,
    address targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 gasLimit,
    VaaKey[] memory vaaKeys,
    uint16 refundChain,
    address refundAddress
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressaddressaddress to call on targetChain (that implements IWormholeReceiver)
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress. Any units of gas unused will be refunded according to the targetChainRefundPerGasUnused rate quoted by the delivery provider
vaaKeysVaaKey[]Additional VAAs to pass in as parameter in call to targetAddress
refundChainuint16The chain to deliver any refund to, in Wormhole Chain ID format
refundAddressaddressThe address on refundChain to deliver any refund to

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

sendToEvm

Publishes an instruction for the delivery provider at deliveryProviderAddress to relay a payload and VAAs specified by vaaKeys to the address targetAddress on chain targetChain with gas limit gasLimit and msg.value equal to receiverValue + (arbitrary amount that is paid for by paymentForExtraReceiverValue of this chain's wei) in targetChain wei. Any refunds (from leftover gas) will be sent to refundAddress on chain refundChain targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, receiverValue, gasLimit, deliveryProviderAddress) + paymentForExtraReceiverValue

function sendToEvm(
    uint16 targetChain,
    address targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 paymentForExtraReceiverValue,
    uint256 gasLimit,
    uint16 refundChain,
    address refundAddress,
    address deliveryProviderAddress,
    VaaKey[] memory vaaKeys,
    uint8 consistencyLevel
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressaddressaddress to call on targetChain (that implements IWormholeReceiver)
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
paymentForExtraReceiverValueuint256amount (in current chain currency units) to spend on extra receiverValue (in addition to the receiverValue specified)
gasLimituint256gas limit with which to call targetAddress. Any units of gas unused will be refunded according to the targetChainRefundPerGasUnused rate quoted by the delivery provider
refundChainuint16The chain to deliver any refund to, in Wormhole Chain ID format
refundAddressaddressThe address on refundChain to deliver any refund to
deliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider
vaaKeysVaaKey[]Additional VAAs to pass in as parameter in call to targetAddress
consistencyLeveluint8Consistency level with which to publish the delivery instructions - see https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

send

Publishes an instruction for the delivery provider at deliveryProviderAddress to relay a payload and VAAs specified by vaaKeys to the address targetAddress on chain targetChain with msg.value equal to receiverValue + (arbitrary amount that is paid for by paymentForExtraReceiverValue of this chain's wei) in targetChain wei. Any refunds (from leftover gas) will be sent to refundAddress on chain refundChain targetAddress must implement the IWormholeReceiver interface This function must be called with msg.value equal to quoteDeliveryPrice(targetChain, receiverValue, encodedExecutionParameters, deliveryProviderAddress) + paymentForExtraReceiverValue

function send(
    uint16 targetChain,
    bytes32 targetAddress,
    bytes memory payload,
    uint256 receiverValue,
    uint256 paymentForExtraReceiverValue,
    bytes memory encodedExecutionParameters,
    uint16 refundChain,
    bytes32 refundAddress,
    address deliveryProviderAddress,
    VaaKey[] memory vaaKeys,
    uint8 consistencyLevel
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
targetAddressbytes32address to call on targetChain (that implements IWormholeReceiver), in Wormhole bytes32 format
payloadbytesarbitrary bytes to pass in as parameter in call to targetAddress
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
paymentForExtraReceiverValueuint256amount (in current chain currency units) to spend on extra receiverValue (in addition to the receiverValue specified)
encodedExecutionParametersbytesencoded information on how to execute delivery that may impact pricing e.g. for version EVM_V1, this is a struct that encodes the gasLimit with which to call targetAddress
refundChainuint16The chain to deliver any refund to, in Wormhole Chain ID format
refundAddressbytes32The address on refundChain to deliver any refund to, in Wormhole bytes32 format
deliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider
vaaKeysVaaKey[]Additional VAAs to pass in as parameter in call to targetAddress
consistencyLeveluint8Consistency level with which to publish the delivery instructions - see https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing delivery instructions

resendToEvm

Requests a previously published delivery instruction to be redelivered (e.g. with a different delivery provider) This function must be called with msg.value equal to quoteEVMDeliveryPrice(targetChain, newReceiverValue, newGasLimit, newDeliveryProviderAddress)

*** This will only be able to succeed if the following is true **

  • newGasLimit >= gas limit of the old instruction
  • newReceiverValue >= receiver value of the old instruction
  • newDeliveryProvider's targetChainRefundPerGasUnused >= old relay provider's targetChainRefundPerGasUnused

*** This will only be able to succeed if the following is true **

  • newGasLimit >= gas limit of the old instruction
  • newReceiverValue >= receiver value of the old instruction
  • newDeliveryProvider's targetChainRefundPerGasUnused >= old relay provider's targetChainRefundPerGasUnused
function resendToEvm(
    VaaKey memory deliveryVaaKey,
    uint16 targetChain,
    uint256 newReceiverValue,
    uint256 newGasLimit,
    address newDeliveryProviderAddress
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
deliveryVaaKeyVaaKeyVaaKey identifying the wormhole message containing the previously published delivery instructions
targetChainuint16The target chain that the original delivery targeted. Must match targetChain from original delivery instructions
newReceiverValueuint256new msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
newGasLimituint256gas limit with which to call targetAddress. Any units of gas unused will be refunded according to the targetChainRefundPerGasUnused rate quoted by the delivery provider, to the refund chain and address specified in the original request
newDeliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing redelivery instructions

resend

Requests a previously published delivery instruction to be redelivered This function must be called with msg.value equal to quoteDeliveryPrice(targetChain, newReceiverValue, newEncodedExecutionParameters, newDeliveryProviderAddress)

*** This will only be able to succeed if the following is true **

  • (For EVM_V1) newGasLimit >= gas limit of the old instruction
  • newReceiverValue >= receiver value of the old instruction
  • (For EVM_V1) newDeliveryProvider's targetChainRefundPerGasUnused >= old relay provider's targetChainRefundPerGasUnused
function resend(
    VaaKey memory deliveryVaaKey,
    uint16 targetChain,
    uint256 newReceiverValue,
    bytes memory newEncodedExecutionParameters,
    address newDeliveryProviderAddress
)
    external
    payable
    returns (uint64 sequence);

Parameters

NameTypeDescription
deliveryVaaKeyVaaKeyVaaKey identifying the wormhole message containing the previously published delivery instructions
targetChainuint16The target chain that the original delivery targeted. Must match targetChain from original delivery instructions
newReceiverValueuint256new msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
newEncodedExecutionParametersbytesnew encoded information on how to execute delivery that may impact pricing e.g. for version EVM_V1, this is a struct that encodes the gasLimit with which to call targetAddress
newDeliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider

Returns

NameTypeDescription
sequenceuint64sequence number of published VAA containing redelivery instructions

quoteEVMDeliveryPrice

Returns the price to request a relay to chain targetChain, using the default delivery provider

function quoteEVMDeliveryPrice(
    uint16 targetChain,
    uint256 receiverValue,
    uint256 gasLimit
)
    external
    view
    returns (uint256 nativePriceQuote, uint256 targetChainRefundPerGasUnused);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress.

Returns

NameTypeDescription
nativePriceQuoteuint256Price, in units of current chain currency, that the delivery provider charges to perform the relay
targetChainRefundPerGasUnuseduint256amount of target chain currency that will be refunded per unit of gas unused, if a refundAddress is specified

quoteEVMDeliveryPrice

Returns the price to request a relay to chain targetChain, using delivery provider deliveryProviderAddress

function quoteEVMDeliveryPrice(
    uint16 targetChain,
    uint256 receiverValue,
    uint256 gasLimit,
    address deliveryProviderAddress
)
    external
    view
    returns (uint256 nativePriceQuote, uint256 targetChainRefundPerGasUnused);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
gasLimituint256gas limit with which to call targetAddress.
deliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider

Returns

NameTypeDescription
nativePriceQuoteuint256Price, in units of current chain currency, that the delivery provider charges to perform the relay
targetChainRefundPerGasUnuseduint256amount of target chain currency that will be refunded per unit of gas unused, if a refundAddress is specified

quoteDeliveryPrice

Returns the price to request a relay to chain targetChain, using delivery provider deliveryProviderAddress

function quoteDeliveryPrice(
    uint16 targetChain,
    uint256 receiverValue,
    bytes memory encodedExecutionParameters,
    address deliveryProviderAddress
)
    external
    view
    returns (uint256 nativePriceQuote, bytes memory encodedExecutionInfo);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
receiverValueuint256msg.value that delivery provider should pass in for call to targetAddress (in targetChain currency units)
encodedExecutionParametersbytesencoded information on how to execute delivery that may impact pricing e.g. for version EVM_V1, this is a struct that encodes the gasLimit with which to call targetAddress
deliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider

Returns

NameTypeDescription
nativePriceQuoteuint256Price, in units of current chain currency, that the delivery provider charges to perform the relay
encodedExecutionInfobytesencoded information on how the delivery will be executed e.g. for version EVM_V1, this is a struct that encodes the gasLimit and targetChainRefundPerGasUnused (which is the amount of target chain currency that will be refunded per unit of gas unused, if a refundAddress is specified)

quoteNativeForChain

Returns the (extra) amount of target chain currency that targetAddress will be called with, if the paymentForExtraReceiverValue field is set to currentChainAmount

function quoteNativeForChain(
    uint16 targetChain,
    uint256 currentChainAmount,
    address deliveryProviderAddress
)
    external
    view
    returns (uint256 targetChainAmount);

Parameters

NameTypeDescription
targetChainuint16in Wormhole Chain ID format
currentChainAmountuint256The value that paymentForExtraReceiverValue will be set to
deliveryProviderAddressaddressThe address of the desired delivery provider's implementation of IDeliveryProvider

Returns

NameTypeDescription
targetChainAmountuint256The amount such that if targetAddress will be called with msg.value equal to receiverValue + targetChainAmount

getDefaultDeliveryProvider

Returns the address of the current default delivery provider

function getDefaultDeliveryProvider() external view returns (address deliveryProvider);

Returns

NameTypeDescription
deliveryProvideraddressThe address of (the default delivery provider)'s contract on this source chain. This must be a contract that implements IDeliveryProvider.