LayerZero Router

This LzRouter contract is a LayerZero-powered implementation of the Router contract that lets users send and receive arbitrary payloads across supported chains. It extends LayerZero’s OApp base to:

  1. Map between standardised chain IDs and LayerZero EIDs

  2. Send messages via LayerZero (using the option Bridge.LAYERZERO)

  3. Estimate the native fee required for a given cross-chain call

  4. Receive incoming LayerZero messages and dispatch them to a target contract Implementing a onMessageReceived hook


Events

Event
Parameters
Description

LzEidUpdated

uint32 indexed chainId uint32 indexed lzEid

Emitted whenever the owner sets or updates the mapping for a chain’s LayerZero EID.

MessageRoutedLz

MessagingReceipt msg

Emitted after successfully sending a LayerZero message; includes the LayerZero receipt.


Errors

Error
When It’s Thrown

UnsupportedLzChain()

In _sendWithLz, if no LayerZero EID has been configured for the target chainId.

UnsupportedBridgingRoute()

In send(), if the caller specifies any bridge other than Bridge.LAYERZERO.

Last updated