Soroswap.Finance Docs
  • Welcome 👋🏼
    • What is Soroswap Finance?
    • Getting Started
      • Wallet Setup and Connection
      • How to Swap
      • Provide Liquidity
      • How the Aggregator Works
  • Concepts
    • AMM
    • Liquidity Pools
    • Swap
    • Fees
    • Slippage
    • Router
    • SDEX
    • Aggregator
    • Trustlines
    • Advanced Topics
      • Pricing
      • Understanding Returns
      • Security
      • Research
  • Soroswap AMM (DEX)
    • How Soroswap AMM works
    • Ecosystem Participants
    • Audits
    • Technical Reference
      • Smart contracts
        • SoroswapPair
        • SoroswapFactory
        • SoroswapRouter
        • SoroswapLibrary
      • Deployed Addresses
      • Error Codes
      • Using Soroswap with TypeScript
      • Smart Contract Integration
      • Deploy Soroswap Yourself
        • Setup your environment.
        • Experiment the Pair contract
        • Experiment the Factory Contract.
        • Deployments.
        • Using the Soroswap Testnet
    • Glossary
  • Soroswap Aggregator
    • Supported AMMs
    • Audits
    • Technical Reference
      • How Soroswap Aggregator works
      • Design
      • Technical Overview
      • Aggregator Operation
      • Smart Contracts
        • SoroswapAggregator
        • Adapter Trait
        • SoroswapAdapter
      • Inspirations
        • 1inch
      • Other AMMs in Soroban
        • Phoenix
    • Disclaimer
  • Swap Route API
  • Soroswap Info
  • Tutorials
    • Installing Freighter
    • Soroswap sections
    • Adding Liquidity
    • Doing Swap
    • Remove Liquidity
    • Using Stellar Classic Assets
      • Wrapping Stellar Classic Assets
      • Swap Stellar Classic Assets
      • Test Stellar Classic Assets
    • Bridge using Pendulum
    • Conclusions
  • Partnerships
    • Collaboration with Mercury and SubQuery
    • Business Partnerships
  • Support & Resources
    • About Us
    • General FAQ
    • Additional Resources
Powered by GitBook
On this page
  • Underlying Protocols (DEXES)
  • DexDistribution
  • Example of DexDistribution
  • Adapters
  • Adapter Interface
Edit on GitHub
  1. Concepts

Aggregator

An aggregator aggregates several Soroban-based AMM (AMM based on Smart Contracts in the Stellar Blockchain)

PreviousSDEXNextTrustlines

Last updated 8 months ago

An Aggregator is a smart contract that allows users to execute asset swaps using multiple protocols as sources of liquidity simultaneously. In its operation, the Aggregator coordinates and distributes transactions across different protocols to optimize the outcomes of the swaps.

Underlying Protocols (DEXES)

The integrates with the best AMMs (Automated Market Makers) currently deployed on the Soroban-Stellar Mainnet. These protocols provide the necessary liquidity to execute token swaps, allowing users to achieve optimal pricing and efficiency. Currently the Aggregator aggregates liqudity from:

  • Soroswap.Finance AMM: The main protocol of Soroswap, fully deployed on the Soroban-Stellar Mainnet. This AMM offers fast, secure, and low-cost token swaps, enabling users to interact with a wide range of token pairs.

  • Phoenix Protocol AMM (currently on Testnet): Phoenix is in the testing phase and adds an additional layer of liquidity to the Soroban network. Once fully deployed on the mainnet, Phoenix will enhance the efficiency of token swaps.

  • Aqua AMM (currently on Testnet): Another AMM in testing phase that provides additional liquidity on Soroban, allowing users to diversify swap routes and options.

Note: is not included as it is incompatible with Soroban-based smart contracts, and the Soroswap Aggregator only works with Soroban-based protocols.

DexDistribution

Each time a user initiates a swap, the automatically calculates the optimal way to split the trade across different Underlying Protocols (DEX) and routes. This is done through a mechanism called DexDistribution, which defines:

  • The protocols used for the swap.

  • The fractions of the total amount to be swapped in each protocol.

  • The path of the swap, i.e., the sequence of tokens used to go from the input token to the output token.

Example of DexDistribution

Let’s assume a user wants to swap 1000 XLM for USDC. The Aggregator could split the swap among the different AMMs as follows:

  • 80% through Soroswap AMM, using the path: XLM > EURC > USDC.

  • 10% through Phoenix AMM, using the path: XLM > BTC > USDC.

  • 10% through Aqua AMM, using the path: XLM > ETH > USDC.

Adapters

Adapters are smart contracts that handle communication between the Aggregator and the Underlying Protocols. These adapters allow the Aggregator to interact with different AMMs, adjusting parameters according to the standards of each protocol. Thus, adapters act as bridges between the Aggregator and the protocols, ensuring swaps are executed correctly on each platform.

Why doesn’t the Soroswap.Finance Aggregator include Stellar DEX in DexDistribution proposals? Stellar DEX is not compatible with Soroban smart contracts, so the Aggregator only works with protocols that utilize Soroban technology.

Adapter Interface

The communication between the Aggregator and adapters is defined by the SoroswapAggregatorAdapterTrait. Adapters must implement specific methods for initialization, data retrieval, and swap execution requests. This standardized design ensures that adapters can interact with multiple protocols, regardless of their individual differences.

Soroswap.Finance Aggregator
Stellar SDEX
Soroswap Router SDK
Page cover image