A cross-chain bridge supporting token swaps using 1inch Fusion+ across multiple blockchains.
1inch Fusion+ Cross-Chain Bridge: Multi-Chain Support
This is a Proof of Concept (PoC) implementation of a cross-chain token bridge that demonstrates how to transfer USDC tokens between different blockchain networks using 1inch Fusion+ principles. The project supports 5 different blockchain testnets and implements a sophisticated atomic swap mechanism with hashlock/timelock functionality.
Core Architecture: The project consists of three main components working together:
Smart Contracts (/contracts) Escrow.sol: Implements Hashlock/Timelock Contracts (HTLC) for atomic swaps EscrowFactory.sol: Factory pattern for creating escrow contracts CrossChainSettlement.sol: Settlement logic for cross-chain transactions CrossChainSwap.sol: Main swap contract orchestrating the process
Frontend (/frontend) React-based UI with modern design using shadcn/ui components Web3 integration via RainbowKit and wagmi Multi-wallet support including MetaMask and TronLink Real-time balance tracking and transaction status monitoring Cross-chain address validation and conversion utilities
Resolver Service (/resolver) Mock solver agent that facilitates cross-chain transactions Multi-network support with different blockchain integrations TronWeb integration for non-EVM blockchain compatibility REST API for frontend communication
Key Features ✅ Multi-chain USDC swaps across 5 blockchain testnets ✅ Atomic swap guarantees with hashlock/timelock functionality ✅ Modern React frontend with RainbowKit integration ✅ TronWeb support for non-EVM blockchain compatibility ✅ Real-time transaction tracking and status monitoring ✅ Cross-chain address validation and conversion ✅ Environment-based security with private key management ✅ Comprehensive error handling and user feedback
We built this cross-chain bridge using a React frontend with RainbowKit for multi-wallet support, Solidity smart contracts with OpenZeppelin security components, and a Node.js resolver service that orchestrates the entire process. The core challenge was integrating 5 different blockchain networks - including the non-EVM Tron blockchain using TronWeb - while maintaining atomic swap guarantees through hashlock/timelock contracts. We used Hardhat for deployment across multiple testnets and created network-agnostic utilities to handle different address formats (hex vs base58). The most notable hack was solving the escrow contract's chicken-and-egg problem where the constructor tried to transfer tokens before the contract existed - we modified it to handle transfers post-creation. We also implemented conditional logic for TronWeb vs ethers.js interactions and created a safeGetAddress() utility that validates addresses per network context. The project successfully demonstrates cross-chain atomic swaps across Ethereum Sepolia, Celo Alfajores, Monad Testnet, Etherlink Testnet, and Tron Shasta, with the resolver service acting as the central coordinator that creates escrows on both chains and manages the cryptographic secrets needed for atomic execution.