Finally tackling perhaps, the biggest term in the DeFi space, one that has drawn in billions of dollars in value into the space and has been highly confusing for beginners. The idea of providing liquidity to a market is nothing new, it is essentially like placing a limit order in a regular centralised order-book-based exchange. In that case you are the market maker, providing a trade for the taker who comes in and buys/sells your order at your price. However, with the rise of automated market makers such as Uniswap dominating the DeFi space liquidity differs a fair bit in a case like that, if you want to learn more about Uniswap in general you can check out my article on it here.
How automated market makers work
AMMs have taken the DeFi space by storm, with the biggest ones being Uniswap, Curve and Balancer (with hundreds of other forks and clones). Essentially what they all have in common is they provide a swap pool where you get to swap one asset for another, for example you deposit in Ethereum and get USDC in return. Obviously, this exchange can’t come from nowhere, someone has to take your Ethereum and give you USDC in return. This is where the role of liquidity providers comes in, as an LP you supply both ETH and USDC to the swap pool, granting a service to users wishing to swap between them. For that service you take a small fee of every transaction (0.3% in the case of Uniswap, 0.02% in Curve and custom in Balancer). So, if someone was to swap 1000 USDC for 2 ETH for example they would pay 1003 USDC for the 2 ETH on Uniswap, and you as the LP pocket that 3 USDC as fees. This means that in the long term if the price of the assets you are providing liquidity for remains constant (or close to constant) you keep pocketing all these fees over time.
Obviously, however, nothing comes for free. And you as the LP have to take on some risk to pocket those fees, and that is where the risk of price changes come in the form of Impermanent Loss. This also doesn’t include the risk of these contracts possibly having vulnerabilities that could allow attackers to steal your money, but that is a risk you assume as soon as you step into the online world in the first place.
Understanding impermanent loss
There are many terms for this phenomenon, but IL is the most popular one by far due to how it summarises how and why it happens. As the name implies, this loss is not permanent and only occurs when you exit the LP position at a different price than you entered at. For example, if you entered the aforementioned ETH/USDC pool when ETH was $250 and exited 1 month later at $350 per ETH you would have experienced IL. In this case, holding your ETH and USDC separately outside the pool would have actually been more profitable than putting them into the pool. This occurs due to how these pools function, where users deposit one asset and take out another (which is what changes the price), so you end up with more of the (now) less valuable asset and less of the more valuable one. As such, LP positions are seen as long-term positions rather than short term one most often (except in liquidity mining, mentioned later). This is due to the fact that IL doesn’t occur if you leave at around the same price you went in at, meaning you got all the fees and no potential loss.
This has made some pools more desirable to provide liquidity for than others, for example stablecoin or synthetic asset pools. Which is the idea behind Curve, which allows you to provide liquidity to massive stablecoin and tokenised BTC pools, because all of these assets are correlated in price (or atleast very closely so), you experience little to no IL. Obviously, this means your profit is also much lower, so it is up to you to weigh the gains and risks. I will only be going into specifics of Uniswap here as Curve and Balancer will require their full separate articles later. Uniswap uses a simple formula of x * y = k for its pricing, where k is a (assuming no additional liquidity is provided) and x and y being the number of tokens inside the pool. So, for example a pool consisting of 1 ETH and 500 USDC would have a k variable of 500, meaning that any swaps (assuming no liquidity is added or removed) has to keep k the same. In this scenario if someone wanted to sell ETH to USDC they would deposit in 0.5 ETH, but they wouldn’t take out 250 USDC as you might expect. This is known as slippage.
Slippage and why high liquidity is important
In the previous example where we have a pool of 1 ETH and 500 USDC and someone was to swap 0.5 ETH to USDC at first glance you would expect them to get back 250 USDC as 1 ETH = 500 USDC. However, if that happens the constant “k” would no longer be the same (it would be 1.5 * 250 =375, and it was 500 before). To keep “k” the same the pool would need to have the 1.5 ETH in it and 333 USDC, meaning the 0.5 ETH sell only gave back the user 166 USDC instead of the expected 250. This is known as slippage and is the reason high liquidity is very important. For example, let us take the exact same scenario but instead the pool has 10000x the liquidity and the user swapped the same 0.5 ETH. In this case the slippage would be near negligible and the user would receive just under 250 USDC (say maybe 249.99, an insignificant slippage). As such, you can see why users would much rather trade using a pool with a lot of liquidity in it.
Now, lets look at the LP side in the situation above and how that would affect their total holdings. In the example where the pool now has 1.5 ETH and 333 USDC instead of the initial deposit of 1 ETH and 500 USDC IL has occurred. As an LP, your new total is now 333 USDC + 1.5 ETH (* 222 as the new price) which is 666 USDC, however, if you held your ETH and USDC outside the pool you would instead own 722 USDC, that difference in values is IL. Later if the price returned to 1 ETH = 500 USDC by someone now swapping those 166 USDC back to ETH you would now be have 1 ETH + 500 USDC again in your position, reversing the IL. In the case of Uniswap you would also have gained 0.0015 ETH and 0.5 USDC in fees, so you would have made a return of just over 1% in this example.
This article will be released over 2 parts due to it being much larger than my average articles and having much more information. Stay tuned for the follow-up part 2 soon. Thanks for reading.