LayerZero Router
Last updated
Last updated
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:
Map between standardised chain IDs and LayerZero EIDs
Send messages via LayerZero (using the option Bridge.LAYERZERO
)
Estimate the native fee required for a given cross-chain call
Receive incoming LayerZero messages and dispatch them to a target contract Implementing a onMessageReceived
hook
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.
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
.