SwapYourSuiiii

Seamless cross-chain token atomic swaps between EVM and Sui using 1inch LOP and HTLCs

SwapYourSuiiii

Created At

Unite Defi

Winner of

1inch

1inch - Extend Fusion+ to Sui 5th place

Project Description

This project enables secure, permissionless cross-chain token ( USDC ) swaps between EVM-based chain and the Sui blockchain using Hashed Timelock Contracts (HTLCs). It allows two parties on separate blockchains to swap assets without trusting a third party, using cryptographic hashlocks and time-based constraints.

The system consists of:

  1. 1inch official escrow contracts on base sepolia tesnet EVM to lock ERC-20 tokens with a hashlock and timelock.

  2. A corresponding HTLC Move module on the Sui testnet to lock SUI-based coins under the same conditions.

Relayer/Off-chain Service:

  1. A relayer built with Next.js and Ethers/Sui SDKs monitors both chains, detects events (like SrcEscrowCreated or DstEscrowCreated ), and facilitates sharing of secrets for claiming or refunding actions .

Swap Flow:

One party locks tokens on chain A with a hash of a secret.

The counterparty uses the same hash to lock tokens on chain B.

When the initiator claims the tokens on chain B by revealing the preimage (secret), the counterparty can use that same preimage to claim on chain A.

If the trade is not completed within the timelock, either party can reclaim their locked assets.

Testnet Simulation:

Fully implemented and tested on Sui testnet and Base Sepolia Testnet.

Includes a working backend relayer to simulate swaps and verify correctness.

This project demonstrates how atomic swaps can work across fundamentally different blockchain architectures (EVM vs. Move) and provides a base for building more advanced cross-chain systems.

How it's Made

This project was built by integrating both EVM and Sui smart contract ecosystems to enable atomic swaps via HTLCs (Hashed Timelock Contracts). Here's how it came together:

šŸ”§ Tech Stack Solidity: HTLC smart contract deployed on an EVM. Handles ERC-20 token locking, claiming, and refunds.

Move (Sui): HTLC module deployed on Sui testnet. Handles Coin<T> deposits with similar hashlock/timelock logic.

Next.js: Used for the frontend interface and to build the off-chain relayer service.

TypeScript: For the relayer logic to listen to events on both chains.

Ethers.js: To interact with the EVM chain.

Sui SDK (TypeScript): For interacting with the Sui chain and reading on-chain objects.

Keccak256 hashing: Used consistently to derive the same preimage hash on both sides.

🧠 Design Notes HTLC logic had to be implemented independently on both chains due to the architectural differences (e.g., object-centric vs. account-centric models).

The Sui side does not have a native factory pattern like EVM; instead, each swap SRCand DEST escrows are represented by an object and directly transferred on-chain.

Used keccak256 on Sui to match keccak256 behavior from EVM for consistent hashlocks. The hash compatibility had to be manually verified.

Timestamps had to be normalized—Sui uses Clock with millisecond precision, while EVM uses seconds.

šŸ¤ Partner Tech Used Sui Testnet & Tooling: Sui CLI, SDK, and test tokens were crucial for deploying and interacting with Move modules.

Ethereum : Allowed testing the ERC-20 HTLC logic in an EVM-compatible environment.

background image mobile

Join the mailing list

Get the latest news and updates