Add Fees To Swap
Integrators have the option to introduce a fee for each executed 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.
Continue reading below for more detailed explanations of each step.
Last updated