project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

MoleSwap

Extension for 1inch Cross-chain Swap (Fusion+) that enables swaps between EVM and TON

MoleSwap

Created At

Unite Defi

Project Description

This project is a completed extension of the 1inch Fusion+ cross-chain swap system, enabling secure and efficient token swaps between the Ethereum network and the TON blockchain. While Fusion+ originally supports atomic swaps across EVM compatible chains, this extension successfully integrates TON a non EVM blockchain while preserving key Fusion+ features such as hashlock and timelock-based security.

The solution supports fully bidirectional swaps, allowing users to exchange assets from Ethereum to TON and vice versa. To bridge the architectural differences between the two networks, we developed custom smart contract logic and swap handlers tailored to TON’s environment.

In addition to the core protocol extension, we also developed a cross-chain atomic swap relayer that facilitates secure and trustless token swaps between different blockchain networks. This relayer acts as a decentralized coordinator, broadcasting and listening for cross-chain swap events to ensure atomicity and execution integrity.

To complement this, we built a TypeScript-based resolver service that interacts with the relayer. The resolver continuously polls the relayer for active swap orders, evaluates their profitability using real-time oracle price feeds, and automatically executes profitable cross-chain swaps.

As part of the final demo, we deployed the necessary Limit Order Protocol contracts to EVM testnets and executed cross-chain token transfers involving both Ethereum and TON, demonstrating full protocol functionality and interoperability.

Stretch goals were partially addressed: a simple user interface was implemented to demonstrate ease of use, and partial fill support is under consideration for future development.

How it's Made

This project consists of several interconnected components that together enable secure, atomic cross-chain swaps between Ethereum (Sepolia testnet) and TON. The system includes a TypeScript-based resolver service, a cross-chain relayer, TON smart contracts written in FunC, and a React + Next.js UI for interaction and visualization.

Resolver Service The resolver is a TypeScript-based backend service that automates cross-chain swaps using the MoleSwap protocol. It continuously polls the relayer for active orders, evaluates them for profitability using a built-in mock oracle, and executes profitable orders using the 1inch SDK. It is fully configurable via environment variables and includes robust error handling, logging, and runtime statistics reporting. Order Polling: Checks the relayer every 10 seconds for new orders. Profitability Analysis: Compares order pricing against oracle rates to determine profitability. Cross-Chain Execution: Performs atomic swaps between Sepolia (Ethereum testnet) and TON. Escrow Flow: Interacts with smart contracts to create and release escrows on both chains. Real-Time Monitoring: Logs metrics and swap statistics every minute. Mock Oracle: A mock price oracle allows simulation and testing of profit conditions.

Cross-Chain Relayer The relayer acts as the coordination hub between networks, ensuring atomicity of swaps. It features a modular plugin system for supporting new chains, and uses secure cryptographic secret generation for managing hashlocks. Plugin Architecture: Supports multiple chains through an extensible system. Escrow Validation: Automatically verifies the presence and validity of escrow contracts on both chains. Secure Secret Management: Generates secrets and shares them with parties once conditions are met. Advanced Filtering: Filters orders by taker/maker across chains. SQLite Storage: Lightweight database used for tracking and storing state. REST API: Clean endpoints for external services to query order data and status. Logging: Uses Winston for structured, multi-transport logging.

TON Smart Contracts The TON side of the system was developed in FunC, TON's low-level smart contract language. Contracts support creating escrows, handling hashlock/timelock logic, and securely releasing tokens upon successful completion of the swap. Integration with the resolver and relayer ensures end-to-end cross-chain functionality.

Frontend (UI) We also implemented a simple, user-friendly interface using React and Next.js. The UI allows users to monitor swap activity, view orders, and interact with the resolver service during testing and demonstrations.

background image mobile

Join the mailing list

Get the latest news and updates