StellarSwap

Cross chain swapping between EVM and Stellar Soroban powered by 1inch Fusion+

StellarSwap

Created At

Unite Defi

Project Description

StellarSwap

This project introduces a bidirectional cross-chain swap protocol that connects EVM-compatible chains with the Stellar network. It extends the architecture of 1inch's Fusion+, allowing the trade of assets between Ethereum and Stellar.

The protocol ensures the atomicity and security of swaps through a system of hashlocked and timelocked escrow contracts deployed on both the source and destination chains by implementing low level Rust components equivalent to those of 1inch's Fusion+.

This preserves the core security principles required for trustless cross-chain interactions. To achieve optimal and fair pricing, the system incorporates a Dutch auction mechanism, inspired by 1inch Fusion, which dynamically discovers the exchange rate for orders, with the possibility of partial fills.

Users receive competitive rates for their cross-chain trades in a decentralized manner, where resolvers can bid for relayed orders signed by makers.

How it's Made

How it's made

The project is built with a modular architecture, separating Stellar and EVM environments, and uses a central resolver logic.

Stellar Backend: The core of the protocol resides on a set of interconnected Stellar smart contracts written in Rust, that are implemented to follow the 1inch fusion+ logic.

  • An Order Protocol contract, analogous to the 1inch Limit Order Protocol, serves as the main hub for managing swap orders and their execution logic.
  • An Escrow Factory contract is responsible for deterministically deploying matching EscrowSrc (source) and EscrowDst (destination) contracts.
  • The Base Escrow contracts implement the fundamental cross-chain logic, utilizing hashlocks and timelocks to secure user funds during the swap process until the secret is revealed or the time expires.
  • A Dutch Auction Calculator contract is implemented to handle the dynamic price discovery for swaps, mirroring the functionality of 1inch Fusion to provide fair value to users.
  • A Resolver contract acts as the primary entry point, orchestrating the deployment of escrows and the ultimate settlement of the trade across both chains.

EVM-side Integration: The project includes a standard Foundry setup to manage the EVM-side components. These contracts are designed to interact with the 1inch Limit Order Protocol on an EVM chain, initiating the first part of the swap and generating the secret required to unlock the funds on the Stellar side.

Client and Deployment:

  • A command-line client was developed using Bun and TypeScript with the @stellar/stellar-sdk to facilitate interaction with and demonstration of the deployed Stellar contracts.
  • The entire development and testing environment is automated with a deploy_full_stack.sh script. This script handles starting a local Stellar network via Docker, compiling all Rust contracts and deploying them in sequence with initial configurations.
background image mobile

Join the mailing list

Get the latest news and updates