Adapters
Overview
Adapters are smart contracts that integrate with a specific bridge and are used by other contracts (such as Message Controllers, Asset Controllers, etc.) that need to communicate with the bridge. Lucid develops and deploys these adapter contracts across all the chains supported by both Lucid and the bridge. Adapter contracts are permissionless, meaning anyone can call them to relay a message to a supported chain, provided an adapter contract exists for that chain.
Functionality
An adapter's primary function is to relay and receive messages to and from the bridge. These messages are typically sent by a contract, such as the Message Controller on the same chain. The adapter repackages the message to include the original msg.sender
(the Message Controller) and the destination address (the Message Controller's address on the destination chain). The adapter does not process or inspect the content of the message; it supports any bytes[]
message format.
The adapter uses the bridge to relay the message to the corresponding adapter on the destination chain. Once the destination adapter receives the message, it unpacks it to identify the real msg.sender
on the source chain and the intended recipient on the destination chain. The adapter then forwards the unpacked, original message to the destination address.
Fees
The system charges a protocol fee for relaying messages between chains. The fee is calculated as a percentage of the value being sent (bridge fee). However, the protocol fee is currently set to 0% by default, meaning no additional charge is applied beyond the base bridge fee.
Additionally, each adapter enforces a minimum gas requirement for message relay. This is controlled by the minGas
variable. If the calling contract does not provide at least the minimum gas value, the transaction will revert.
Interfaces
Each adapter implements the following view functions:
isChainSupported
Checks if a given chain ID is supported by the adapter.
trustedAdapters()
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.
Last updated