Bi-directional atomic swap between Ethereum and Aptos based on 1inch Fusion
This project implements a bi-directional atomic swap between Ethereum and Aptos using the Fusion+ protocol by 1inch. The core architecture consists of two main components: a relayer service and a resolver. The relayer acts as an off-chain coordinator that facilitates communication between traders on Ethereum and resolvers on Aptos. It listens for order creation and bid submissions, relays the necessary data across chains, and ensures correct sequencing and expiry handling. The resolver, deployed on both Ethereum and Aptos, is responsible for executing trades on-chain. It validates bids, enforces auction conditions such as clearing price or timeouts, and performs token transfers to settle the swap atomically.
The project is built using TypeScript-based Relayer and Resolver services, Aptos Move smart contracts, and for EVM, we use 1inch Escrow factory for a secure, cross-chain atomic swap protocol between Ethereum and Aptos. The relayer, written in TypeScript, serves as the off-chain orchestrator responsible for managing communication, order tracking, and bid forwarding between the two chains. It monitors new orders on Ethereum, captures incoming bids, and securely relays relevant data to the Aptos chain, ensuring timely coordination and order integrity. The relayer also listens for Aptos-side execution events and communicates updates back to Ethereum when necessary, maintaining a bi-directional flow of information.
The Move smart contracts deployed on Aptos handle the on-chain logic for receiving, validating, and executing trades. These contracts replicate the behavior of a Fusion+ resolver, supporting functionalities like order verification, expiry enforcement, price matching (e.g., in Dutch auctions), and secure token transfers. The Move modules are designed with strict constraints to ensure atomicity and prevent partial execution or double-spending.