Lucid
  • USING LUCID
    • Welcome to Lucid
    • Homepage
    • Explore Page
    • Organisation Summary Page
    • Sidebar Navigation
  • Organisation Creation Page
  • Creating an Organisation
    • 1. Setup Organisation Details
    • 2. Module Selection
    • 3. Module Configuration
    • 4. Safe and Protocol Upgrades Configuration
    • 5. Governor Configuration
    • 6. Veto and Multi-Bridge Configuration
    • 7. Token Configuration
    • 8. Asset Transfer Portals Configuration
    • 9. Review and Deploy Organisation
    • 10. Lucid Post-Deployment Integration
  • Editing an Organisation
  • Modules and integrations
    • Multi-Bridge
      • Multi-Bridge Asset Transfers
      • Multi-Bridge Message and Asset Transfers
      • Resend Transaction
    • Bridge Portals
    • Vested Emission Offerings (VEOs)
      • VEO Purchase Flow
      • VEO Creation Flow
      • VEO Removal Flow
      • Claiming Vested Tokens
    • Wizard | Protocol Upgrades
  • Developer Reference
    • VEOs
      • Vesting Options
      • Price Models
      • Debt Buffer
      • Deposit Interval
    • Message Bridging
      • Sending a Message
      • Message Execution
      • Admin Functions
    • Asset Bridging
      • Bridging Assets
      • Admin Functions
    • Adapters
      • Axelar Adapter
      • CCIP Adapter
      • Connext Adapter
      • Hyperlane Adapter
      • LayerZero Adapter
      • Polymer Adapter
      • Wormhole Adapter
    • Deployed Contracts
      • Multibridge Contracts
      • VEO Contracts
  • API Reference
  • RESOURCES
    • About
    • Fees
      • Lucid Pricing and Fee Structure
      • Fee Estimates for Bridges
    • Frequently Asked Questions
    • Key Terms and Explanations
    • Contact
Powered by GitBook
On this page
  • Fees
  • Interfaces
  1. Developer Reference
  2. Adapters

LayerZero Adapter

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

Fees

LayerZero 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 total cost of the transaction, including any protocol fees.

LayerZero refunds any excess gas fees that were sent. All fees are paid in the native currency (e.g., ETH, POL), not in ZRO tokens.

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 LayerZero bridge, paying the bridge fee and deducting the protocol fee.

  • The Ether sent by the calling contract must cover both the LayerZero fee and the Lucid protocol fee.

  • Any excess Ether is refunded to the refundAddress.

  • The function returns a bytes32 of the guid as generated from LayerZero

Input Params:

Type
Name
Description

uint256

destChainId

The destination chain ID.

address

destination

The destination address.

bytes

options

Additional params to be used by the adapter, 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 LayerZero
    struct Options {
        address refundAddress;
        uint128 gasLimit;
    }

quoteMessage

function quoteMessage( address destination, uint256 chainId, uint256 gasLimit, bytes calldata message, bool includeFee ) external view returns (uint256)

Calculates the total fee required for sending a message using LayerZero’s on-chain quoting mechanism. Returns the estimated fee amount in Ether.

Input Params:

Type
Name
Description

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

PreviousHyperlane AdapterNextPolymer Adapter

Last updated 27 days ago