# Smart Order Router

## Overview

The **Smart Order Router (SOR)** is a **core component of Mondrian Swap's technology stack**, designed to optimize **trade execution** by finding the **best possible prices** for users.

For any given trade, **the SOR determines the most efficient path**, ensuring minimal slippage and maximizing output. This **path optimization** can range from a **single direct swap** to **multi-hop transactions** across multiple liquidity pools.

By dynamically routing orders, the **SOR enhances capital efficiency**, ensuring that liquidity is utilized effectively across the **entire Mondrian Swap ecosystem**.

***

## Single Swap & Multi-Hop: Utilizing All Available Liquidity

As **the number and diversity of pools on Mondrian Swap grow**, the **SOR becomes increasingly powerful** in executing trades efficiently.

Without a **Smart Order Router**, increased pool variety can lead to **liquidity fragmentation**, causing **higher slippage** for traders. However, with the **SOR**, every trade benefits from access to **the deepest available liquidity**, reducing **price impact**.

### 📌 **Key Benefits:**

✅ **Optimal price execution** for every trade.\
✅ **Access to fragmented liquidity** across multiple pools.\
✅ **Improved trading conditions for low-liquidity altcoins**.\
✅ **Multi-hop transactions** to find the most efficient swap path.

### 💡 **How Multi-Hop Works:**

* Instead of executing a **single swap**, the SOR **splits a trade** into multiple steps across **different liquidity pools** to achieve a **better overall price**.
* This ensures that **every dollar in any of Mondrian Swap’s pools contributes to trade execution**, as long as adding a **hop** reduces **slippage** and improves **output**.

<figure><img src="/files/oLP20vTxrluKyS4irlTm" alt=""><figcaption></figcaption></figure>

***

## How it Works

The **SOR’s optimization mechanism** finds the **best trading path** across a **set of Balancer-based liquidity pools**, considering:

✔ **Pool Depth** – Prioritizing pools with the highest available liquidity.\
✔ **Slippage Reduction** – Avoiding pools with significant price impact.\
✔ **Gas Cost Efficiency** – Ensuring that multi-hop transactions remain cost-effective.\
✔ **Arbitrage Opportunities** – Exploiting price differences across pools when possible.

By **continuously scanning and rebalancing trade routes**, the **SOR enables users to get the best possible execution for their swaps**—whether they’re swapping stablecoins, blue-chip assets, or low-liquidity altcoins.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mondrianswap.gitbook.io/mondrianswap/products/smart-order-router.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
