Skip to content

CCIP Adapter

Lucid has developed an adapter that integrates with Chainlink’s Cross-Chain Interoperability Protocol (CCIP) to send and receive messages across chains.

Fees

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

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

Unlike some bridges, CCIP does not refund excess gas fees by default. However, using the on-chain quote functionality, the CCIP Adapter contract will determine if any excess Ether was sent and refund 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 CCIP bridge, deducts the protocol fee, and pays the required CCIP fee.

  • The refundAddress and the gasLimit of the transaction on destination must be ABI-encoded within the options bytes (see the Options struct below).
  • The Ether sent by the calling contract must cover both the CCIP fee and the Lucid protocol fee.
  • If excess funds are sent, the contract will refund the difference to the refundAddress.
  • Returns a bytes32 value representing the transferId generated by CCIP.

Input Params:

TypeNameDescription
uint256destChainIdThe destination chain ID.
addressdestinationThe destination address.
bytesoptionsAdditional params to be used by each adapter. In CCIP it's an ABI-encoded Options struct.
bytesmessageThe message to be relayed.
solidity
    /// @notice Options to be used when sending a message to CCIP
    struct Options {
        address refundAddress;
        uint256 gasLimit;
    }

quoteMessage

solidity
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 CCIP’s on-chain quoting functionality. Returns the estimated fee amount in Ether.

Input Params:

TypeNameDescription
addressdestinationThe destination address
uint256chainIdThe destination chain ID
uint256gasLimitThe gas limit required for the execution in the destination chain
bytesmessageThe message data that is sent across
boolincludeFeeWhether to include the protocol fee in the calculation