Repository containing LayerZero Omnichain Fungible Token (OFT) implementations for cross-chain token bridging between EVM chains and Flow blockchain.
┌─────────────────────────────────────────────────────────────────────────────────┐
│ Flow Token Bridge │
└─────────────────────────────────────────────────────────────────────────────────┘
═══════════════════════════════════════════════════════════════════════════════════
SCENARIO 1: EVM to Flow (Lock & Mint)
═══════════════════════════════════════════════════════════════════════════════════
EVM Chain LayerZero Protocol Flow Chain
───────── ────────────────── ──────────
┌──────────┐
│ User │
│(Ethereum)│
└────┬─────┘
│ 1. send()
▼
┌──────────┐
│ OFT │
│ Adapter │──────┐
│ LOCK │ │ 2. Emit
│ Tokens │ │ Message
└──────────┘ │
▼
╔════════════════╗
║ LayerZero ║
║ Messaging ║ 3. Relay
║ Layer (DVNs ║─────────────────────┐
║ & Oracles) ║ │
╚════════════════╝ │
▼
┌──────────┐
│ OFT │
│ Contract │
│ MINT │
│ Tokens │
└────┬─────┘
│ 4. Transfer
▼
┌──────────┐
│ User │
│ on Flow │
└──────────┘
═══════════════════════════════════════════════════════════════════════════════════
SCENARIO 2: Flow to EVM (Burn & Unlock)
═══════════════════════════════════════════════════════════════════════════════════
Flow Chain LayerZero Protocol EVM Chain
────────── ────────────────── ─────────
┌──────────┐
│ User │
│ on Flow │
└────┬─────┘
│ 1. send()
▼
┌──────────┐
│ OFT │
│ Contract │──────┐
│ BURN │ │ 2. Emit
│ Tokens │ │ Message
└──────────┘ │
▼
╔════════════════╗
║ LayerZero ║
║ Messaging ║ 3. Relay
║ Layer (DVNs ║─────────────────────┐
║ & Oracles) ║ │
╔════════════════╝ │
▼
┌──────────┐
│ OFT │
│ Adapter │
│ UNLOCK │
│ Tokens │
└────┬─────┘
│ 4. Transfer
▼
┌──────────┐
│ User │
│(Ethereum)│
└──────────┘
Bridging Process:
EVM to Flow (Lock & Mint):
- Source Chain (EVM): User calls
send()on OFT Adapter, tokens are locked in the adapter contract - LayerZero Protocol: Message is encoded and sent through LayerZero's decentralized network of verifiers (DVNs) and oracles
- Destination Chain (Flow): OFT contract receives verified message and mints equivalent tokens on Flow EVM
- Result: User receives newly minted tokens on Flow with 1:1 parity
Flow to EVM (Burn & Unlock):
- Source Chain (Flow): User calls
send()on Flow OFT contract, tokens are burned - LayerZero Protocol: Message is relayed back through the decentralized network
- Destination Chain (EVM): OFT Adapter receives message and unlocks the original tokens
- Result: User receives unlocked tokens on the EVM chain, maintaining 1:1 parity
This repository contains multiple implementations for cross-chain token bridging:
EVM LayerZero OFT Implementation
A comprehensive LayerZero OFT (Omnichain Fungible Token) implementation for EVM-compatible blockchains. This directory contains:
- Smart Contracts: Multiple OFT contract implementations (
MyOFT.sol,MyOFTAdapter.sol,MyOFTFungi.sol, etc.) - Deployment Scripts: Hardhat-based deployment and configuration tools
- Testing: Both Hardhat and Foundry test suites
- Configuration: LayerZero network configurations for multiple EVM chains
- Custom Scripts: Token transfer utilities for EVM-to-EVM and EVM-to-Flow bridging
Key Features:
- Multi-chain deployment support (Ethereum, Arbitrum, Base, Avalanche, etc.)
- LayerZero DevTools integration with helper tasks
- Cross-chain configuration management
- Token minting and burning mechanisms
- OFT transfer scripts with environment variable support
Supported Networks:
- Testnets: Sepolia, Base Sepolia, Arbitrum Sepolia, Avalanche Fuji
- Mainnets: Ethereum, Flow, Arbitrum, Base, Avalanche
Solana LayerZero OFT Implementation
A complete Solana-based OFT implementation using Anchor framework for cross-chain token bridging. This directory contains:
- Programs: Solana programs written in Rust (
oft/,endpoint-mock/) - Anchor Framework: Complete Anchor project setup with tests
- Deployment Tools: Solana CLI deployment scripts and utilities
- Configuration: LayerZero configuration for Solana networks
- Tasks: Hardhat tasks for Solana OFT operations
Key Features:
- Solana program deployment and management
- SPL token integration with OFT standard
- Cross-chain messaging with LayerZero
- Mint authority multisig support
- Token creation and transfer utilities
Requirements:
- Rust 1.75.0, Anchor 0.29, Solana CLI 1.17.31
- Docker for program builds
- Node.js for deployment scripts
Supported Networks:
- Solana Devnet/Testnet and Mainnet-beta
- Cross-chain compatibility with EVM networks
Flow Bridge Web Interface
A Next.js web application that provides a user-friendly interface for cross-chain token bridging and swapping. This application integrates the LI.FI Widget to enable seamless token transfers across multiple blockchain networks.
Purpose: The web app serves as a frontend interface for users to bridge tokens between different blockchain networks without needing to interact directly with smart contracts or command-line tools. It leverages LI.FI's aggregation layer to find the best routes for cross-chain transfers across multiple bridge protocols including LayerZero.
Key Features:
- Simple, intuitive web interface for cross-chain token transfers
- Integration with LI.FI Widget for access to multiple bridge protocols
- Support for connecting various wallet providers (MetaMask, WalletConnect, etc.)
- Real-time bridge route optimization and fee estimation
- Responsive design for desktop and mobile devices
- Built with Next.js 14 and TypeScript for optimal performance
Technology Stack:
- Next.js 14 (App Router)
- React 18
- TypeScript
- LI.FI Widget SDK
- Deployed on Vercel
Use Cases:
- Bridge tokens from Ethereum to Flow and other EVM chains
- Swap and bridge in a single transaction
- Compare bridge routes and select optimal paths
- Monitor cross-chain transaction status
For detailed setup and deployment instructions, see the Web App README.
- LayerZero: Omnichain communication protocol
- Solidity: Smart contract development
- Rust/Anchor: Solana program development
- Hardhat/Foundry: EVM development and testing
- TypeScript: Type-safe development
-
For EVM Development:
- Node.js and npm/pnpm
- Hardhat and Foundry
- Private keys for deployment networks
-
For Solana Development:
- Rust toolchain
- Anchor framework
- Solana CLI tools
- Docker
-
Clone the repository:
git clone <repository-url> cd flow-bridge-app
-
Choose your implementation:
- For Web Interface: Navigate to
web-app/(user-facing bridge application) - For EVM chains: Navigate to
ethereum-oapp/(smart contract development) - For Solana: Navigate to
solana-oapp/(Solana program development)
- For Web Interface: Navigate to
-
Follow the setup instructions in each directory's README:
- Web App Guide - Cross-chain bridge web interface
- EVM OFT Guide - EVM smart contract implementation
- Solana OFT Guide - Solana program implementation
EVM Networks:
cd ethereum-oapp
npx hardhat lz:deploySolana:
cd solana-oapp
solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u devnetEVM Networks:
npx hardhat lz:oapp:wire --oapp-config layerzero.config.tsSolana:
npx hardhat lz:oapp:wire --oapp-config layerzero.config.ts --solana-secret-key <PRIVATE_KEY>EVM to EVM:
npx hardhat oft:send --from-chain ethereum-mainnet --to-chain flow-mainnet --amount 1.5 --receiver <ADDRESS>EVM to Solana:
npx hardhat --network sepolia-testnet send --dst-eid 40168 --amount <AMOUNT> --to <ADDRESS>Solana to EVM:
npx hardhat lz:oft:solana:send --amount <AMOUNT> --from-eid 40168 --to <ADDRESS> --to-eid 40161- MyOFTAdapter:
0x9D6e122780974a917952D70646dD50D2C4f906ae - PYUSDLocker:
0xb077Ef2833Fd7b426146839a86100708c37bfa65 - MyFungi:
0x39dBc26413e6eEe40265E4a7ddc5abDC64849781
- MyOFTAdapter:
0xDD3BFfb358eF34C2964CB9ce29013D071d59094C - MyOFTMock:
0x4e2dCCAfe86719B7BFfAc3b1041031dDd07aF5fF - MyFungi:
0x1605B1067Ce0D294786A09368f38063Df50C0e92
- MyOFTMock:
0x1119cA4D5145432b7B1CD197d136Da15e236E896
- PYUSDLocker:
0xFA0e06B54986ad96DE87a8c56Fea76FBD8d493F8
- Program ID:
D6RHLYN7x69Cb5Y7dFj9T9uJrJCVT9Bt1LT71xHf7QqK - Mint:
CXk2AMBfi3TwaEL2468s6zP8xq9NxTXjp9gjMgzeUynM - Mint Authority:
A6v157j6XFJXwtT5VWXX7uLYTUrxcYGXB8R6rxrgr9hQ - Escrow:
FKt7QuGTkFWHVt7RVgtEsh3rVRZMaeCdQBseyQ9Vf1PN - OFT Store:
CFVgSccTEXbs3hN7gnCHx3FAa1L5j5StsKABTPuMaAYo
- Program ID:
28EyPNAi9BMTvGuCaQrptMXjpWUi7wx8SxAFVoSZxSXe - Mint:
2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo - Mint Authority:
22mKJkKjGEQ3rampp5YKaSsaYZ52BUkcnUN6evXGsXzz - Escrow:
6z3QyVS36nQ9fk2YvToxqJqXqtAFsSijqgHxpzKyG5xn - OFT Store:
2KUb8dcZR9LyrSg4RdkQx91xX6mPQLpS1MEo6gwfvLZk
For detailed information about each implementation:
- Web App Guide: User-facing cross-chain bridge web application
- EVM OFT Guide: Complete documentation for EVM LayerZero OFT implementation
- Solana OFT Guide: Comprehensive guide for Solana OFT implementation
- LayerZero Documentation: Official LayerZero protocol documentation
- LI.FI Documentation: LI.FI Widget integration documentation
Please refer to the individual README files in each subdirectory for specific contribution guidelines and development practices.
This project is licensed under the terms specified in the individual contract implementations.