Liquidity pools 101
We are happy to announce that liquidity pools are now a part of MuesliSwap's Hybrid DEX. This page aims to explain the concept of liquidity pools from user's perspective in simple terms. Please note this is not investment advice.
Let's say Alice wants to buy 1 ADA for BTC at the current (market) price. In a traditional market, there needs to be a second trader, Bob, who is willing to sell this 1 ADA to Alice. This allows Alice and Bob to "meet in the middle" and find a fair price for 1 ADA. This is the orderbook model.
However, it could happen that at the moment there is no one selling their ADA and thus Alice can't trade it either. This problem can be solved by introducing a liquidity provider. The liquidity provider owns a certain amount of ADA and BTC available for trading. He or she then uses it to act as a counterparty to Alice's trade. The liquidity provider charges a slightly higher price for buying ADA than for selling it, earning a small profit on every transaction.
In off-chain finance, the role of liquidity provider is traditionally fulfilled by financial institutions. Liquidity pools (LPs) are a way to democratize this role on the blockchain. In principle, a liquidity pool is a smart contract that holds tokens A and B. Without going into technical details, for this model to work, the liquidity pool is programmed to follow a simple rule: the ratio of token A to token B in the pool determines the price of A/B. Anyone can provide their tokens ("liquidity") to the pool in the current ratio. A liquidity provider then owns a share of the pool.
Alice can now trade ADA/BTC against the liquidity pool - e.g. by depositing x BTC, the smart contract lets her withdraw the equivalent value from the pool, y ADA. Because the ADA/BTC ratio in the pool has changed, this also changes the pool price offered to the next trader.
The smart contract also charges a small percentage of each trade as a transaction fee, adding the fee amount to the total pool amount. The total amount of tokens locked in the liquidity pool will therefore slightly increase, resulting in a profit for liquidity providers. The higher the trading volume, the more liquidity providers earn on transaction fees.
When a provider decides to withdraw their liquidity, they will get back their share of the pool (tokens A and B). If transaction fees have added more tokens into the pool, the provider will have made a profit. However, if the price of A/B has changed, the provider will have made a loss compared to the situation if they had kept the tokens A and B in their wallet the whole time. The more the price changes in either direction, the less resulting total value the provider gets back. The bigger the price change in any direction, the more liquidity providers lose on this so-called "divergence loss", or "impermanent" loss.
The main concept of providing liquidity is that transaction fee gains should outweigh divergence losses. For volatile token pairs, it might make more sense to add liquidity into a pool with a higher transaction fee to make a profit, whereas for stable token pairs, it might make sense to choose a liquidity pool with a lower fee, where the transaction volume is higher.
Before providing liquidity, it is useful to estimate both potential gains based on the pool's volume, and potential losses based on the tokens' volatility. The resulting profit or loss is then a sum of these two percentages. For the latter, one can use an online tool such as: https://dailydefi.org/tools/impermanent-loss-calculator/
Liquidity Pools on MuesliSwap
For security reasons, the creation of liquidity pools is currently permissioned. If you want to create a new liquidity pool for your token, please feel free to reach out to us.
To add liquidity for a token pair, press the "Add Liquidity" button for the relevant liquidity pool.
- 1.Click "+ Add Liquidity"
- 2.Select the amount of one of the tokens you want to provide
- 3.The amount of the other token is automatically determined by the current price in the liquidity pool.
- 4.Click "Add Liquidity" and confirm your inputs.
Your share in the liquidity pool is represented through liquidity pool tokens (LP tokens). When adding liquidity, you will receive your liquidity pool tokens back in a separate transaction in a few seconds to minutes. You can track your open transactions in "Open orders".
Your Liquidity Positions
After connecting your wallet, you can see your open liquidity positions by clicking the "My Earnings" button. On this overview page you also have the option to remove the liquidity that you have previously added.
When removing liquidity, you can select what part of the provided liquidity to remove from the pool. When clicking the "Remove Liquidity" button, you will receive your tokens back in a separate transaction. You can track your open transactions in "Open orders".