> For the complete documentation index, see [llms.txt](https://docs.wombat.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wombat.exchange/getting-started/swap.md).

# Swap

Utilizing a stableswap 2.0 model, Wombat users can: swap stablecoins at hyper-efficient exchange rates with minimal slippage.

The swap price is defined by the rate of change in cash of asset x per change in cash of asset y. Defined as:

$$
exchange\ rate = \frac{\partial A\_x}{\partial A\_y} = \frac{1 + \frac{A}{r\_x^2}}{1 + \frac{A}{r\_y^2}}
$$

As you may have noticed, the exchange rate is independent of the number of token x and token y in the pool and depends solely on the **coverage ratio**.

#### Example

Assume $$A$$ = 0.05, $$r\_x$$ = 80% and $$r\_y$$ = 150%. We have

$$
exchange\ rate = \frac{1 + \frac{0.05}{0.8^2}}{1 + \frac{0.05}{1.5^2}} \approx 1.055
$$

If we reverse the direction, swap from token y to token x. We have

$$
exchang\ rate = \frac{1 + \frac{0.05}{1.5^2}}{1 + \frac{0.05}{0.8^2}} \approx 0.95
$$

### Incentives for convergence of coverage ratio

Wombat incentivizes a swap if the coverage ratio of two tokens is converged and penalizes if it diverges, as shown in the above example. It helps keep the pool in a healthy state and prevents a token from being defaulted. Learn more in below guide:

{% content-ref url="/pages/gxeklBix52Xij5cbwGph" %}
[Deposit Gain and Withdrawal Fee](/concepts/fees/deposit-gain-and-withdrawal-fee.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.wombat.exchange/getting-started/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.
