# Swaps

## Execution

LemmaSwap utilizes the USDL and synthetic token collateral pools to execute swaps. For example, let’s say a user wants to swap ETH for BTC, and LemmaSwap has spot BTC on its synthetic BTC (BTC\*) balance sheet. The following steps would be executed atomically:

* The user’s ETH would be sent to a perpetual futures DEX
* LemmaSwap would increase the ETH short perpetual position backing USDL by the exact amount of ETH deposited
* LemmaSwap would increase the BTC long perpetual position backing BTC\* by the exact USD amount by which it increased the ETH short
* The freed up spot BTC collateral would be sent back to the user

The USD value of the collateral backing USDL and the synthetic tokens stays constant, but the distribution of the spot assets changes. In the chart below, we illustrate a user swapping ETH for BTC. hETH stands for “hedged ETH” and represents a long spot ETH + short ETH futures position.

<figure><img src="https://lh6.googleusercontent.com/H8mLGynwmE5h3XPDh39JanoU2v11FjnK_eFgN_OhZ4x7CwLP7oL05eHzTN8moxIXMks7fVYDs0m1WIOHQ2mWcvUDwzlWbbgRKSvx4dP79fo9OZ528eI4_kaiBH6LkTC3fXjGh4L_Ih1xRkyQgJYXV5D7sFKIlz_tm-PKDvC1_MQxZrX7Dor_W_7s2w" alt=""><figcaption><p>Swapping ETH for BTC</p></figcaption></figure>

## Rerouting

If a user wants to buy more assets than USDL has on its balance sheet, LemmaSwap will reroute the unfilled part of the order to an aggregator.

Eg. If a user wants to buy 50 million USD worth of BTC but USDL only has 30 million USD worth of hedged BTC on its balance sheet, then the first 30 million USD worth of the order will be filled and the remaining 20 million USD will be rerouted to a spot DEX aggregator.

## Fees

LemmaSwap will initially charge a 0.3% “fee” on every trade.


---

# 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://docs.lemma.finance/concepts-overview/swaps.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.
