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 .
Ready to start? Let's get hands-on!
Go to 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.
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.
After clicking Confirm
, you will need to confirm the transaction in your wallet. Here, your Stacks wallet is interacting with the 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.
You may need to wait between 20-40 minutes for your balance to update in your wallet once it is confirmed on the network.
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.
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 the 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.
After clicking Confirm
, you will need to confirm the transaction in your wallet. Here, your Stacks wallet is interacting with the 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.
You may need to wait between 20-40 minutes for your balance to update in your wallet once it is confirmed on the network.
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.
Need tokens? Visit the docs section and to learn how to exchange tokens on ALEX Lab platform.
One you decide the amount, click the Add
button. A confirmation panel will appear. Here, you can double check balances, slippage and LP tokens. If everything is okay, click Confirm
The amounts you will transfer to the smart contract, covered by . 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.
Turn on , you will get notified when the transaction is confirmed.
Search for the transaction on the .
As when adding liquidity, go to and click on navbar's Swap
-> Pool
tab.
A confirmation panel will appear where you can double check the amount. If everything looks correct, click Confirm
Turn on , you will get notified when the transaction is confirmed.
Search for the transaction on the .