Add fees to swap
Integrators have the option to introduce a fee for each executed swap.
Last updated
Integrators have the option to introduce a fee for each executed swap.
Enable any Aquarius integrator to take a configurable commission on each swap—without mixing classic Stellar payments and Soroban calls in one transaction.
Configurable Fee Fraction: Specify the maximum fee allowed by the contract (for example, 2%), then set the fee amount for each individual swap for maximum flexibility.
Fee Destination: Route collected fees into a single “fee destination” address of your choice.
Uniform Denomination: Swap fees can be converted on claim into one target asset (for example, 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.
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