Skip to content

Wormhole Adapter ​

Lucid has developed an adapter that integrates with the Wormhole messaging bridge to send and receive cross-chain messages.

Fees ​

Wormhole supports on-chain fee quoting, based on a gas limit of the transaction on the destination, which the adapter contract uses to estimate the total fees required for a message.

When sending or exporting a transaction from the Lucid App, Lucid automatically calculates the necessary fees, including any applicable protocol fees.

Wormhole also refunds any excess gas fees that are sent. Using the on-chain quote function, the Wormhole Adapter contract determines whether any excess Ether was included and refunds it to the refundAddress specified in the options field.

Interfaces ​

Each adapter implements the following public functions:

relayMessage ​

solidity
function relayMessage( uint256 destChainId, address destination, bytes memory options, bytes calldata message ) external payable returns (bytes32)

Sends a message through the Wormhole bridge, deducting the protocol fee and paying the required bridge fee.

  • The Ether value sent by the calling contract must include both the Wormhole fee and the Lucid protocol fee.
  • Any excess fees are refunded to the refundAddress and the refundChainId specified in the Options struct.
  • Returns a bytes32 value representing the sequenceId (cast from a uint256) as generated by Wormhole.

Input Params:

TypeNameDescription
uint256destChainIdThe destination chain ID.
addressdestinationThe destination address.
bytesoptionsAdditional params to be used by the adapter, an abi encoded Options struct (see below)
bytesmessageThe message to be relayed.
solidity
    /// @notice Options to be used when sending a message to Wormhole
    struct Options {
        address refundAddress;
        uint256 refundChainId;
        uint256 gasLimit;
    }

quoteMessage ​

solidity
function quoteMessage(uint256 chainId, uint256 gasLimit, bool includeFee) external view returns (uint256)

Calculates the total fee required to send a message using Wormhole’s on-chain quoting mechanism. Returns the estimated fee amount in Ether.

Input Params:

TypeNameDescription
uint256chainIdThe destination chain ID
uint256gasLimitThe gas limit required for the execution in the destination chain
boolincludeFeeWhether to include the protocol fee in the calculation