09 June 2022
4 min read
Decentralized Finance (DeFi) has experienced a wave of enthusiasm for Ethereum and other smart contract platforms like Binance Smart Chain, Solana, etc. We can see the popularity of Yield Farming for token distribution, the surge in volumes of flash loans, and the growth of tokenized BTC on Ethereum.
Meanwhile, we couldn’t help but notice automated market maker protocols regularly encountering high liquidity, competitive volumes, and an increase in the number of users.
But many of us often wonder about what AMM is in-depth and the risks attached to it. Let’s find out.
An automated market maker (AMM) is the underlying protocol that intensifies a decentralized exchange (DEX) via the trading of digital assets in a permissionless and automatic procedure, using crypto liquidity pools as complements, instead of a conventional buying/selling market. Instead of using an order book like a traditional exchange, AMM relies on a mathematical formula, or pricing algorithm, to price assets. Each protocol uses this formula in its own way for the specific use-cases they target. For example, Uniswap uses a x b = k, where ‘a’ and ‘b’ are the respective amounts of the two tokens in the liquidity pool, and k is a fixed constant, which means that the pool’s total liquidity always remains constant. The connection between all of them, however, is that they determine the prices algorithmically.
Liquidity providers (LPs) put funds into liquidity pools. One could imagine a liquidity pool as a huge amount of funds that traders can trade-off. In return for supplying liquidity to the protocol, LPs receive fees from the trades occurring in their pool. The rewards are determined by the protocol. But why drawing liquidity to the pool is so important? The framework of AMMs implies that the liquidity is inversely proportional to the slippage of large orders. And that, in turn, may attract more volume to the platform, and the cycle goes on.
The slippage issues vary with different AMM designs, but it’s important to remember that the pricing is determined by an algorithm. Hence, it is determined by the amount of change in the ratio between the tokens in the liquidity pool after a trade. If the ratio varies by a wide gap, the amount of slippage will increase.
What is Impermanent Loss?
In simple terms, when the price ratio of deposited tokens changes after you deposited them in the pool, impermanent loss occurs. The bigger the change, the bigger the impermanent loss. It is why AMMs work best with token pairs of a similar value. If the price ratio between the pair remains in a relatively small range, the impermanent loss is also insignificant.
“Impermanence” considers that if the assets go back to the initial prices where they were deposited, the losses are mitigated. But if you withdraw your funds at a different price ratio than when you deposited them, the losses are very much permanent. In some cases, the trading fees might mitigate the losses, but it’s still crucial to consider the risks.
A thorough Analysis of Impermanent Losses
Let’s take the ETH-USDT fund pool as an example to quantitatively analyze the risk of AMM. Suppose that the market maker deposits x0 ETH and y0 USDT into the fund pool at the price of P0, and the market maker’s assets will become xn ETH and yn USDT at the price of Pn. There are the following five market-making groups:
1.Group 1, which wants to hold USDT for a long time, participates in market making, hoping to convert into USDT to maintain positive returns.
Under the xyk AMM model, its rate of return = yn/y0 -1 = (Pn/P0)^.5 -1 for the market-making group without considering the fee income.
Figure 1- Mining profit and loss of market maker group 1
2. Group 2, which wants to hold ETH for a long time, participates in market making, hoping to convert it into ETH to maintain a positive income.
Under the xyk AMM, its rate of return = xn/x0 -1 =(P0/Pn)^.5 -1 for group 2 without considering the fee income.
Figure 2 Mining profit and loss of market maker group 2
3. Group 3, which wants to hold both ETH and USDT for a long time, participates in market making, hoping to convert into USDT to maintain a positive return.
Its rate of return = 2yn/(x0Pn + y0)-1=2(P0Pn)^.5/(Pn+P0) -1 without considering the fee income.
Figure 3 Mining profit and loss of market maker group 3
4. Group 4, which wants to hold both ETH and USDT for a long time, participate in market making, hoping to convert into ETH to maintain a positive return.
Its rate of return = 2yn/(x0Pn + y0)-1=2(P0Pn)⁰.5/(Pn+P0) -1 without considering the fee income.
Figure 4 Mining profit and loss of market maker group 4
5. Group 5, sushiswap single-sided solution: depositing ETH, borrowing equivalent SIL, and returning SIL when withdrawing.
Its rate of return = (2xn — (y0)/Pn))/x0 -1= 2(P0/Pn)^.5 — P0/Pn -1 without considering the fee income.
However, the sushiswap single-sided solution cannot hedge impermanent losses, but the market maker’s assets will have the risk of returning to zero when the price falls by 75%.
Figure 5 Mining profit and loss of market maker group 5
Based on the quantitative analysis of the above five groups, the profit and loss of automatic market makers are related to price. Group 1 bears the risk of price falling, group 2 bears the risk of price rise, and groups 3 and 4 face losses whether price rising or falling known as impermanent loss in the industry.