🧑🏫How to add/remove liquidity
In these two guides, you'll find the required steps to provide liquidity and to withdraw liquidity from ALEX DEX pools.
Last updated
In these two guides, you'll find the required steps to provide liquidity and to withdraw liquidity from ALEX DEX pools.
Last updated
When adding liquidity, you will deposit an equivalent value of both tokens into the pool. In return, you'll receive LP tokens, which represent your share of that specific liquidity pool.
When removing liquidity, you will transfer your LP tokens back to the ALEX smart contract and withdraw an equivalent value of the token pair plus any fees accrued while holding those LP tokens. Since the relative balance of the tokens in the liquidity pool may have changed since your initial deposit, you could experience what's known as Impermanent Loss.
Ready to start? Let's get hands-on!
Go to https://app.alexlab.co/ and click on navbar's Swap -> Pool tab.
All available pools will be displayed including information such as:
Trading Pair: The token pair that constitute liquidity pools to which you can add liquidity.
Liquidity: The total liquidity in the pool, expressed in USD value.
Volume: The trading volume between the token pair over the last 7 days. By hovering on the trading volume for a specific row/pool, the 24-hour volume is also displayed.
Fee Rebate: Potential LP earnings from swap fees over a year, based on the last week's average. This metric, also known as Pool APR, reflects the potential profitability of participating in a pool over a year, assuming similar trading activity continues.
Select the token pair to which you want to add liquidity from the displayed list. Note you can sort by pool metrics.
When hovering over a pool, you might notice a "+LP" button. This serves as a visual indicator for the selected pool. Clicking it will take you to the same screen as clicking anywhere on the pool's row.
After selecting a pool, you will be taken to a control panel for that specific liquidity pool, where you can add liquidity to the token pair and view more detailed .
When you set the amount for one token, the corresponding amount for the other token is automatically calculated, as liquidity must be provided in equal value for both tokens.
Need tokens? Visit the Token Swaps docs section and to learn how to exchange tokens on ALEX Lab platform.
Clicking the "Max" button will automatically set the amount to your total available balance.
If you want to adjust slippage, select the "Settings" icon to open the Transaction Settings panel and set your desired tolerance. The default slippage tolerance for non-stable swap token pairs is set to 4%, meaning your transaction will revert if the exchange rate changes unfavourably by more than this percentage. The displayed number of LP tokens you will receive is approximate due to this potential variation.
One you decide the amount, click the "Add" button. Confirmation panel will appear. Here you can double check balances, slippage and LP tokens. If everything it's okay, click "Confirm" 😎
After clicking "Confirm", you will need to confirm the transaction in your wallet. Here, your Stacks wallet is interacting with ALEX smart contract and is asking you for approval. Scroll through the wallet transaction window, review it and confirm the transaction. By doing this, you are allowing the wallet to sign and broadcast the transaction.
To be completely sure, you can check:
Transaction is requested by "Alex app" (app.alexlab.co)
The amounts you will transfer to the smart contract, covered by Stacks post conditions. Note that one transfer amount is exactly determined (STX in the example) while the other is subject to a "less than or equal to" condition. This accounts the potential slippage variation, and here you can see the exact upper bound. If these conditions are not met, the transaction will abort.
Wait for the transaction to be confirmed on the network.
Recommended to track transaction status:
Turn on Telegram notifications, you will get notified when the transaction is confirmed.
Search for the transaction on the ALEX Explorer.
Check your address activity on the wallet.
After successfully adding liquidity, you will be able to see your LP tokens and related details in "My Liquidity" panel.
My LP are your LP token holdings specific to the pool you contributed to. Each pool issues its own unique LP tokens.
The Pooled amount represents your total token holdings in the liquidity pool. Initially, reflects the amount you added and it increases over time due to accrued fees, showing your updated share of the pool's total liquidity.
The My Pool Share shows how much of the overall pool you own, as a percentage.
The Indicative Value reflects the value of your holdings in USD, which can change based on the price action of the underlying assets.
You can find the "My Liquidity" panel above the Liquidity Pool control panel (shown in Step 3). A summarized version is also available under the Swap -> Pool tab or at https://app.alexlab.co/pool.
As when adding liquidity, go to https://app.alexlab.co/ and click on navbar's Swap -> Pool tab.
Once you're on the Pool page, you'll find the "My Liquidity" panel at the top of the pool list. This panel provides a summary of all your pool contributions.
Select the pool you would like to remove liquidity from, either through the "My Liquidity" panel or directly from the pool list.
Once in the panel of the pool, select the "Remove Liquidity" tab.
For this step, it's important to have in mind that the LP tokens you hold represent your share of the pool's funds. By entering the LP token amount, you're specifying the portion of the pooled funds you want to withdraw. Clicking the "Max" button sets your entire LP token balance, indicating you want to remove all liquidity from the pool.
When you enter the amount of LP tokens, you are specifiyng amount you will transfer to ALEX smart contract in order to receive your funds and any accrued fees in return. These fees are the ones accrued while holding those LP tokens.
Once you have decided the LP token amount, click the "Remove" button.
A confirmation panel will appear where you can double check the amount. If everything looks correct, click "Confirm" 😎
After clicking "Confirm", you will need to confirm the transaction in your wallet. Here, your Stacks wallet is interacting with ALEX smart contract and is asking you for approval. Scroll through the wallet transaction window, review it and confirm the transaction. By doing this, you are allowing the wallet to sign and broadcast the transaction.
Wait for the transaction to be confirmed on the network.
Recommended to track transaction status:
Turn on Telegram notifications, you will get notified when the transaction is confirmed.
Search for the transaction on the ALEX Explorer.
Check your address activity on the wallet.
Once the transaction is completed, you will see the changes reflected in the "My Liquidity" panel, and the updated token balances should appear in your wallet.