LzApp
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
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source endpoint identifier |
srcAddress | bytes | The source sending contract address from the source chain |
nonce | uint64 | The ordered message nonce |
payload | bytes | The 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
Name | Type | Description |
---|---|---|
version | uint16 | Messaging library version |
chainId | uint16 | The chainId for the pending config change |
configType | uint256 | Type of configuration. every messaging library has its own convention. |
config | bytes | Configuration in the bytes. can encode arbitrary content. |
setSendVersion
Set the send() LayerZero messaging library version to version
function setSendVersion(uint16 version) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
version | uint16 | New messaging library version |
setReceiveVersion
Set the lzReceive() LayerZero messaging library version to version
function setReceiveVersion(uint16 version) external onlyOwner;
Parameters
Name | Type | Description |
---|---|---|
version | uint16 | NMew 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
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The chainId of the source chain |
srcAddress | bytes | The 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();