# Add Fees To Swap

Enable any Aquarius integrator to easily take a configurable commission on each swap—without mixing classic Stellar payments and Soroban calls in one transaction.

### **Core Features**

* **Configurable Fee Fraction:** Specify maximum fee allowed by contract (e.g. 2 %) and then specify any the fee amount for each swap for maximum flexibility.
* **Fee Destination:** Route collected fees into a single “fee destination” address of your choice.
* **Uniform Denomination:** Allow swap fees on claim into one target asset (e.g. XLM, USDC, AQUA), so you aren’t left holding a basket of tokens.
* **Out‑of‑the‑Box Wrapper:** A standalone Soroban contract sits atop our Aquarius AMM Router. Call it instead of directly calling the router, and it handles fee deduction and forwarding for you.
* **Secure & Flexible:** Operators can claim raw fees or immediately swap them via predefined routes.

### **Setup Instructions**

**1. Deploy a Fee Collector Smart Contract**

To begin collecting swap fees, deploy your custom fee collector smart contract. This contract stores core parameters such as:

* Fee destination address
* Maximum allowed fee
* Operator address (authorized to claim fees)

**2. Execute Swaps Using the Fee Collector**

Once deployed, the fee collector smart contract allows you to execute swaps similarly to regular Aquarius swaps, with the added capability to specify and collect fees.

**3. Claim Collected Fees**

At any time, the designated operator can invoke the claim method on the smart contract to transfer accumulated fees to the specified destination address.<br>

Continue reading below for more detailed explanations of each step.<br>


---

# 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.aqua.network/developers/code-examples/add-fees-to-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.
