diff --git a/src/interfaces/ITokenBridge.sol b/src/interfaces/ITokenBridge.sol index 675b3e6..e4ff514 100644 --- a/src/interfaces/ITokenBridge.sol +++ b/src/interfaces/ITokenBridge.sol @@ -6,172 +6,192 @@ pragma solidity ^0.8.0; import "./IWormhole.sol"; interface ITokenBridge { - struct Transfer { - uint8 payloadID; - uint256 amount; - bytes32 tokenAddress; - uint16 tokenChain; - bytes32 to; - uint16 toChain; - uint256 fee; - } - - struct TransferWithPayload { - uint8 payloadID; - uint256 amount; - bytes32 tokenAddress; - uint16 tokenChain; - bytes32 to; - uint16 toChain; - bytes32 fromAddress; - bytes payload; - } - - struct AssetMeta { - uint8 payloadID; - bytes32 tokenAddress; - uint16 tokenChain; - uint8 decimals; - bytes32 symbol; - bytes32 name; - } + struct Transfer { + uint8 payloadID; + uint256 amount; + bytes32 tokenAddress; + uint16 tokenChain; + bytes32 to; + uint16 toChain; + uint256 fee; + } + + struct TransferWithPayload { + uint8 payloadID; + uint256 amount; + bytes32 tokenAddress; + uint16 tokenChain; + bytes32 to; + uint16 toChain; + bytes32 fromAddress; + bytes payload; + } + + struct AssetMeta { + uint8 payloadID; + bytes32 tokenAddress; + uint16 tokenChain; + uint8 decimals; + bytes32 symbol; + bytes32 name; + } + + struct RegisterChain { + bytes32 module; + uint8 action; + uint16 chainId; + uint16 emitterChainID; + bytes32 emitterAddress; + } + + struct UpgradeContract { + bytes32 module; + uint8 action; + uint16 chainId; + bytes32 newContract; + } + + struct RecoverChainId { + bytes32 module; + uint8 action; + uint256 evmChainId; + uint16 newChainId; + } + + event ContractUpgraded(address indexed oldContract, address indexed newContract); + + event TransferRedeemed( + uint16 indexed emitterChainId, + bytes32 indexed emitterAddress, + uint64 indexed sequence + ); + + function _parseTransferCommon( + bytes memory encoded + ) external pure returns (Transfer memory transfer); - struct RegisterChain { - bytes32 module; - uint8 action; - uint16 chainId; - uint16 emitterChainID; - bytes32 emitterAddress; - } + function attestToken( + address tokenAddress, + uint32 nonce + ) external payable returns (uint64 sequence); - struct UpgradeContract { - bytes32 module; - uint8 action; - uint16 chainId; - bytes32 newContract; - } + function wrapAndTransferETH( + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce + ) external payable returns (uint64 sequence); - struct RecoverChainId { - bytes32 module; - uint8 action; - uint256 evmChainId; - uint16 newChainId; - } + function wrapAndTransferETHWithPayload( + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload + ) external payable returns (uint64 sequence); - event ContractUpgraded(address indexed oldContract, address indexed newContract); + function transferTokens( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint256 arbiterFee, + uint32 nonce + ) external payable returns (uint64 sequence); - function _parseTransferCommon(bytes memory encoded) external pure returns (Transfer memory transfer); + function transferTokensWithPayload( + address token, + uint256 amount, + uint16 recipientChain, + bytes32 recipient, + uint32 nonce, + bytes memory payload + ) external payable returns (uint64 sequence); - function attestToken(address tokenAddress, uint32 nonce) external payable returns (uint64 sequence); + function updateWrapped(bytes memory encodedVm) external returns (address token); - function wrapAndTransferETH(uint16 recipientChain, bytes32 recipient, uint256 arbiterFee, uint32 nonce) - external - payable - returns (uint64 sequence); + function createWrapped(bytes memory encodedVm) external returns (address token); - function wrapAndTransferETHWithPayload(uint16 recipientChain, bytes32 recipient, uint32 nonce, bytes memory payload) - external - payable - returns (uint64 sequence); + function completeTransferWithPayload(bytes memory encodedVm) external returns (bytes memory); - function transferTokens( - address token, - uint256 amount, - uint16 recipientChain, - bytes32 recipient, - uint256 arbiterFee, - uint32 nonce - ) external payable returns (uint64 sequence); + function completeTransferAndUnwrapETHWithPayload( + bytes memory encodedVm + ) external returns (bytes memory); - function transferTokensWithPayload( - address token, - uint256 amount, - uint16 recipientChain, - bytes32 recipient, - uint32 nonce, - bytes memory payload - ) external payable returns (uint64 sequence); + function completeTransfer(bytes memory encodedVm) external; - function updateWrapped(bytes memory encodedVm) external returns (address token); + function completeTransferAndUnwrapETH(bytes memory encodedVm) external; - function createWrapped(bytes memory encodedVm) external returns (address token); + function encodeAssetMeta(AssetMeta memory meta) external pure returns (bytes memory encoded); - function completeTransferWithPayload(bytes memory encodedVm) external returns (bytes memory); + function encodeTransfer(Transfer memory transfer) external pure returns (bytes memory encoded); - function completeTransferAndUnwrapETHWithPayload(bytes memory encodedVm) external returns (bytes memory); + function encodeTransferWithPayload(TransferWithPayload memory transfer) + external + pure + returns (bytes memory encoded); - function completeTransfer(bytes memory encodedVm) external; + function parsePayloadID(bytes memory encoded) external pure returns (uint8 payloadID); - function completeTransferAndUnwrapETH(bytes memory encodedVm) external; + function parseAssetMeta(bytes memory encoded) external pure returns (AssetMeta memory meta); - function encodeAssetMeta(AssetMeta memory meta) external pure returns (bytes memory encoded); + function parseTransfer(bytes memory encoded) external pure returns (Transfer memory transfer); - function encodeTransfer(Transfer memory transfer) external pure returns (bytes memory encoded); + function parseTransferWithPayload(bytes memory encoded) + external + pure + returns (TransferWithPayload memory transfer); - function encodeTransferWithPayload(TransferWithPayload memory transfer) - external - pure - returns (bytes memory encoded); + function governanceActionIsConsumed(bytes32 hash) external view returns (bool); - function parsePayloadID(bytes memory encoded) external pure returns (uint8 payloadID); + function isInitialized(address impl) external view returns (bool); - function parseAssetMeta(bytes memory encoded) external pure returns (AssetMeta memory meta); + function isTransferCompleted(bytes32 hash) external view returns (bool); - function parseTransfer(bytes memory encoded) external pure returns (Transfer memory transfer); + function wormhole() external view returns (IWormhole); - function parseTransferWithPayload(bytes memory encoded) - external - pure - returns (TransferWithPayload memory transfer); + function chainId() external view returns (uint16); - function governanceActionIsConsumed(bytes32 hash) external view returns (bool); + function evmChainId() external view returns (uint256); - function isInitialized(address impl) external view returns (bool); + function isFork() external view returns (bool); - function isTransferCompleted(bytes32 hash) external view returns (bool); + function governanceChainId() external view returns (uint16); - function wormhole() external view returns (IWormhole); + function governanceContract() external view returns (bytes32); - function chainId() external view returns (uint16); + function wrappedAsset(uint16 tokenChainId, bytes32 tokenAddress) external view returns (address); - function evmChainId() external view returns (uint256); + function bridgeContracts(uint16 chainId_) external view returns (bytes32); - function isFork() external view returns (bool); + function tokenImplementation() external view returns (address); - function governanceChainId() external view returns (uint16); + function WETH() external view returns (address); - function governanceContract() external view returns (bytes32); + function outstandingBridged(address token) external view returns (uint256); - function wrappedAsset(uint16 tokenChainId, bytes32 tokenAddress) external view returns (address); + function isWrappedAsset(address token) external view returns (bool); - function bridgeContracts(uint16 chainId_) external view returns (bytes32); + function finality() external view returns (uint8); - function tokenImplementation() external view returns (address); + function implementation() external view returns (address); - function WETH() external view returns (address); + function initialize() external; - function outstandingBridged(address token) external view returns (uint256); + function registerChain(bytes memory encodedVM) external; - function isWrappedAsset(address token) external view returns (bool); + function upgrade(bytes memory encodedVM) external; - function finality() external view returns (uint8); + function submitRecoverChainId(bytes memory encodedVM) external; - function implementation() external view returns (address); + function parseRegisterChain( + bytes memory encoded + ) external pure returns (RegisterChain memory chain); - function initialize() external; + function parseUpgrade( + bytes memory encoded + ) external pure returns (UpgradeContract memory chain); - function registerChain(bytes memory encodedVM) external; - - function upgrade(bytes memory encodedVM) external; - - function submitRecoverChainId(bytes memory encodedVM) external; - - function parseRegisterChain(bytes memory encoded) external pure returns (RegisterChain memory chain); - - function parseUpgrade(bytes memory encoded) external pure returns (UpgradeContract memory chain); - - function parseRecoverChainId(bytes memory encodedRecoverChainId) - external - pure - returns (RecoverChainId memory rci); + function parseRecoverChainId( + bytes memory encodedRecoverChainId + ) external pure returns (RecoverChainId memory rci); } diff --git a/src/interfaces/IWormhole.sol b/src/interfaces/IWormhole.sol index b8a50f4..78c7ab7 100644 --- a/src/interfaces/IWormhole.sol +++ b/src/interfaces/IWormhole.sol @@ -1,148 +1,160 @@ -// contracts/Messages.sol // SPDX-License-Identifier: Apache 2 pragma solidity ^0.8.0; interface IWormhole { - struct GuardianSet { - address[] keys; - uint32 expirationTime; - } - - struct Signature { - bytes32 r; - bytes32 s; - uint8 v; - uint8 guardianIndex; - } - - struct VM { - uint8 version; - uint32 timestamp; - uint32 nonce; - uint16 emitterChainId; - bytes32 emitterAddress; - uint64 sequence; - uint8 consistencyLevel; - bytes payload; - uint32 guardianSetIndex; - Signature[] signatures; - bytes32 hash; - } + struct GuardianSet { + address[] keys; + uint32 expirationTime; + } + + struct Signature { + bytes32 r; + bytes32 s; + uint8 v; + uint8 guardianIndex; + } + + struct VM { + uint8 version; + uint32 timestamp; + uint32 nonce; + uint16 emitterChainId; + bytes32 emitterAddress; + uint64 sequence; + uint8 consistencyLevel; + bytes payload; + uint32 guardianSetIndex; + Signature[] signatures; + bytes32 hash; + } + + struct ContractUpgrade { + bytes32 module; + uint8 action; + uint16 chain; + address newContract; + } + + struct GuardianSetUpgrade { + bytes32 module; + uint8 action; + uint16 chain; + GuardianSet newGuardianSet; + uint32 newGuardianSetIndex; + } + + struct SetMessageFee { + bytes32 module; + uint8 action; + uint16 chain; + uint256 messageFee; + } + + struct TransferFees { + bytes32 module; + uint8 action; + uint16 chain; + uint256 amount; + bytes32 recipient; + } - struct ContractUpgrade { - bytes32 module; - uint8 action; - uint16 chain; - address newContract; - } + struct RecoverChainId { + bytes32 module; + uint8 action; + uint256 evmChainId; + uint16 newChainId; + } - struct GuardianSetUpgrade { - bytes32 module; - uint8 action; - uint16 chain; - GuardianSet newGuardianSet; - uint32 newGuardianSetIndex; - } + event LogMessagePublished( + address indexed sender, + uint64 sequence, + uint32 nonce, + bytes payload, + uint8 consistencyLevel + ); - struct SetMessageFee { - bytes32 module; - uint8 action; - uint16 chain; - uint256 messageFee; - } + event ContractUpgraded(address indexed oldContract, address indexed newContract); - struct TransferFees { - bytes32 module; - uint8 action; - uint16 chain; - uint256 amount; - bytes32 recipient; - } + event GuardianSetAdded(uint32 indexed index); - struct RecoverChainId { - bytes32 module; - uint8 action; - uint256 evmChainId; - uint16 newChainId; - } + function publishMessage(uint32 nonce, bytes memory payload, uint8 consistencyLevel) + external + payable + returns (uint64 sequence); - event LogMessagePublished( - address indexed sender, uint64 sequence, uint32 nonce, bytes payload, uint8 consistencyLevel - ); - event ContractUpgraded(address indexed oldContract, address indexed newContract); - event GuardianSetAdded(uint32 indexed index); + function initialize() external; - function publishMessage(uint32 nonce, bytes memory payload, uint8 consistencyLevel) - external - payable - returns (uint64 sequence); + function parseAndVerifyVM(bytes calldata encodedVM) + external + view + returns (VM memory vm, bool valid, string memory reason); - function initialize() external; + function verifyVM(VM memory vm) external view returns (bool valid, string memory reason); - function parseAndVerifyVM(bytes calldata encodedVM) - external - view - returns (VM memory vm, bool valid, string memory reason); + function verifySignatures( + bytes32 hash, + Signature[] memory signatures, + GuardianSet memory guardianSet + ) external pure returns (bool valid, string memory reason); - function verifyVM(VM memory vm) external view returns (bool valid, string memory reason); + function parseVM(bytes memory encodedVM) external pure returns (VM memory vm); - function verifySignatures(bytes32 hash, Signature[] memory signatures, GuardianSet memory guardianSet) - external - pure - returns (bool valid, string memory reason); + function quorum( + uint256 numGuardians + ) external pure returns (uint256 numSignaturesRequiredForQuorum); - function parseVM(bytes memory encodedVM) external pure returns (VM memory vm); + function getGuardianSet(uint32 index) external view returns (GuardianSet memory); - function quorum(uint256 numGuardians) external pure returns (uint256 numSignaturesRequiredForQuorum); + function getCurrentGuardianSetIndex() external view returns (uint32); - function getGuardianSet(uint32 index) external view returns (GuardianSet memory); + function getGuardianSetExpiry() external view returns (uint32); - function getCurrentGuardianSetIndex() external view returns (uint32); + function governanceActionIsConsumed(bytes32 hash) external view returns (bool); - function getGuardianSetExpiry() external view returns (uint32); + function isInitialized(address impl) external view returns (bool); - function governanceActionIsConsumed(bytes32 hash) external view returns (bool); + function chainId() external view returns (uint16); - function isInitialized(address impl) external view returns (bool); + function isFork() external view returns (bool); - function chainId() external view returns (uint16); + function governanceChainId() external view returns (uint16); - function isFork() external view returns (bool); + function governanceContract() external view returns (bytes32); - function governanceChainId() external view returns (uint16); + function messageFee() external view returns (uint256); - function governanceContract() external view returns (bytes32); + function evmChainId() external view returns (uint256); - function messageFee() external view returns (uint256); + function nextSequence(address emitter) external view returns (uint64); - function evmChainId() external view returns (uint256); + function parseContractUpgrade( + bytes memory encodedUpgrade + ) external pure returns (ContractUpgrade memory cu); - function nextSequence(address emitter) external view returns (uint64); + function parseGuardianSetUpgrade( + bytes memory encodedUpgrade + ) external pure returns (GuardianSetUpgrade memory gsu); - function parseContractUpgrade(bytes memory encodedUpgrade) external pure returns (ContractUpgrade memory cu); + function parseSetMessageFee( + bytes memory encodedSetMessageFee + ) external pure returns (SetMessageFee memory smf); - function parseGuardianSetUpgrade(bytes memory encodedUpgrade) - external - pure - returns (GuardianSetUpgrade memory gsu); + function parseTransferFees( + bytes memory encodedTransferFees + ) external pure returns (TransferFees memory tf); - function parseSetMessageFee(bytes memory encodedSetMessageFee) external pure returns (SetMessageFee memory smf); + function parseRecoverChainId( + bytes memory encodedRecoverChainId + ) external pure returns (RecoverChainId memory rci); - function parseTransferFees(bytes memory encodedTransferFees) external pure returns (TransferFees memory tf); + function submitContractUpgrade(bytes memory _vm) external; - function parseRecoverChainId(bytes memory encodedRecoverChainId) - external - pure - returns (RecoverChainId memory rci); + function submitSetMessageFee(bytes memory _vm) external; - function submitContractUpgrade(bytes memory _vm) external; + function submitNewGuardianSet(bytes memory _vm) external; - function submitSetMessageFee(bytes memory _vm) external; + function submitTransferFees(bytes memory _vm) external; - function submitNewGuardianSet(bytes memory _vm) external; - - function submitTransferFees(bytes memory _vm) external; - - function submitRecoverChainId(bytes memory _vm) external; + function submitRecoverChainId(bytes memory _vm) external; } diff --git a/src/interfaces/IWormholeReceiver.sol b/src/interfaces/IWormholeReceiver.sol index fa5e594..6d7c087 100644 --- a/src/interfaces/IWormholeReceiver.sol +++ b/src/interfaces/IWormholeReceiver.sol @@ -6,46 +6,46 @@ pragma solidity ^0.8.0; * @notice Interface for a contract which can receive Wormhole messages. */ interface IWormholeReceiver { - /** - * @notice 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 checks that `sourceChain` and `sourceAddress` are indeed who - * you expect to have requested the calling of `send` on the source chain - * - * The invocation of this function corresponding to the `send` 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 a `ReceiverFailure`. - * - * @param payload - an arbitrary message which was included in the delivery by the - * requester. This message's signature will already have been verified (as long as msg.sender is the Wormhole Relayer contract) - * @param additionalMessages - Additional messages which were requested to be included in this delivery. - * Note: There are no contract-level guarantees that the messages in this array are what was requested - * so **you should verify any sensitive information given here!** - * - * For example, if a 'VaaKey' was specified on the source chain, then MAKE SURE the corresponding message here - * has valid signatures (by calling `parseAndVerifyVM(message)` on the Wormhole core contract) - * - * This field can be used to perform and relay TokenBridge or CCTP transfers, and there are example - * usages of this at - * https://github.com/wormhole-foundation/hello-token - * https://github.com/wormhole-foundation/hello-cctp - * - * @param sourceAddress - the (wormhole format) address on the sending chain which requested - * this delivery. - * @param sourceChain - the wormhole chain ID where this delivery was requested. - * @param deliveryHash - the VAA hash of the deliveryVAA. - * - */ - function receiveWormholeMessages( - bytes memory payload, - bytes[] memory additionalMessages, - bytes32 sourceAddress, - uint16 sourceChain, - bytes32 deliveryHash - ) external payable; + /** + * @notice 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 checks that `sourceChain` and `sourceAddress` are indeed who + * you expect to have requested the calling of `send` on the source chain + * + * The invocation of this function corresponding to the `send` 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 a `ReceiverFailure`. + * + * @param payload - an arbitrary message which was included in the delivery by the + * requester. This message's signature will already have been verified (as long as msg.sender is the Wormhole Relayer contract) + * @param additionalMessages - Additional messages which were requested to be included in this delivery. + * Note: There are no contract-level guarantees that the messages in this array are what was requested + * so **you should verify any sensitive information given here!** + * + * For example, if a 'VaaKey' was specified on the source chain, then MAKE SURE the corresponding message here + * has valid signatures (by calling `parseAndVerifyVM(message)` on the Wormhole core contract) + * + * This field can be used to perform and relay TokenBridge or CCTP transfers, and there are example + * usages of this at + * https://github.com/wormhole-foundation/hello-token + * https://github.com/wormhole-foundation/hello-cctp + * + * @param sourceAddress - the (wormhole format) address on the sending chain which requested + * this delivery. + * @param sourceChain - the wormhole chain ID where this delivery was requested. + * @param deliveryHash - the VAA hash of the deliveryVAA. + * + */ + function receiveWormholeMessages( + bytes memory payload, + bytes[] memory additionalMessages, + bytes32 sourceAddress, + uint16 sourceChain, + bytes32 deliveryHash + ) external payable; } diff --git a/src/interfaces/IWormholeRelayer.sol b/src/interfaces/IWormholeRelayer.sol index c41dcba..b219abd 100644 --- a/src/interfaces/IWormholeRelayer.sol +++ b/src/interfaces/IWormholeRelayer.sol @@ -2,8 +2,6 @@ pragma solidity ^0.8.0; -import {NotAnEvmAddress} from "wormhole-sdk/Utils.sol"; - /** * @title WormholeRelayer * @author @@ -22,51 +20,51 @@ import {NotAnEvmAddress} from "wormhole-sdk/Utils.sol"; * @custom:member sequence Sequence number of the VAA */ struct VaaKey { - uint16 chainId; - bytes32 emitterAddress; - uint64 sequence; + uint16 chainId; + bytes32 emitterAddress; + uint64 sequence; } // 0-127 are reserved for standardized KeyTypes, 128-255 are for custom use uint8 constant VAA_KEY_TYPE = 1; struct MessageKey { - uint8 keyType; // 0-127 are reserved for standardized KeyTypes, 128-255 are for custom use - bytes encodedKey; + uint8 keyType; // 0-127 are reserved for standardized KeyTypes, 128-255 are for custom use + bytes encodedKey; } interface IWormholeRelayerBase { - event SendEvent( - uint64 indexed sequence, - uint256 deliveryQuote, - uint256 paymentForExtraReceiverValue - ); + event SendEvent( + uint64 indexed sequence, + uint256 deliveryQuote, + uint256 paymentForExtraReceiverValue + ); - function getRegisteredWormholeRelayerContract( - uint16 chainId - ) external view returns (bytes32); - - /** - * @notice Returns true if a delivery has been attempted for the given deliveryHash - * Note: invalid deliveries where the tx reverts are not considered attempted - */ - function deliveryAttempted( - bytes32 deliveryHash - ) external view returns (bool attempted); - - /** - * @notice block number at which a delivery was successfully executed - */ - function deliverySuccessBlock( - bytes32 deliveryHash - ) external view returns (uint256 blockNumber); - - /** - * @notice block number of the latest attempt to execute a delivery that failed - */ - function deliveryFailureBlock( - bytes32 deliveryHash - ) external view returns (uint256 blockNumber); + function getRegisteredWormholeRelayerContract( + uint16 chainId + ) external view returns (bytes32); + + /** + * @notice Returns true if a delivery has been attempted for the given deliveryHash + * Note: invalid deliveries where the tx reverts are not considered attempted + */ + function deliveryAttempted( + bytes32 deliveryHash + ) external view returns (bool attempted); + + /** + * @notice block number at which a delivery was successfully executed + */ + function deliverySuccessBlock( + bytes32 deliveryHash + ) external view returns (uint256 blockNumber); + + /** + * @notice block number of the latest attempt to execute a delivery that failed + */ + function deliveryFailureBlock( + bytes32 deliveryHash + ) external view returns (uint256 blockNumber); } /** @@ -74,461 +72,461 @@ interface IWormholeRelayerBase { * @notice The interface to request deliveries */ interface IWormholeRelayerSend is IWormholeRelayerBase { - /** - * @notice 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 - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. - * @return sequence sequence number of published VAA containing delivery instructions - */ - function sendPayloadToEvm( - uint16 targetChain, - address targetAddress, - bytes memory payload, - uint256 receiverValue, - uint256 gasLimit - ) external payable returns (uint64 sequence); - - /** - * @notice 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)` - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the - * `targetChainRefundPerGasUnused` rate quoted by the delivery provider - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to - * @return sequence sequence number of published VAA containing delivery instructions - */ - function sendPayloadToEvm( - uint16 targetChain, - address targetAddress, - bytes memory payload, - uint256 receiverValue, - uint256 gasLimit, - uint16 refundChain, - address refundAddress - ) external payable returns (uint64 sequence); - - /** - * @notice 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 - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. - * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` - * @return sequence sequence number of published VAA containing delivery instructions - */ - function sendVaasToEvm( - uint16 targetChain, - address targetAddress, - bytes memory payload, - uint256 receiverValue, - uint256 gasLimit, - VaaKey[] memory vaaKeys - ) external payable returns (uint64 sequence); - - /** - * @notice 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)` - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the - * `targetChainRefundPerGasUnused` rate quoted by the delivery provider - * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to - * @return sequence sequence number of published VAA containing delivery instructions - */ - 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); - - /** - * @notice 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 - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue - * (in addition to the `receiverValue` specified) - * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the - * `targetChainRefundPerGasUnused` rate quoted by the delivery provider - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` - * @param consistencyLevel Consistency level with which to publish the delivery instructions - see - * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels - * @return sequence sequence number of published VAA containing delivery instructions - */ - 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); - - /** - * @notice Publishes an instruction for the delivery provider at `deliveryProviderAddress` - * to relay a payload and external messages specified by `messageKeys` 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 - * - * Note: MessageKeys can specify wormhole messages (VaaKeys) or other types of messages (ex. USDC CCTP attestations). Ensure the selected - * DeliveryProvider supports all the MessageKey.keyType values specified or it will not be delivered! - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue - * (in addition to the `receiverValue` specified) - * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the - * `targetChainRefundPerGasUnused` rate quoted by the delivery provider - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @param messageKeys Additional messagess to pass in as parameter in call to `targetAddress` - * @param consistencyLevel Consistency level with which to publish the delivery instructions - see - * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels - * @return sequence sequence number of published VAA containing delivery instructions - */ - function sendToEvm( - uint16 targetChain, - address targetAddress, - bytes memory payload, - uint256 receiverValue, - uint256 paymentForExtraReceiverValue, - uint256 gasLimit, - uint16 refundChain, - address refundAddress, - address deliveryProviderAddress, - MessageKey[] memory messageKeys, - uint8 consistencyLevel - ) external payable returns (uint64 sequence); - - /** - * @notice 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 - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver), in Wormhole bytes32 format - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue - * (in addition to the `receiverValue` specified) - * @param encodedExecutionParameters 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` - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to, in Wormhole bytes32 format - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` - * @param consistencyLevel Consistency level with which to publish the delivery instructions - see - * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels - * @return sequence sequence number of published VAA containing delivery instructions - */ - 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); - - /** - * @notice 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 - * - * Note: MessageKeys can specify wormhole messages (VaaKeys) or other types of messages (ex. USDC CCTP attestations). Ensure the selected - * DeliveryProvider supports all the MessageKey.keyType values specified or it will not be delivered! - * - * @param targetChain in Wormhole Chain ID format - * @param targetAddress address to call on targetChain (that implements IWormholeReceiver), in Wormhole bytes32 format - * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue - * (in addition to the `receiverValue` specified) - * @param encodedExecutionParameters 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` - * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format - * @param refundAddress The address on `refundChain` to deliver any refund to, in Wormhole bytes32 format - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @param messageKeys Additional messagess to pass in as parameter in call to `targetAddress` - * @param consistencyLevel Consistency level with which to publish the delivery instructions - see - * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels - * @return sequence sequence number of published VAA containing delivery instructions - */ - function send( - uint16 targetChain, - bytes32 targetAddress, - bytes memory payload, - uint256 receiverValue, - uint256 paymentForExtraReceiverValue, - bytes memory encodedExecutionParameters, - uint16 refundChain, - bytes32 refundAddress, - address deliveryProviderAddress, - MessageKey[] memory messageKeys, - uint8 consistencyLevel - ) external payable returns (uint64 sequence); - - /** - * @notice 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) - * - * @notice *** 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` - * - * @param deliveryVaaKey VaaKey identifying the wormhole message containing the - * previously published delivery instructions - * @param targetChain The target chain that the original delivery targeted. Must match targetChain from original delivery instructions - * @param newReceiverValue new msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param newGasLimit gas 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 - * @param newDeliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @return sequence sequence number of published VAA containing redelivery instructions - * - * @notice *** 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 - */ - function resendToEvm( - VaaKey memory deliveryVaaKey, - uint16 targetChain, - uint256 newReceiverValue, - uint256 newGasLimit, - address newDeliveryProviderAddress - ) external payable returns (uint64 sequence); - - /** - * @notice Requests a previously published delivery instruction to be redelivered - * - * - * This function must be called with `msg.value` equal to - * quoteDeliveryPrice(targetChain, newReceiverValue, newEncodedExecutionParameters, newDeliveryProviderAddress) - * - * @param deliveryVaaKey VaaKey identifying the wormhole message containing the - * previously published delivery instructions - * @param targetChain The target chain that the original delivery targeted. Must match targetChain from original delivery instructions - * @param newReceiverValue new msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param newEncodedExecutionParameters new 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` - * @param newDeliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @return sequence sequence number of published VAA containing redelivery instructions - * - * @notice *** 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); - - /** - * @notice Returns the price to request a relay to chain `targetChain`, using the default delivery provider - * - * @param targetChain in Wormhole Chain ID format - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. - * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay - * @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused, - * if a refundAddress is specified. - * Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a - * promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain. - * If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain. - */ - function quoteEVMDeliveryPrice( - uint16 targetChain, - uint256 receiverValue, - uint256 gasLimit - ) - external - view - returns ( - uint256 nativePriceQuote, - uint256 targetChainRefundPerGasUnused - ); - - /** - * @notice Returns the price to request a relay to chain `targetChain`, using delivery provider `deliveryProviderAddress` - * - * @param targetChain in Wormhole Chain ID format - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param gasLimit gas limit with which to call `targetAddress`. - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay - * @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused, - * if a refundAddress is specified - * Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a - * promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain. - * If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain. - */ - function quoteEVMDeliveryPrice( - uint16 targetChain, - uint256 receiverValue, - uint256 gasLimit, - address deliveryProviderAddress - ) - external - view - returns ( - uint256 nativePriceQuote, - uint256 targetChainRefundPerGasUnused - ); - - /** - * @notice Returns the price to request a relay to chain `targetChain`, using delivery provider `deliveryProviderAddress` - * - * @param targetChain in Wormhole Chain ID format - * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) - * @param encodedExecutionParameters 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` - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay - * @return encodedExecutionInfo encoded 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) - */ - function quoteDeliveryPrice( - uint16 targetChain, - uint256 receiverValue, - bytes memory encodedExecutionParameters, - address deliveryProviderAddress - ) - external - view - returns (uint256 nativePriceQuote, bytes memory encodedExecutionInfo); - - /** - * @notice Returns the (extra) amount of target chain currency that `targetAddress` - * will be called with, if the `paymentForExtraReceiverValue` field is set to `currentChainAmount` - * - * @param targetChain in Wormhole Chain ID format - * @param currentChainAmount The value that `paymentForExtraReceiverValue` will be set to - * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider - * @return targetChainAmount The amount such that if `targetAddress` will be called with `msg.value` equal to - * receiverValue + targetChainAmount - */ - function quoteNativeForChain( - uint16 targetChain, - uint256 currentChainAmount, - address deliveryProviderAddress - ) external view returns (uint256 targetChainAmount); - - /** - * @notice Returns the address of the current default delivery provider - * @return deliveryProvider The address of (the default delivery provider)'s contract on this source - * chain. This must be a contract that implements IDeliveryProvider. - */ - function getDefaultDeliveryProvider() - external - view - returns (address deliveryProvider); + /** + * @notice 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 + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. + * @return sequence sequence number of published VAA containing delivery instructions + */ + function sendPayloadToEvm( + uint16 targetChain, + address targetAddress, + bytes memory payload, + uint256 receiverValue, + uint256 gasLimit + ) external payable returns (uint64 sequence); + + /** + * @notice 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)` + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the + * `targetChainRefundPerGasUnused` rate quoted by the delivery provider + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to + * @return sequence sequence number of published VAA containing delivery instructions + */ + function sendPayloadToEvm( + uint16 targetChain, + address targetAddress, + bytes memory payload, + uint256 receiverValue, + uint256 gasLimit, + uint16 refundChain, + address refundAddress + ) external payable returns (uint64 sequence); + + /** + * @notice 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 + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. + * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` + * @return sequence sequence number of published VAA containing delivery instructions + */ + function sendVaasToEvm( + uint16 targetChain, + address targetAddress, + bytes memory payload, + uint256 receiverValue, + uint256 gasLimit, + VaaKey[] memory vaaKeys + ) external payable returns (uint64 sequence); + + /** + * @notice 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)` + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the + * `targetChainRefundPerGasUnused` rate quoted by the delivery provider + * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to + * @return sequence sequence number of published VAA containing delivery instructions + */ + 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); + + /** + * @notice 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 + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue + * (in addition to the `receiverValue` specified) + * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the + * `targetChainRefundPerGasUnused` rate quoted by the delivery provider + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` + * @param consistencyLevel Consistency level with which to publish the delivery instructions - see + * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels + * @return sequence sequence number of published VAA containing delivery instructions + */ + 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); + + /** + * @notice Publishes an instruction for the delivery provider at `deliveryProviderAddress` + * to relay a payload and external messages specified by `messageKeys` 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 + * + * Note: MessageKeys can specify wormhole messages (VaaKeys) or other types of messages (ex. USDC CCTP attestations). Ensure the selected + * DeliveryProvider supports all the MessageKey.keyType values specified or it will not be delivered! + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver) + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue + * (in addition to the `receiverValue` specified) + * @param gasLimit gas limit with which to call `targetAddress`. Any units of gas unused will be refunded according to the + * `targetChainRefundPerGasUnused` rate quoted by the delivery provider + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @param messageKeys Additional messagess to pass in as parameter in call to `targetAddress` + * @param consistencyLevel Consistency level with which to publish the delivery instructions - see + * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels + * @return sequence sequence number of published VAA containing delivery instructions + */ + function sendToEvm( + uint16 targetChain, + address targetAddress, + bytes memory payload, + uint256 receiverValue, + uint256 paymentForExtraReceiverValue, + uint256 gasLimit, + uint16 refundChain, + address refundAddress, + address deliveryProviderAddress, + MessageKey[] memory messageKeys, + uint8 consistencyLevel + ) external payable returns (uint64 sequence); + + /** + * @notice 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 + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver), in Wormhole bytes32 format + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue + * (in addition to the `receiverValue` specified) + * @param encodedExecutionParameters 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` + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to, in Wormhole bytes32 format + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @param vaaKeys Additional VAAs to pass in as parameter in call to `targetAddress` + * @param consistencyLevel Consistency level with which to publish the delivery instructions - see + * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels + * @return sequence sequence number of published VAA containing delivery instructions + */ + 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); + + /** + * @notice 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 + * + * Note: MessageKeys can specify wormhole messages (VaaKeys) or other types of messages (ex. USDC CCTP attestations). Ensure the selected + * DeliveryProvider supports all the MessageKey.keyType values specified or it will not be delivered! + * + * @param targetChain in Wormhole Chain ID format + * @param targetAddress address to call on targetChain (that implements IWormholeReceiver), in Wormhole bytes32 format + * @param payload arbitrary bytes to pass in as parameter in call to `targetAddress` + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param paymentForExtraReceiverValue amount (in current chain currency units) to spend on extra receiverValue + * (in addition to the `receiverValue` specified) + * @param encodedExecutionParameters 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` + * @param refundChain The chain to deliver any refund to, in Wormhole Chain ID format + * @param refundAddress The address on `refundChain` to deliver any refund to, in Wormhole bytes32 format + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @param messageKeys Additional messagess to pass in as parameter in call to `targetAddress` + * @param consistencyLevel Consistency level with which to publish the delivery instructions - see + * https://book.wormhole.com/wormhole/3_coreLayerContracts.html?highlight=consistency#consistency-levels + * @return sequence sequence number of published VAA containing delivery instructions + */ + function send( + uint16 targetChain, + bytes32 targetAddress, + bytes memory payload, + uint256 receiverValue, + uint256 paymentForExtraReceiverValue, + bytes memory encodedExecutionParameters, + uint16 refundChain, + bytes32 refundAddress, + address deliveryProviderAddress, + MessageKey[] memory messageKeys, + uint8 consistencyLevel + ) external payable returns (uint64 sequence); + + /** + * @notice 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) + * + * @notice *** 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` + * + * @param deliveryVaaKey VaaKey identifying the wormhole message containing the + * previously published delivery instructions + * @param targetChain The target chain that the original delivery targeted. Must match targetChain from original delivery instructions + * @param newReceiverValue new msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param newGasLimit gas 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 + * @param newDeliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @return sequence sequence number of published VAA containing redelivery instructions + * + * @notice *** 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 + */ + function resendToEvm( + VaaKey memory deliveryVaaKey, + uint16 targetChain, + uint256 newReceiverValue, + uint256 newGasLimit, + address newDeliveryProviderAddress + ) external payable returns (uint64 sequence); + + /** + * @notice Requests a previously published delivery instruction to be redelivered + * + * + * This function must be called with `msg.value` equal to + * quoteDeliveryPrice(targetChain, newReceiverValue, newEncodedExecutionParameters, newDeliveryProviderAddress) + * + * @param deliveryVaaKey VaaKey identifying the wormhole message containing the + * previously published delivery instructions + * @param targetChain The target chain that the original delivery targeted. Must match targetChain from original delivery instructions + * @param newReceiverValue new msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param newEncodedExecutionParameters new 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` + * @param newDeliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @return sequence sequence number of published VAA containing redelivery instructions + * + * @notice *** 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); + + /** + * @notice Returns the price to request a relay to chain `targetChain`, using the default delivery provider + * + * @param targetChain in Wormhole Chain ID format + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. + * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay + * @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused, + * if a refundAddress is specified. + * Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a + * promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain. + * If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain. + */ + function quoteEVMDeliveryPrice( + uint16 targetChain, + uint256 receiverValue, + uint256 gasLimit + ) + external + view + returns ( + uint256 nativePriceQuote, + uint256 targetChainRefundPerGasUnused + ); + + /** + * @notice Returns the price to request a relay to chain `targetChain`, using delivery provider `deliveryProviderAddress` + * + * @param targetChain in Wormhole Chain ID format + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param gasLimit gas limit with which to call `targetAddress`. + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay + * @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused, + * if a refundAddress is specified + * Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a + * promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain. + * If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain. + */ + function quoteEVMDeliveryPrice( + uint16 targetChain, + uint256 receiverValue, + uint256 gasLimit, + address deliveryProviderAddress + ) + external + view + returns ( + uint256 nativePriceQuote, + uint256 targetChainRefundPerGasUnused + ); + + /** + * @notice Returns the price to request a relay to chain `targetChain`, using delivery provider `deliveryProviderAddress` + * + * @param targetChain in Wormhole Chain ID format + * @param receiverValue msg.value that delivery provider should pass in for call to `targetAddress` (in targetChain currency units) + * @param encodedExecutionParameters 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` + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay + * @return encodedExecutionInfo encoded 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) + */ + function quoteDeliveryPrice( + uint16 targetChain, + uint256 receiverValue, + bytes memory encodedExecutionParameters, + address deliveryProviderAddress + ) + external + view + returns (uint256 nativePriceQuote, bytes memory encodedExecutionInfo); + + /** + * @notice Returns the (extra) amount of target chain currency that `targetAddress` + * will be called with, if the `paymentForExtraReceiverValue` field is set to `currentChainAmount` + * + * @param targetChain in Wormhole Chain ID format + * @param currentChainAmount The value that `paymentForExtraReceiverValue` will be set to + * @param deliveryProviderAddress The address of the desired delivery provider's implementation of IDeliveryProvider + * @return targetChainAmount The amount such that if `targetAddress` will be called with `msg.value` equal to + * receiverValue + targetChainAmount + */ + function quoteNativeForChain( + uint16 targetChain, + uint256 currentChainAmount, + address deliveryProviderAddress + ) external view returns (uint256 targetChainAmount); + + /** + * @notice Returns the address of the current default delivery provider + * @return deliveryProvider The address of (the default delivery provider)'s contract on this source + * chain. This must be a contract that implements IDeliveryProvider. + */ + function getDefaultDeliveryProvider() + external + view + returns (address deliveryProvider); } /** @@ -536,83 +534,83 @@ interface IWormholeRelayerSend is IWormholeRelayerBase { * @notice The interface to execute deliveries. Only relevant for Delivery Providers */ interface IWormholeRelayerDelivery is IWormholeRelayerBase { - enum DeliveryStatus { - SUCCESS, - RECEIVER_FAILURE - } - - enum RefundStatus { - REFUND_SENT, - REFUND_FAIL, - CROSS_CHAIN_REFUND_SENT, - CROSS_CHAIN_REFUND_FAIL_PROVIDER_NOT_SUPPORTED, - CROSS_CHAIN_REFUND_FAIL_NOT_ENOUGH, - NO_REFUND_REQUESTED - } - - /** - * @custom:member recipientContract - The target contract address - * @custom:member sourceChain - The chain which this delivery was requested from (in wormhole - * ChainID format) - * @custom:member sequence - The wormhole sequence number of the delivery VAA on the source chain - * corresponding to this delivery request - * @custom:member deliveryVaaHash - The hash of the delivery VAA corresponding to this delivery - * request - * @custom:member gasUsed - The amount of gas that was used to call your target contract - * @custom:member status: - * - RECEIVER_FAILURE, if the target contract reverts - * - SUCCESS, if the target contract doesn't revert - * @custom:member additionalStatusInfo: - * - If status is SUCCESS, then this is empty. - * - If status is RECEIVER_FAILURE, this is `RETURNDATA_TRUNCATION_THRESHOLD` bytes of the - * return data (i.e. potentially truncated revert reason information). - * @custom:member refundStatus - Result of the refund. REFUND_SUCCESS or REFUND_FAIL are for - * refunds where targetChain=refundChain; the others are for targetChain!=refundChain, - * where a cross chain refund is necessary, or if the default code path is used where no refund is requested (NO_REFUND_REQUESTED) - * @custom:member overridesInfo: - * - If not an override: empty bytes array - * - Otherwise: An encoded `DeliveryOverride` - */ - event Delivery( - address indexed recipientContract, - uint16 indexed sourceChain, - uint64 indexed sequence, - bytes32 deliveryVaaHash, - DeliveryStatus status, - uint256 gasUsed, - RefundStatus refundStatus, - bytes additionalStatusInfo, - bytes overridesInfo - ); - - /** - * @notice The delivery provider calls `deliver` to relay messages as described by one delivery instruction - * - * The delivery provider must pass in the specified (by VaaKeys[]) signed wormhole messages (VAAs) from the source chain - * as well as the signed wormhole message with the delivery instructions (the delivery VAA) - * - * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: - * - the delivery VAA has a valid signature - * - the delivery VAA's emitter is one of these WormholeRelayer contracts - * - the delivery provider passed in at least enough of this chain's currency as msg.value (enough meaning the maximum possible refund) - * - the instruction's target chain is this chain - * - the relayed signed VAAs match the descriptions in container.messages (the VAA hashes match, or the emitter address, sequence number pair matches, depending on the description given) - * - * @param encodedVMs - An array of signed wormhole messages (all from the same source chain - * transaction) - * @param encodedDeliveryVAA - Signed wormhole message from the source chain's WormholeRelayer - * contract with payload being the encoded delivery instruction container - * @param relayerRefundAddress - The address to which any refunds to the delivery provider - * should be sent - * @param deliveryOverrides - Optional overrides field which must be either an empty bytes array or - * an encoded DeliveryOverride struct - */ - function deliver( - bytes[] memory encodedVMs, - bytes memory encodedDeliveryVAA, - address payable relayerRefundAddress, - bytes memory deliveryOverrides - ) external payable; + enum DeliveryStatus { + SUCCESS, + RECEIVER_FAILURE + } + + enum RefundStatus { + REFUND_SENT, + REFUND_FAIL, + CROSS_CHAIN_REFUND_SENT, + CROSS_CHAIN_REFUND_FAIL_PROVIDER_NOT_SUPPORTED, + CROSS_CHAIN_REFUND_FAIL_NOT_ENOUGH, + NO_REFUND_REQUESTED + } + + /** + * @custom:member recipientContract - The target contract address + * @custom:member sourceChain - The chain which this delivery was requested from (in wormhole + * ChainID format) + * @custom:member sequence - The wormhole sequence number of the delivery VAA on the source chain + * corresponding to this delivery request + * @custom:member deliveryVaaHash - The hash of the delivery VAA corresponding to this delivery + * request + * @custom:member gasUsed - The amount of gas that was used to call your target contract + * @custom:member status: + * - RECEIVER_FAILURE, if the target contract reverts + * - SUCCESS, if the target contract doesn't revert + * @custom:member additionalStatusInfo: + * - If status is SUCCESS, then this is empty. + * - If status is RECEIVER_FAILURE, this is `RETURNDATA_TRUNCATION_THRESHOLD` bytes of the + * return data (i.e. potentially truncated revert reason information). + * @custom:member refundStatus - Result of the refund. REFUND_SUCCESS or REFUND_FAIL are for + * refunds where targetChain=refundChain; the others are for targetChain!=refundChain, + * where a cross chain refund is necessary, or if the default code path is used where no refund is requested (NO_REFUND_REQUESTED) + * @custom:member overridesInfo: + * - If not an override: empty bytes array + * - Otherwise: An encoded `DeliveryOverride` + */ + event Delivery( + address indexed recipientContract, + uint16 indexed sourceChain, + uint64 indexed sequence, + bytes32 deliveryVaaHash, + DeliveryStatus status, + uint256 gasUsed, + RefundStatus refundStatus, + bytes additionalStatusInfo, + bytes overridesInfo + ); + + /** + * @notice The delivery provider calls `deliver` to relay messages as described by one delivery instruction + * + * The delivery provider must pass in the specified (by VaaKeys[]) signed wormhole messages (VAAs) from the source chain + * as well as the signed wormhole message with the delivery instructions (the delivery VAA) + * + * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: + * - the delivery VAA has a valid signature + * - the delivery VAA's emitter is one of these WormholeRelayer contracts + * - the delivery provider passed in at least enough of this chain's currency as msg.value (enough meaning the maximum possible refund) + * - the instruction's target chain is this chain + * - the relayed signed VAAs match the descriptions in container.messages (the VAA hashes match, or the emitter address, sequence number pair matches, depending on the description given) + * + * @param encodedVMs - An array of signed wormhole messages (all from the same source chain + * transaction) + * @param encodedDeliveryVAA - Signed wormhole message from the source chain's WormholeRelayer + * contract with payload being the encoded delivery instruction container + * @param relayerRefundAddress - The address to which any refunds to the delivery provider + * should be sent + * @param deliveryOverrides - Optional overrides field which must be either an empty bytes array or + * an encoded DeliveryOverride struct + */ + function deliver( + bytes[] memory encodedVMs, + bytes memory encodedDeliveryVAA, + address payable relayerRefundAddress, + bytes memory deliveryOverrides + ) external payable; } interface IWormholeRelayer is IWormholeRelayerDelivery, IWormholeRelayerSend {} @@ -632,8 +630,8 @@ error InvalidMsgValue(uint256 msgValue, uint256 totalFee); error RequestedGasLimitTooLow(); error DeliveryProviderDoesNotSupportTargetChain( - address relayer, - uint16 chainId + address relayer, + uint16 chainId ); error DeliveryProviderCannotReceivePayment(); error DeliveryProviderDoesNotSupportMessageKeyType(uint8 keyType);