Hyperlane Adapter
Lucid has developed an adapter that integrates with the Hyperlane messaging bridge to send and receive cross-chain messages.
Fees
Hyperlane supports on-chain fee quoting, 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 full transaction cost, including any applicable protocol fees.
Hyperlane can refund excess gas fees if more than the required amount is sent. Using its on-chain quote function, the Hyperlane Adapter contract will determine whether any excess Ether was included and refund it to the refundAddress
specified in the options
field.
Interfaces
Each adapter implements the following public functions:
relayMessage
function relayMessage( uint256 destChainId, address destination, bytes memory options, bytes calldata message ) external payable returns (bytes32)
Sends a message through the Hyperlane bridge, deducts the protocol fee, and pays the necessary bridge fee.
The Ether value sent by the calling contract must cover both the Hyperlane fee and the Lucid protocol fee.
If excess funds are sent, they are refunded to the
refundAddress
.Returns a bytes32 value representing the transferId generated by Hyperlane.
Input Params:
uint256
destChainId
The destination chain ID.
address
destination
The destination address.
bytes
options
Additional params to be used by the adapter. In Hyperlane, an abi-encoded Options struct of refundAddress
and gasLimit
(address, uint256)
bytes
message
The message to be relayed.
/// @notice Options to be used when sending a message to Hyperlane
struct Options {
address refundAddress;
uint256 gasLimit;
}
quoteMessage
function quoteMessage( address destination, uint256 chainId, uint256 gasLimit, bytes calldata message, bool includeFee ) external view returns (uint256)
Calculates the total fee required to send a message using Hyperlane’s on-chain quoting function. Returns the estimated fee amount in Ether.
Input Params:
address
destination
The destination address
uint256
chainId
The destination chain ID
uint256
gasLimit
The gas limit required for the execution in the destination chain
bytes
message
The message data that is sent across
bool
includeFee
Whether to include the protocol fee in the calculation
Last updated