# Swaps

In this section, we will explain how swapping NFTs in Caviar's custom pools works. Custom pools allow liquidity providers to create their own pools with advanced parameters, offering more control over the trading process. Swapping in custom pools is similar to swapping in shared pools, but there are differences due to the unique features of custom pools.

### Swapping Process in Custom Pools

Swapping in custom pools follows a similar process to shared pools, with some variations due to the pool's custom parameters:

1. **Input the NFT**: The user inputs the NFT they want to sell. The AMM algorithm calculates the estimated amount of the output asset based on the pool's current state. It will take into account the current virtual reserves and the fee rate that has been currently set.
2. **Review and confirm the swap**: The user reviews the estimated output amount, which is subject to slippage depending on the pool's liquidity and the trade size. If the user is satisfied with the estimated output, they confirm the swap.
3. **Execute the swap**: The AMM algorithm facilitates the trade by exchanging the input asset for the output asset. The NFT and reserve asset quantities in the custom pool are updated accordingly.
4. **Apply fees**: The custom trading fee set by the liquidity provider is applied to each swap. The fee is distributed to the liquidity provider as a reward for their contribution to the market liquidity.
5. **Update pool state**: After the swap is complete, the AMM algorithm updates the pool state, adjusting NFT and reserve asset quantities and recalculating the price based on the custom parameters.

By following these steps, users can swap NFTs for reserve assets or vice versa in Caviar's custom pools. The custom parameters provide additional flexibility and control for liquidity providers, allowing them to optimize their pool's performance and meet specific trading requirements.


---

# 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.caviar.sh/concepts/custom-pools/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.
