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

SwapZilla

SwapZilla: Decentralized cross-chain swaps via LayerZero. Create orders on one chain, match on another, execute swaps across networks—all without transferring assets to a bridge.

SwapZilla

Created At

ETHGlobal Brussels

Winner of

Blockscout - Best use of Blockscout Block Explorer

Prize Pool

Project Description

SwapZilla is a decentralized protocol enabling direct asset swaps across different blockchain networks. It leverages LayerZero for cross-chain communication and implements the Uniswap's IERC7683 interface, enhancing its interoperability and standardization. The protocol's key advantage is facilitating token exchanges without relying on traditional bridge transfers.

Technical Framework:

Cross-chain communication: LayerZero technology Smart contract interface: IERC7683 Supported networks: Multiple EVM-compatible chains (e.g., Base, Scroll)

Exchange Process:

Order Creation: Users submit swap orders on their respective chains. Order Matching: A solver identifies and proposes compatible cross-chain orders. Order Resolution: Matched orders are executed, transferring assets directly between users on different chains.

Example Scenario:

Alice (on Base) and Bob (on Scroll) create swap orders. Orders are broadcast across both chains. A solver identifies the complementary nature of their orders. The protocol validates and matches the orders. Upon resolution, Alice's Base tokens are transferred to Bob, and Bob's Scroll tokens to Alice.

Key Benefits:

Eliminates intermediary bridge risks Enhances liquidity across chains Potentially reduces fees and transaction times Standardized interface for improved interoperability

How it's Made

Our team started a project to create a cross-chain decentralized exchange using LayerZero technology. Here’s a simplified breakdown of what we did:

  1. Setup: We used NPX to create a LayerZero application and imported a modified version of the IERC7683 interface from Uniswap.

  2. Modifications: We made several changes to the interface to fit our needs:

    • Changed some view functions to non-view functions to allow them to modify the state.
    • Made non-payable functions payable to support transactions that require transferring funds.
    • Implemented token transfers at order creation instead of resolution to streamline the process and reduce complexity.
  3. LayerZero Integration:

    • We chose a unidirectional request model (like UDP) to keep gas costs low and to save time, as we had limited time to work on the LayerZero integration.
    • Though we considered a bidirectional model (like TCP), we opted for the simpler model for our proof of concept.
  4. Development Process:

    • Created an initial design diagram (available on our GitHub).
    • Implemented the adapted ERC7683 interface.
    • Integrated LayerZero functionality.
    • Thoroughly tested the exchange process using Hardhat.
    • Deployed the protocol to Sepolia, Base, and Scroll testnets.
    • Verified the contract using Blockscout.
  5. Frontend:

    • Developed a simple UI for order signing and creation.
    • Planned to create a solver application using Ethers.js, but used our tests for demonstration due to time constraints.
    • Deployed the frontend to Netlify.

This project demonstrates the potential of cross-chain decentralized exchanges using LayerZero. Our design could be better, but we had limited time during the hackathon. For future improvements, we suggest:

  1. Retry Mechanism: Adding a retry mechanism for LayerZero contracts to handle cross-chain communication failures.
  2. Two-Sided Messaging: Moving to a request-response messaging system for a more fault-tolerant setup.
  3. Solver Rewards: Introducing a reward mechanism for solvers to incentivize better protocol performance and reliability.

These enhancements would make our cross-chain exchange more reliable and robust for production use. However, due to the hackathon's time limits, these were beyond our initial proof of concept's scope.

background image mobile

Join the mailing list

Get the latest news and updates