Omnichain Fungible Token (OFT) Technical Reference
LayerZero's Omnichain Fungible Token (OFT) standard enables a single fungible token to exist across many chains while preserving one global supply. The standard abstracts away differences in contract languages, so the high-level behavior is identical no matter which VM you deploy on.
Deployment
An OFT contract must be deployed on every network where a token currently exists or will exist. Since OFT contracts inherit all of the core properties of a LayerZero OApp, connecting OFT deployments requires setting a directional channel configuration between the source chain and the destination blockchain.
Channel Configuration
Every OFT deployment must have a directional channel configuration for messaging to be successful. This means the deployer must:
- Connect the messaging channel at the Endpoint level (establishing the underlying pathway for cross-chain messages).
- Pair the OFT deployments at the OApp level using
setPeer(...)
, so each contract knows its trusted counterpart on the destination chain.
For an overview of what a messaging channel is, see Message Channel Security. For a more thorough explanation of channel configuration and peer relationships, see the OApp Reference.
Core Transfer Flow
When an OFT transfer is initiated, the token balance on the source chain is debited. This either burns or locks the tokens inside the OFT contract, similar to an escrow account. A message is then sent via LayerZero to the destination chain where the paired OFT credits the recipient by minting or unlocking the same amount. This mechanism guarantees a unified supply across all chains.
-
Debit on the source chain
The sender calls the OFT'ssend(...)
function, burning or locking an amount of tokens. -
Message dispatch via LayerZero
The source OFT packages the transfer details into a LayerZero message and routes it through the protocol's messaging layer. LayerZero's messaging rails handle cross-chain routing, verification of the encoded message, and delivery of the message to the destination chain's receiver OFT contract. -
Credit on the destination chain
The paired OFT receives the message and credits the recipient by minting new tokens or unlocking previously-held tokens. The total supply across all chains remains constant, since burned or locked tokens on the source chain are matched 1:1 with minted or unlocked tokens on the destination. -
(Optional) Trigger a composing call
A composing contract uses the tokens received in a new transaction, delivered automatically by the LayerZero Executor, to trigger some state change (e.g., swap, stake, vote). For more details on how to implement composable OFT transfers, see Omnichain Composability.
Core Concepts
This section explains the fundamental design principles that make OFT a flexible, developer-friendly standard for fungible tokens.
1. Transferring Value Across Different VMs
When transferring tokens across different virtual machines, OFT needs to handle varying decimal precision between chains. This is managed through a few key concepts:
-
Local Decimals
Each chain's recommended token standard (e.g., ERC-20 on EVM, SPL Token on Solana, Fungible Assets on Aptos) may use a different default number of decimal places to represent tokens on-chain. If an EVM token uses 18 decimals and a Solana token uses 6, transferring1.000000000000000000
on Chain A without adjustment would not equate to1.000000
on Chain B. Put differently,localDecimals
represent a token contract's decimal precision on a specific blockchain. -
Shared Decimals
To ensure consistent value representation, every OFT declares asharedDecimals
parameter. Before sending a token cross-chain, the OFT logic converts the "local" amount into a normalized "shared" unit. Upon arrival, the destination OFT reconverts that shared unit back into the local representation of its own decimal precision. -
Dust Removal
Before converting the local unit amount (amountLD
) into the shared unit amount (amountSD
), OFT implementations first "floor" the local amount to the nearest multiple of the conversion rate so that no remainder ("dust") is included in the cross-chain transfer.The normalization process works as follows:
-
Compute the conversion rate:
-
Remove dust by flooring to that multiple (e.g., integer division on the EVM):
-