TonFusion

TonFusion is an extension for 1inch Fusion+ that enables swaps between EVM and TON

TonFusion

Created At

Unite Defi

Project Description

TonFusion implements a trustless cross-chain swap protocol that ensures atomic transactions between the TON and Ethereum networks. The system guarantees that either both parties receive their funds (successful swap) or both parties get their original funds back (cancelled swap), with no scenario where only one party benefits.

Key Features:

  • Hash Time-Locked System: Provides cryptographic security with time-based failsafes
  • Atomic Swaps: Ensures all-or-nothing transactions
  • Multi-chain Support: Enables swaps between TON and EVM-compatible chains
  • Trustless Operation: No intermediary custody of funds

Hash Time-Locked System: The protocol uses cryptographic hashes to secure atomic cross-chain swaps: Users generate a secret string, which is hashed using SHA256 to create a lock. Escrow contracts are deployed on both TON and EVM chains with the same hash lock. Revealing the secret on one chain enables claims on both chains, ensuring atomicity. Multiple timeout mechanisms and refund paths prevent fund lockup and ensure fairness.

How it's Made

onFusion is built as a hybrid blockchain solution, combining smart contracts on both the TON and EVM (Ethereum) networks to facilitate atomic swaps. The system leverages the following core technologies and design patterns:

TON Smart Contracts (FunC): The TON side uses a FunC-based smart contract that implements the HTLC (Hash Time-Locked Contract) pattern. The contract manages swap registration, deposits, withdrawals, and refunds, all governed by cryptographic hash locks and multiple timeouts. Storage is organized to track swap status, participants, deadlines, and amounts, ensuring precise control and auditability. Gas and error handling are carefully implemented to prevent misuse and ensure robust operation. EVM Smart Contracts: The EVM side uses Solidity contracts, including a resolver and escrow factory, to mirror the swap logic. Integration with 1inch's cross-chain swap infrastructure enables efficient and secure settlement. Cross-chain Architecture: Both chains deploy escrows with the same hash lock, and the secret's revelation on one chain allows the claim on the other. The protocol is designed to be trustless: no party (not even relayers) can access funds unless swap conditions are met. Multiple timeouts and fallback paths (e.g., public withdrawal, cancellation) are implemented to handle edge cases and ensure funds are never stuck. Development & Testing: The project uses modern tooling for contract development, deployment, and testing (e.g., Blueprint for TON, Hardhat for EVM). The codebase is organized for clarity, with modular contracts and utilities separated by function. Test scripts and configuration files are included to facilitate local and cross-chain testing. Notable points:

The protocol is fully non-custodial and atomic, with all critical paths enforced by smart contracts. Security is prioritized through cryptographic primitives and redundant timeout logic. The design is extensible to other EVM-compatible chains and potentially other blockchains supporting similar primitives.

background image mobile

Join the mailing list

Get the latest news and updates