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
  • Overview
  • Functionality
  • Fees
  • Interfaces
  • Public Functions
  • View Functions
  1. Developer Reference

Adapters

Overview

Adapters are smart contracts that integrate with specific bridges and are used by other contracts—such as Message Controllers, Asset Controllers, and others—that need to communicate across chains. Lucid develops and deploys these adapter contracts across all chains supported by both Lucid and the corresponding bridge.

Adapter contracts are permissionless, meaning anyone can call them to relay a message to a supported chain, as long as an adapter contract exists for that target chain.

Functionality

An adapter's primary role is to relay and receive messages to and from the bridge. These messages are typically sent by a contract on the same chain, such as a Message Controller.

The adapter:

  • Repackages the message to include the original msg.sender (typically the Message Controller) and the destination address (usually the Message Controller on the destination chain)

  • Does not inspect or modify the message content; it supports arbitrary bytes[] data

  • Uses the bridge to relay the message to the corresponding adapter on the destination chain

On the destination chain, the adapter:

  • Unpacks the message to recover the original msg.sender from the source chain and the intended destination address

  • Forwards the original message to the destination contract

Fees

The system charges a protocol fee for relaying messages between chains. This fee is calculated as a percentage of the value being sent (i.e., the bridge fee).

By default, the protocol fee is set to 30% for all bridge adapters.

Interfaces

Public Functions

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 to the Bridge, paying any fees to the bridge and deducting the protocol fee. Any excess fees are returned to the refundAddress.

Input Params:

Type
Name
Description

uint256

destChainId

The destination chain ID.

address

destination

The destination address.

bytes

options

Additional params to be used by each adapter. Usually the refund address and the gas limit.

bytes

message

The message to be relayed.

The function returns a bytes32 transferId for the bridges that support it.


View Functions

Each adapter implements the following view functions:

isChainSupported

function isChainIdSupported(uint256 chainId) public view returns (bool);

Checks if a given chain ID is supported by the adapter.


trustedAdapters()

function trustedAdapters(uint256 chainId) external view returns (address);

Returns the contract address of the Adapter for a given chain id. Will return address(0) if an adapter doesn't exist on that chain.


isTrustedAdapter()

function isTrustedAdapter(uint256 chainId, address adapter) external view returns (bool);

Returns true if the given adapter is a trusted adapter for the specified chain ID

PreviousAdmin FunctionsNextAxelar Adapter

Last updated 1 month ago