ILayerZeroEndpoint

Git Source

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

NameTypeDescription
dstChainIduint16The destination chain identifier
destinationbytesThe address on destination chain (in bytes). address length/format may vary by chains
payloadbytesA custom bytes payload to send to the destination contract
refundAddressaddress payableIf the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
zroPaymentAddressaddressThe address of the ZRO token holder who would pay for the transaction
adapterParamsbytesParameters 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

NameTypeDescription
srcChainIduint16The source chain identifier
srcAddressbytesThe source contract (as bytes) at the source chain
dstAddressaddressThe address on destination chain
nonceuint64The unbound message ordering nonce
gasLimituint256The gas limit for external contract execution
payloadbytesVerified 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

NameTypeDescription
srcChainIduint16The source chain identifier
srcAddressbytesThe 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

NameTypeDescription
dstChainIduint16
srcAddressaddressThe 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

NameTypeDescription
dstChainIduint16The destination chain identifier
userApplicationaddressThe user app address on this EVM chain
payloadbytesThe custom message to send over LayerZero
payInZROboolIf false, user app pays the protocol fee in native token
adapterParambytesParameters 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

NameTypeDescription
srcChainIduint16The source chain identifier
srcAddressbytesThe source chain contract address
payloadbytesThe 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

NameTypeDescription
srcChainIduint16The source chain identifier
srcAddressbytesThe source chain contract address

getSendLibraryAddress

Query if the libraryAddress is valid for sending msgs.

function getSendLibraryAddress(address userApplication) external view returns (address);

Parameters

NameTypeDescription
userApplicationaddressThe 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

NameTypeDescription
userApplicationaddressThe 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

NameTypeDescription
<none>boolTrue 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

NameTypeDescription
<none>boolTrue 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

NameTypeDescription
versionuint16Messaging library version
chainIduint16The chainId for the pending config change
userApplicationaddressThe contract address of the user application
configTypeuint256Type 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

NameTypeDescription
userApplicationaddressThe contract address of the user application

getReceiveVersion

Get the lzReceive() LayerZero messaging library version

function getReceiveVersion(address userApplication) external view returns (uint16);

Parameters

NameTypeDescription
userApplicationaddressThe contract address of the user application