LzApp

Git Source

Inherits: OwnableInternal, ILayerZeroReceiver, ILayerZeroUserApplicationConfig

State Variables

lzEndpoint

ILayerZeroEndpoint public immutable lzEndpoint;

Functions

constructor

constructor(address endpoint);

lzReceive

LayerZero endpoint will invoke this function to deliver the message on the destination

function lzReceive(uint16 srcChainId, bytes memory srcAddress, uint64 nonce, bytes memory payload) public virtual;

Parameters

NameTypeDescription
srcChainIduint16The source endpoint identifier
srcAddressbytesThe source sending contract address from the source chain
nonceuint64The ordered message nonce
payloadbytesThe signed payload is the UA bytes has encoded to be sent

_blockingLzReceive

function _blockingLzReceive(uint16 srcChainId, bytes memory srcAddress, uint64 nonce, bytes memory payload)
    internal
    virtual;

_lzSend

function _lzSend(
    uint16 dstChainId,
    bytes memory payload,
    address payable refundAddress,
    address zroPaymentAddress,
    bytes memory adapterParams,
    uint256 nativeFee
) internal virtual;

getConfig

function getConfig(uint16 version, uint16 chainId, address, uint256 configType) external view returns (bytes memory);

setConfig

Set the configuration of the LayerZero messaging library of the specified version

function setConfig(uint16 version, uint16 chainId, uint256 configType, bytes calldata config) external onlyOwner;

Parameters

NameTypeDescription
versionuint16Messaging library version
chainIduint16The chainId for the pending config change
configTypeuint256Type of configuration. every messaging library has its own convention.
configbytesConfiguration in the bytes. can encode arbitrary content.

setSendVersion

Set the send() LayerZero messaging library version to version

function setSendVersion(uint16 version) external onlyOwner;

Parameters

NameTypeDescription
versionuint16New messaging library version

setReceiveVersion

Set the lzReceive() LayerZero messaging library version to version

function setReceiveVersion(uint16 version) external onlyOwner;

Parameters

NameTypeDescription
versionuint16NMew messaging library version

forceResumeReceive

Only when the UA needs to resume the message flow in blocking mode and clear the stored payload

function forceResumeReceive(uint16 srcChainId, bytes calldata srcAddress) external onlyOwner;

Parameters

NameTypeDescription
srcChainIduint16The chainId of the source chain
srcAddressbytesThe contract address of the source contract at the source chain

setTrustedRemoteAddress

function setTrustedRemoteAddress(uint16 remoteChainId, bytes calldata remoteAddress) external onlyOwner;

getTrustedRemoteAddress

function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory);

isTrustedRemote

function isTrustedRemote(uint16 srcChainId, bytes memory srcAddress) external view returns (bool);

_isTrustedRemote

function _isTrustedRemote(uint16 srcChainId, bytes memory srcAddress) internal view returns (bool);

Events

SetTrustedRemoteAddress

event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress);

Errors

LzApp__InvalidEndpointCaller

error LzApp__InvalidEndpointCaller();

LzApp__InvalidSource

error LzApp__InvalidSource();

LzApp__NotTrustedSource

error LzApp__NotTrustedSource();

LzApp__NoTrustedPathRecord

error LzApp__NoTrustedPathRecord();