How it works
Counterfactual is a decentralized infrastructure designed to synchronize token balances and enable yield-accruing mirrored assets across multiple chains. By leveraging LayerZero messaging and a decentralized gossip protocol, Counterfactual ensures seamless cross-chain liquidity synchronization and efficient asset management for dApps and users.
XDLOL: Synchronizing Token Balances Across Chains
XDLOL (eXtended Decentralized Liquidity Orchestration Layer) is the backbone of Counterfactual’s infrastructure. It ensures that token balances and liquidity data are synchronized across chains, enabling dApps to utilize cross-chain liquidity effortlessly.
1. Tag-Based Liquidity Mapping
DApps register specific tokens and contracts to be synchronized with tags that define the property of the liquidity.
Examples of tags:
USDC-WETH: Represents liquidity in an AMM for the USDC-WETH pair.
USDC: Represents the total locked liquidity for USDC in a lending protocol.
USDC-0x1234...5678: Represents liquidity specific to a user account.
2. Propagation via Gossip Protocol and LayerZero
When a change in liquidity occurs (e.g., an event like adding or removing funds), a delta update is generated and tagged.
Using LayerZero messaging, the delta is propagated to neighboring chains. Each chain:
Updates its local state based on the delta.
Propagates the delta further to its own neighbors, ensuring the update eventually reaches all chains.
3. Merkle Tree Root Synchronization
Each chain calculates a Merkle tree root that represents the liquidity data for all registered tags.
Only the Merkle root is synchronized across chains using LayerZero messaging, drastically reducing data payloads.
When liquidity data is needed for execution on another chain, the actual data is provided along with a Merkle proof, allowing verification against the synchronized root.
This approach ensures scalability, security, and minimal messaging costs, even as the number of supported chains and liquidity entries grows.
Practical Applications
AMMs: Users can trade locally on their chain with the least slippage, leveraging visibility into the total liquidity across chains.
Lending Protocols: Borrowing power is calculated using synchronized collateral data from all chains, while borrowing and liquidation occur locally.
Yield Aggregators: Aggregators optimize yields across chains based on synchronized liquidity data, ensuring users benefit from the highest returns.
mOFTs: Yield-Accruing Mirrored Assets
Mirrored assets extend the concept of Omnichain Fungible Tokens (OFTs) by introducing synchronized balances and automatic yield accrual.
1. Minting
Users lock base assets (e.g., USDC) on any supported chain through Counterfactual to mint mirrored tokens (e.g., moUSDC).
These mirrored tokens represent the locked assets and can be used across chains.
2. Yield Accrual
Mirrored tokens accrue yield (e.g., 8% APY) every block, sourced from liquidity pools on L1, where the deepest liquidity resides.
The yield is distributed proportionally and synchronized across all chains.
3. Balance Synchronization
Using LayerZero, mirrored balances are updated and kept consistent across all supported chains, allowing users to interact with their mirrored assets seamlessly on any chain.
Practical Applications
Trading Safety Net: Yield earned on mirrored assets can offset potential trading losses. For example, with 8% APY, users avoid net losses if their trading loss is within 8%.
Passive Income: Users earn consistent yield while retaining flexibility to interact with their assets across chains.
DeFi Protocol Integration: Mirrored assets can be leveraged in AMMs, lending protocols, or collateralized loans.
Last updated