ILayerZeroEndpoint
Inherits: ILayerZeroUserApplicationConfig
Functions
send
Send a LayerZero message to the specified address at a LayerZero endpoint.
function send(
uint16 dstChainId,
bytes calldata destination,
bytes calldata payload,
address payable refundAddress,
address zroPaymentAddress,
bytes calldata adapterParams
) external payable;
Parameters
Name | Type | Description |
---|---|---|
dstChainId | uint16 | The destination chain identifier |
destination | bytes | The address on destination chain (in bytes). address length/format may vary by chains |
payload | bytes | A custom bytes payload to send to the destination contract |
refundAddress | address payable | If the source transaction is cheaper than the amount of value passed, refund the additional amount to this address |
zroPaymentAddress | address | The address of the ZRO token holder who would pay for the transaction |
adapterParams | bytes | Parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination |
receivePayload
Used by the messaging library to publish verified payload
function receivePayload(
uint16 srcChainId,
bytes calldata srcAddress,
address dstAddress,
uint64 nonce,
uint256 gasLimit,
bytes calldata payload
) external;
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source chain identifier |
srcAddress | bytes | The source contract (as bytes) at the source chain |
dstAddress | address | The address on destination chain |
nonce | uint64 | The unbound message ordering nonce |
gasLimit | uint256 | The gas limit for external contract execution |
payload | bytes | Verified payload to send to the destination contract |
getInboundNonce
Get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain
function getInboundNonce(uint16 srcChainId, bytes calldata srcAddress) external view returns (uint64);
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source chain identifier |
srcAddress | bytes | The source chain contract address |
getOutboundNonce
Get the outboundNonce from this source chain which, consequently, is always an EVM
function getOutboundNonce(uint16 dstChainId, address srcAddress) external view returns (uint64);
Parameters
Name | Type | Description |
---|---|---|
dstChainId | uint16 | |
srcAddress | address | The source chain contract address |
estimateFees
Gets a quote in source native gas, for the amount that send() requires to pay for message delivery
function estimateFees(
uint16 dstChainId,
address userApplication,
bytes calldata payload,
bool payInZRO,
bytes calldata adapterParam
) external view returns (uint256 nativeFee, uint256 zroFee);
Parameters
Name | Type | Description |
---|---|---|
dstChainId | uint16 | The destination chain identifier |
userApplication | address | The user app address on this EVM chain |
payload | bytes | The custom message to send over LayerZero |
payInZRO | bool | If false, user app pays the protocol fee in native token |
adapterParam | bytes | Parameters for the adapter service, e.g. send some dust native token to dstChain |
getChainId
get this Endpoint's immutable source identifier
function getChainId() external view returns (uint16);
retryPayload
The interface to retry failed message on this Endpoint destination
function retryPayload(uint16 srcChainId, bytes calldata srcAddress, bytes calldata payload) external;
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source chain identifier |
srcAddress | bytes | The source chain contract address |
payload | bytes | The payload to be retried |
hasStoredPayload
Query if any STORED payload (message blocking) at the endpoint.
function hasStoredPayload(uint16 srcChainId, bytes calldata srcAddress) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
srcChainId | uint16 | The source chain identifier |
srcAddress | bytes | The source chain contract address |
getSendLibraryAddress
Query if the libraryAddress is valid for sending msgs.
function getSendLibraryAddress(address userApplication) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
userApplication | address | The user app address on this EVM chain |
getReceiveLibraryAddress
Query if the libraryAddress is valid for receiving msgs.
function getReceiveLibraryAddress(address userApplication) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
userApplication | address | The user app address on this EVM chain |
isSendingPayload
Query if the non-reentrancy guard for send() is on
function isSendingPayload() external view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the guard is on. False otherwise |
isReceivingPayload
Query if the non-reentrancy guard for receive() is on
function isReceivingPayload() external view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the guard is on. False otherwise |
getConfig
Get the configuration of the LayerZero messaging library of the specified version
function getConfig(uint16 version, uint16 chainId, address userApplication, uint256 configType)
external
view
returns (bytes memory);
Parameters
Name | Type | Description |
---|---|---|
version | uint16 | Messaging library version |
chainId | uint16 | The chainId for the pending config change |
userApplication | address | The contract address of the user application |
configType | uint256 | Type of configuration. every messaging library has its own convention. |
getSendVersion
Get the send() LayerZero messaging library version
function getSendVersion(address userApplication) external view returns (uint16);
Parameters
Name | Type | Description |
---|---|---|
userApplication | address | The contract address of the user application |
getReceiveVersion
Get the lzReceive() LayerZero messaging library version
function getReceiveVersion(address userApplication) external view returns (uint16);
Parameters
Name | Type | Description |
---|---|---|
userApplication | address | The contract address of the user application |