> For the complete documentation index, see [llms.txt](https://docs.nullmask.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nullmask.pro/user-guide/swapping.md).

# Swapping

Shielded swaps execute Uniswap V2 token swaps within the privacy pool. Your trading activity is hidden from on-chain observers.

### Steps <a href="#steps" id="steps"></a>

1. Navigate to the **Swap** screen<a class="button secondary"></a>
2. Select the input token (From)
3. Select the output token (To)
4. The app checks if a valid Uniswap pair exists
5. Enter the input amount
6. The app fetches a quote showing the expected output
7. Optionally adjust slippage and deadline settings
8. Confirm the swap transaction in your wallet

### What Happens <a href="#what-happens" id="what-happens"></a>

1. The wallet signs a Uniswap V2 swap transaction
2. The proxy intercepts and generates a ZK proof
3. The contract verifies the proof
4. The contract executes the actual swap on Uniswap V2
5. The swap output is captured as a new note in the Merkle tree

### Fee Handling <a href="#fee-handling" id="fee-handling"></a>

* If the fee token matches the swap input token, fees are deducted from the input pool
* If they differ (e.g., paying ETH fees for an ERC-20→ERC-20 swap), separate fee notes are required

#### ERC-20 → ERC-20 Swaps <a href="#erc-20-erc-20-swaps" id="erc-20-erc-20-swaps"></a>

These generate 3 transaction entries in history:

1. One outgoing ERC-20 (input)
2. One incoming ERC-20 (output)
3. One outgoing ETH (fee)

### Slippage and Deadline <a href="#slippage-and-deadline" id="slippage-and-deadline"></a>

* **Slippage**: Minimum acceptable output (set via `amountOutMin`)
* **Deadline**: Maximum block timestamp for the swap to execute

Both are enforced by the Uniswap V2 router on-chain.


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://docs.nullmask.pro/user-guide/swapping.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
