Swapping
Last updated
Last updated
Swaps represent a process where a user decides to exchange a selected amount of held Token A's for Token B's. The user states their intention by submitting a swap request, which gets fulfilled by an Agent interacting with the correct liquidity pool.
We prepared some basic "good-to-know tips" you should keep in mind before jumping into your first swap:
Slippage - Before every swap, a tolerated slippage percentage of the exchange rate has to be specified. This is because there may be multiple requests waiting in the queue to get fulfilled. If these requests were queued sooner than the user's request, they will affect the final exchange rate by the time his request is carried out.
Request Oil ADA - The Cardano network requires that every transaction output contains at least a small amount of ADA. To satisfy this requirement, a 2 ADA "deposit" called Request Oil ADA needs to be included in the swap request. This amount is returned with the exchanged assets after finishing the transaction. In case a routed swap is used instead, oil ADA is increased to provide at least 2 ADA for each request in the swap chain.
Swap Fee - Every swap is subject to a swap fee. A swap fee is in place to ensure the smooth operation of WingRiders DEX and reward liquidity providers.
Deadline - Swap requests have a limited validity interval and expire after a given deadline. The deadline represents how long a user is willing to commit to a swap with the given properties (slippage, exchange rate). It is both to protect the users as the requests might take time to fulfill and to not interfere with the Agents' interactions with the liquidity pools.
To sum things up, we will demonstrate a token swap in the following image:
To facilitate more convenient exchanges between tokens with no direct pool available, the contracts support routing swaps that go through an intermediary pool. The web interface calculates the expected prices and proposes a set of possible routes prioritizing the most efficient ones. Keep in mind that a routed swap is equivalent to making two swaps, so the swap fee would be paid twice, once in the initial token -> intermediary token swap, and once in the intermediary token -> desired token swap. It's not possible to always guarantee a successful route execution, so it's possible the second request is not executed in case the price changes drastically.
You can create a swap request under the Swap tab. After picking both assets, you can fill in either of the amount fields and the other one will be automatically calculated. At the same time, you will see the fee at the bottom being updated.
To access the Transaction settings, click the ⚙️ button. There you will find the option to adjust the slippage tolerance, unlock token ratio editing and deadline.
To see a more detailed breakdown of all the fees and assets, click the Total fees button.
Once you are ready, click Swap. WingRiders will let you once more review the transaction details. If you are satisfied with the transaction, confirm it using the Confirm button. Afterward, you will be prompted by your connected wallet to sign the transaction (example from Nami Wallet, the interface may differ in other wallets).
After successful execution, you will see that swap listed in the Completed tab.
After a successful signature, WingRiders will inform you about a successful swap request submission. You can track the progress of your request in the Transactions tab, either by clicking Transaction list in the message window or clicking Transactions in the top right corner.