# Swap

## <mark style="color:blue;">Overview</mark>

Elys Network’s **Swap feature** allows users to exchange tokens seamlessly and with **minimal slippage**, facilitated by its [<mark style="color:blue;">Smart-shielded</mark>](/docs/core-features/earn/liquidity-mining.md) pools.

You just have to choose the currencies you’d like to swap, enter the amount you want to swap, and proceed by clicking on **Receive USDC (in this example)**.

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

## <mark style="color:blue;">**How It Works**</mark>

In the unseen part of our swap function lies our liquidity pools, the engine that enables users to exchange their tokens independently and automatically.

These pools are characterized by:

* **Oracle-Powered Pricing**: Real-time oracles adjust pool weights to reflect accurate market values, ensuring fair pricing and minimizing risks of slippage.
* **Efficient Liquidity Utilization**: Through dynamic weighting, liquidity is distributed in a way that optimizes price stability and reduces slippage.

We aim to provide swaps that leverage our **SmartShielded Pools** to always ensure a price with a minimum slippage.

## <mark style="color:blue;">Benefits for Users</mark>

* Minimal slippage
* Fair and accurate pricing, maintained by our oracle.

## <mark style="color:blue;">Fee Mechanism</mark>

### <mark style="color:blue;">Swap fees</mark>

Swap fees are set at 0.1%

### <mark style="color:blue;">Membership Tier Discount</mark>

Based on portfolio balance over the past 7 days, users get a discount on swap fees.

* Platinium: 30% discount
* Gold: 20% discount
* Silver: 10% discount
* Bronze: 5% discount

<figure><img src="/files/8eNepeXqBnYbWMhl3bRB" alt=""><figcaption></figcaption></figure>

### <mark style="color:blue;">Pool Balancing - Dynamic Fee Mechanism</mark>

Elys Smart-Shielded pools incorporate a **dynamic fee mechanism** that continuously rebalances the pool back to its target weights, represented as a Pool Balance Reward (for bringing a pool closer to target weight) or a Pool Balance Fee (for taking a pool further away from target weight).&#x20;

This mechanism ensures that asset weights remain close to their target values, facilitating efficient trading and liquidity provision. Generally speaking, the target weight for a pool is 50:50.

### <mark style="color:blue;">Fee Calculation Formula</mark>

The Pool Balance F ees are determined by the following formula:

`Dynamic weight fees = 0.05% * (W1 / W2) ^ 2.5`

Where W1 is the weight of the asset being traded into, and W2 is the weight of the asset being traded out of.

### <mark style="color:blue;">Example</mark>

For example, let's assume that **token A is BTC** and **token B is USDC**.&#x20;

If the balance between A and B follows this trend in percentage represented in the pool: 50:50, 55:45, 60:40, 65:35, 70:30, 75:25, 80:20, 85:15, 90:10, 95:05

#### **To swap BTC (Token A) to USDC (Token B) for each scenario :**&#x20;

<figure><img src="/files/6wkSBlxQFjUSSTShP4SQ" alt=""><figcaption><p>Pool Balance Fee Chart A/B</p></figcaption></figure>

#### **To swap USDC (Token B) to BTC (Token A) for each scenario :**&#x20;

<figure><img src="/files/FIikzheM38bYVCSUymXm" alt=""><figcaption><p>Pool Balance Fee Chart B/A</p></figcaption></figure>

#### **Table summarizing all the scenario :**

| Token A / Token B Weight | Swap Token A to Token B | Swap Token B to Token A |
| ------------------------ | ----------------------- | ----------------------- |
| 50% / 50%                | 0.05%                   | 0.05000%                |
| 55% / 45%                | 0.08%                   | 0.03028%                |
| 60% / 40%                | 0.14%                   | 0.01814%                |
| 65% / 35%                | 0.24%                   | 0.01064%                |
| 70% / 30%                | 0.42%                   | 0.00601%                |
| 75% / 25%                | 0.78%                   | 0.00321%                |
| 80% / 20%                | 1.60%                   | 0.00156%                |
| 85% / 15%                | 3.82%                   | 0.00065%                |
| 90% / 10%                | 12.15%                  | 0.00021%                |
| 95% / 5%                 | 78.68%                  | 0.00003%                |

When a swap or a liquidity provider improves the weight and brings it closer to the target, both the swap fee and Pool Balance Fee are reduced to 0, along with an added incentive bonus (Pool Balance Reward).


---

# 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://elys-network.gitbook.io/docs/core-features/swap.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.
