> For the complete documentation index, see [llms.txt](https://docs.silverswap.io/spiritswap-v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.silverswap.io/spiritswap-v3/v2-core-features/exchange/vamm.md).

# vAMM

SpiritSwap provides users a simple way to swap tokens on Fantom via automated liquidity pools. In a swap, one token is sold to buy another token. The rate of the swap is determined by the AMM with the equation:\
\
&#x20;                                                                      $$x\*y=k$$

\
Where *x* = the number of $AAA tokens, *y* = the number of $BBB tokens, and *k* is a constant. The trader is charged a 0.18% fee to make a swap.

<br>

![](/files/FOpIl14RG0yVMIaYlfKS)

In Figure 1, a trader is swapping $AAA token for $BBB tokens. The trader sends 100 $AAA tokens to the AMM. A 0.18% fee is applied and 0.18 $AAA tokens are not included in the swap. The remaining 99.82 $AAA tokens are swapped in the AMM to $BBB tokens. Since the AMM will be losing $BBB tokens, it must gain $AAA tokens to keep *k* constant. The equation:

\
&#x20;                                            $$(1,000+99.7)\*(10-y)=10,000$$

Can be solved for *y* to give the number of $BBB tokens that the trader will receive. The 0.18% fee of 0.18 $AAA tokens are directly added to the liquidity pool reserves, slightly increasing the value of *k.*<br>


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.silverswap.io/spiritswap-v3/v2-core-features/exchange/vamm.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
