Skip to main content

Solidity API

IRelayBridge

Interface for the RelayBridge contract Defines the bridge function for cross-chain asset transfers

bridge

Bridges an asset (ERC20 token or native currency) from the origin chain to a pool chain

Parameters

Return Values

RelayBridge

RelayBridge contract enabling cross-chain bridging via Hyperlane Bridges assets from an origin chain to a configured pool chain

BridgeTransaction

Internal struct capturing parameters for a bridge transaction

BridgingFailed

Error for failed bridging operations

Parameters

InsufficientValue

Error for insufficient native value sent to cover fees or asset

Parameters

FailedFeeRefund

Error when refunding leftover native value fails

Parameters

transferNonce

Counter for assigning unique nonces to bridge transactions Incremented with each bridge transaction to ensure uniqueness

ASSET

Asset address on the origin chain being bridged (address(0) for native currency) Immutable to ensure the bridge always handles the same asset

BRIDGE_PROXY

BridgeProxy contract handling origin-chain transfer logic Uses delegatecall to execute custom bridge logic

HYPERLANE_MAILBOX

Hyperlane Mailbox contract for cross-chain messaging Used to dispatch messages to the pool chain

BridgeInitiated

Emitted when a bridge transaction is initiated on the origin chain

Parameters

BridgeExecuted

Emitted after a bridge transaction is executed on the pool chain This event would be emitted by the pool chain contract

Parameters

BridgeCancelled

Emitted if a bridge transaction is cancelled prior to execution This event would be emitted if a bridge is cancelled

Parameters

constructor

Initializes the RelayBridge with asset and infrastructure contracts All parameters are immutable after deployment

Parameters

getFee

Calculates the fee required in native currency to dispatch a cross-chain message Uses Hyperlane’s quoteDispatch to estimate the cross-chain messaging fee

Parameters

Return Values

bridge

Bridges an asset (ERC20 token or native currency) from the origin chain to a pool chain _Executes a cross-chain bridge transaction with the following steps:
  1. Validates sufficient payment for fees (and asset amount if native)
  2. Transfers the asset from sender to this contract (if ERC20)
  3. Executes bridge logic via delegatecall to BRIDGE_PROXY
  4. Dispatches cross-chain message via Hyperlane
  5. Refunds any excess native currency to sender_

Parameters

Return Values