Skip to main content
Version: Endpoint V2

LayerZero Endpoint Alt

The LayerZero Endpoint Alt is a variant of the LayerZero Endpoint designed for chains where a fungible token standard (rather than the chain's native gas token) serves as the currency for LayerZero fee payments.

While the standard Endpoint processes fees via the chain's native token, Endpoint Alt accepts fees through token transfers using the chain's fungible token standard. This enables LayerZero to support chains where the native gas token has no economic value or where a different token is used as the primary currency.

EVM Implementation

On EVM chains, the Endpoint Alt implementation (EndpointV2Alt) uses ERC20 tokens for fee payments instead of native ETH/gas tokens sent via msg.value.

Key Differences from Standard Endpoint

Endpoint Alt inherits all core functionality from the standard LayerZero Endpoint - including message channel management, library configuration, reentrancy protection, and message composition - but overrides the fee payment mechanism.

AspectStandard EndpointEndpoint Alt
Fee PaymentChain's native gas tokenFungible token standard (e.g., ERC20)
Fee Token DiscoveryImplicit (native token)Query endpoint for configured token address
PrerequisitesNoneMust approve Endpoint to spend fee tokens

Fee Payment Flow

The following diagrams illustrate the fee payment flow differences on EVM chains.

Standard Endpoint Flow

Loading diagram...

Endpoint Alt Flow

Loading diagram...

Modified Functions (EVM)

On EVM chains, EndpointV2Alt overrides the following functions from the base EndpointV2 contract:

FunctionDescription
constructorAccepts an additional _altToken parameter specifying the ERC20 fee token address, stored as an immutable variable for gas optimization.
_payNativeReverts if msg.value > 0 (with LZ_OnlyAltToken), then delegates to _payToken() for ERC20 transfers instead of native token transfers.
_suppliedNativeReturns IERC20(nativeErc20).balanceOf(address(this)) instead of msg.value, checking the contract's ERC20 balance.
setLzTokenAdds validation to prevent setting lzToken to the same address as nativeErc20, avoiding accounting conflicts between the two fee payment systems.
nativeTokenReturns the configured nativeErc20 address instead of address(0), allowing callers to discover the required fee token.

Integration Notes

When building on a chain that uses Endpoint Alt:

ConsiderationDescription
Discover the fee tokenQuery the Endpoint to retrieve the required fee token address.
Approve before sendingYour contract must authorize the Endpoint to spend fee tokens before sending messages.
Quote fees correctlyThe quote() function returns the required fee amount in the configured fee token, not native currency.

EVM-Specific Notes

ConsiderationDescription
Call nativeToken()Returns the ERC20 address used for fees; returns address(0) on standard endpoints.
Never send msg.valueAny transaction with msg.value > 0 will revert with LZ_OnlyAltToken.
Use OFT Alt for tokensWhen deploying OFTs on Endpoint Alt chains, use the OFT Alt contract variants.

Checking Endpoint Type (EVM)

To determine whether an EVM chain uses the standard Endpoint or Endpoint Alt:

address feeToken = ILayerZeroEndpointV2(endpoint).nativeToken();

if (feeToken == address(0)) {
// Standard Endpoint: pay fees with native token (msg.value)
} else {
// Endpoint Alt: pay fees with ERC20 at feeToken address
}

Summary

Endpoint Alt extends the standard LayerZero Endpoint to support chains where a fungible token standard replaces the native gas token for fee payments. On EVM chains, this means using ERC20 tokens instead of native ETH/gas tokens. All other protocol guarantees - immutability, permissionless messaging, channel security, and exactly-once delivery - remain unchanged.

Further Reading