ILayerZeroOFT

Git Source

Interface for the OftChain (OFT) token.

Does not inherit ERC20 to accommodate usage by OFTAdapter as well.

This specific interface ID is '0x02e49c2c'.

Functions

oftVersion

Retrieves interfaceID and the version of the OFT.

interfaceId: This specific interface ID is '0x02e49c2c'.

version: Indicates a cross-chain compatible msg encoding with other OFTs.

If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented. ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)

function oftVersion() external view returns (bytes4 interfaceId, uint64 version);

Returns

NameTypeDescription
interfaceIdbytes4The interface ID.
versionuint64The version.

token

Retrieves the address of the token associated with the OFT.

function token() external view returns (address);

Returns

NameTypeDescription
<none>addresstoken The address of the ERC20 token implementation.

approvalRequired

Indicates whether the OFT contract requires approval of the 'token()' to send.

Allows things like wallet implementers to determine integration requirements, without understanding the underlying token implementation.

function approvalRequired() external view returns (bool);

Returns

NameTypeDescription
<none>boolrequiresApproval Needs approval of the underlying token implementation.

sharedDecimals

Retrieves the shared decimals of the OFT.

function sharedDecimals() external view returns (uint8);

Returns

NameTypeDescription
<none>uint8sharedDecimals The shared decimals of the OFT.

quoteOFT

Provides a quote for OFT-related operations.

function quoteOFT(SendParam calldata _sendParam)
    external
    view
    returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory);

Parameters

NameTypeDescription
_sendParamSendParamThe parameters for the send operation.

Returns

NameTypeDescription
<none>OFTLimitlimit The OFT limit information.
oftFeeDetailsOFTFeeDetail[]The details of OFT fees.
<none>OFTReceiptreceipt The OFT receipt information.

quoteSend

Provides a quote for the send() operation.

*MessagingFee: LayerZero msg fee

  • nativeFee: The native fee.
  • lzTokenFee: The lzToken fee.*
function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory);

Parameters

NameTypeDescription
_sendParamSendParamThe parameters for the send() operation.
_payInLzTokenboolFlag indicating whether the caller is paying in the LZ token.

Returns

NameTypeDescription
<none>MessagingFeefee The calculated LayerZero messaging fee from the send() operation.

send

Executes the send() operation.

*MessagingReceipt: LayerZero msg receipt

  • guid: The unique identifier for the sent message.
  • nonce: The nonce of the sent message.
  • fee: The LayerZero fee incurred for the message.*
function send(SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress)
    external
    payable
    returns (MessagingReceipt memory, OFTReceipt memory);

Parameters

NameTypeDescription
_sendParamSendParamThe parameters for the send operation.
_feeMessagingFeeThe fee information supplied by the caller. - nativeFee: The native fee. - lzTokenFee: The lzToken fee.
_refundAddressaddressThe address to receive any excess funds from fees etc. on the src.

Returns

NameTypeDescription
<none>MessagingReceiptreceipt The LayerZero messaging receipt from the send() operation.
<none>OFTReceiptoftReceipt The OFT receipt information.

Events

OFTSent

event OFTSent(
    bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD
);

OFTReceived

event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD);

Errors

InvalidLocalDecimals

error InvalidLocalDecimals();

SlippageExceeded

error SlippageExceeded(uint256 amountLD, uint256 minAmountLD);