LZEndpointDollar (LZD) is the canonical USD-denominated fee token for LayerZero on Tempo. Because Tempo has no native gas token, EndpointV2Alt uses LZD as the ERC-20 token for all LayerZero messaging fees.The endpoint could accept a single TIP-20 token directly, but that would force users to hold one specific stablecoin. LZD is an ERC-20 wrapper around multiple whitelisted 6-decimal stablecoins (pathUSD, USDC.e, or USDT0), so users can pay fees with whichever USD stablecoin they have. Users wrap a supported stablecoin into LZD, then approve the endpoint or OFT to spend it.
Paying LayerZero fees on Tempo requires wrapping a whitelisted stablecoin into LZD before sending:
Quote: call quoteSend(sendParam, _payInLzToken) to receive both nativeFee and lzTokenFee. LayerZero lets you choose the fee token via _payInLzToken. At the time of writing, _payInLzToken is not enabled on Tempo, so set it to false and use nativeFee (LZD).
Approve stablecoin: approve the LZD contract to spend your stablecoin.
Wrap: call LZD.wrap(feeToken, recipient, amount) to convert your stablecoin into LZD.
Approve LZD: approve the OFT contract to spend your LZD.
Send: call send() with msg.value = 0 and MessagingFee(nativeFee, 0).
// 1. Quote the feeMessagingFee memory fee = oft.quoteSend(sendParam, false);// 2. Approve stablecoin to LZDIERC20(usdce).approve(address(lzd), fee.nativeFee);// 3. Wrap USDC.e into LZDlzd.wrap(usdce, msg.sender, fee.nativeFee);// 4. Approve LZD to the OFTIERC20(address(lzd)).approve(address(oft), fee.nativeFee);// 5. Send with msg.value = 0oft.send{value: 0}(sendParam, fee, refundAddress);
At the time of writing, _payInLzToken is not enabled on Tempo, so set it to false.
function whitelistToken(address _token) public onlyOwner
Adds a token to the whitelist. This is an owner-only admin function, so new fee tokens can only be added by the LZD contract owner. The token must have exactly 6 decimals and must not already be whitelisted.
quoteSend() returns a MessagingFee with both nativeFee and lzTokenFee. LayerZero lets applications choose the payment token via _payInLzToken. At the time of writing, _payInLzToken is not enabled on Tempo, so set it to false and read the fee from nativeFee (LZD):
// false = quote in native fee token (LZD on Tempo)MessagingFee memory fee = oft.quoteSend(sendParam, false);// fee.nativeFee = amount of LZD required// fee.lzTokenFee = 0 on Tempo while _payInLzToken is disabled