IOSG Ventures_EN

Posted on Jan 04, 2022Read on Mirror.xyz

The Day after Tomorrow for AMM Protocols: Potential Losses to Beware of in the Post Liquidity Mining Era

IOSG Ventures

Special thanks to DODO and Longhash Ventures for providing valuable feedback!

Author: Amidzic Momir | Analyst @IOSG VC

Liquidity mining has proven to be effective incentivizing scheme for bootstrapping protocols and recently we witnessed one of the wildest liquidity mining events in the short history of DeFi. Notably, Uniswap launched its own governance token, following several successful forks (e.g. Sushiswap). Each address that has ever called the Uniswap v1 or v2 contract earned right to 400 UNI tokens, including more than 12,000 addresses that have submitted failed transactions! Moreover, liquidity mining was extended until November 17th, allocating UNI tokens to four pools: USDC/ETH, ETH/USDT, DAI/ETH & WBTC/ETH. The community reaction was overwhelming, driving TVL above $3B mark!

Uniswap v2, Historic TVL

The hype around UNI token mining combined with Uniswap’s perceived role as one of the pillars of DeFi ecosystem together attracted billions of dollars of capital. Having so much depth helped Uniswap offer the most competitive prices on large trades! For instance, if you were to sell 1000 ETH, Uniswap would be among exchanges offering the best pricing terms.

On the other hand, new automated market maker (AMM) solutions are pushing the boundaries further. Particularly, the liquidity for ETH/USDC pair on Uniswap exceeds $560M, yet DODO that has about $8.6M for the same trading pair, can offer almost as competitive pricing as Uniswap. Likewise, if you were to trade 1000 ETH for USDT, Cofix would offer similar terms despite having several times smaller liquidity than Uniswap.

Comparing Trading Terms for Executing 1000ETH Transaction,November 16th; Source: https://debank.com/swap?amount=1000&to=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

Comparing Trading Terms for Executing 1000ETH Transaction, November 16th; Source: https://debank.com/swap?amount=1000&to=0xdac17f958d2ee523a2206206994597c13d831ec7

Examples above illustrate higher capital efficiency of new AMM models compared to Uniswap v2. For Uniswap v2 to stay competitive it would have to maintain significantly higher capital relative to competitors. Nevertheless, would Uniswap v2 be able to do so once liquidity mining stops, whether on 17 November 2020 or any future date the community may decide on?

IOSG Ventures: Overview — Uniswap v2, COFIX, DODO

In this article, we will examine a key aspect of liquidity providers (LPs) with AMM protocols, especially post liquidity mining, i.e., potential losses as an LP. Most of Uniswap v2 TVL (~2.3B) is concentrated in the four pools designed for yield farming, and these pools also account for the largest volumes on the platform. Currently, Uniswap LPs care less about the losses since they are compensated with a valuable token and non-negligible transaction fees. However, once mining stops, the potential losses for being an LP will become a greater concern.

A framework for defining impermanent loss for AMM LPs

But what kind of loss Uniswap LPs actually suffer? The broadly adopted term to describe this type of loss is impermanent loss. It is “impermanent” because in theory it will disappear (doesn’t happen too often) in case the relative pricing between provisioned tokens recover. Impermanent loss typically refers to the value lost due to liquidity provision i.e. the difference between a hypothetical user holding tokens outside of the pool vs the resulting value of depositing those tokens into the pools.

In more detail, price discovery often happens on external markets, and Uniswap relies on arbitrage to converge the AMM price to the market price. However, arbitrage profit goes at the expense of LPs and unless the external price of the particular asset pair does return to the same ratio as when LP entered the pool, he won’t recover from this loss.

Example 1

Assuming XYT/USDC pair with initial balance 10XYT and 1000USDC (price 1XYT = 100USDC). In parallel, assume individual investor holding 10XYT and 1000USDC in his wallet.

What happens if the XYT market price jumps to 110USDC?

The pool would offer an arbitrage opportunity, since traders could take the undervalued XYT from the pool until the price converges to the market price. Specifically, traders would take about 0.47 XYT from the pool bringing the price to 110USDC per XYT token. Note that the amount needed to move the price to a specific level is determined by the formula (curve) used by the pool. The new balance in the pool would approximately be 1048.81USDC and 9.53XYT token, and considering the new price XYT = 110USDC, the value of the pool would be around $2,097. On the other hand, individual investor holding 10XYT and 1000USDC in his/her wallet, would have the portfolio value equal to $2,100, implying impermanent loss of about $3.

XYT / USDC — Hypothetical Pool

Impermanent Loss Summary

  • Definition: The difference between passively holding the tokens and providing liquidity to the pool
  • Cause: Arbitrage adjusting the pool prices

DODO and COFIX represent a new type of AMMs that does not rely on arbitrage adjusting the ratio of assets in the pool, but instead directly sources prices from oracles. To be consistent, let us observe what happens if we put the above example in the context of DODO / COFIX.

Example 2

Assuming XYT/USDC pair with initial balance 10XYT and 1000USDC (price 1XYT = 100USDC). In parallel, assume individual investor holding 10XYT and 1000USDC in his wallet.

What happens if the XYT market price jumps to 110USDC?

The pool would offer no arbitrage opportunity since the oracles would adjust the pricing, and simply LPs balance would not change only because there is external price change. The token holder would be indifferent between providing liquidity to the pool and holding tokens in his wallet (ignoring transaction fees).

As a result, new AMM models are not prone to Impermanent Loss. But, …

Losses characteristic for new AMM models — COFIX example

That doesn’t mean we are free from losses from providing liquidity to the new AMM models.

Example 3

To illustrate, assume another example where hypothetical XYT token is worth 100USDC. Since COFIX doesn’t rely on ratio of tokens in the pool to determine prices, let’s further assume token balance to be equal to 10XYT and 500USDC, and the pool to be valued at $1500.

If Alice deposits additional 5XYT, the pool value would jump to $2000 and she would receive the ownership of 25% of the pool. Since Alice is pool owner, she needs to assume the risks related to both tokens in the pool as well as the peculiarity of COFIX mechanism.

Again, assuming XYT token price increases to 110USDC, the pool value would become:

15XYT * 110USDC + 500USDC = $2150

Alice, owing 25% of the pool, would now control:

0.25 * $2150 = $537.5

Yet, if she had single token exposure, she would be able to exit the pool with $550. On the other hand, if the XYT token price plunges, she would have certain protection since she is exposed to the pool of a mixture between XYT and USDC rather than to XYT token only.

Example 4

Moreover, one peculiarity of the COFIX mechanism is that there is no bonding curve and larger trades don’t get penalized. Therefore, an extreme scenario could occur in case traders completely drained XYT supply before the price increase. Supposing again initial price XYT = 100 USDC, and a particular trader Bob that wants to get exposure to XYT token. Bob could purchase all of the XYT tokens for $1500, leaving the pool with 0XYT and 2000USDC. Afterwards, if XYT price jumps to 110USDC, Alice would have zero exposure to this upside.

COFIX Risk Summary

  • COFIX does resolves impermanent loss characteristic for Uniswap
  • However, the risk with liquidity provision on CoFix comes from being exposed to the pool rather than a single token
  • Similarly, the pools can be completely depleted from the upside of one of the tokens since COFIX doesn’t discriminate against large trades (i.e. doesn’t have bonding curve)

Losses characteristic for new AMM models — DODO example

DODO LPs do not need to worry about aforementioned risks, since DODO allows single token exposure instead of pool ownership.

However, it is important to note that the number of tokens at any point in time may be different from the number of tokens initially deposited to the pool, due to the volume and frequency of trading activities.

To re-balance the pool, DODO’s mechanism incentivizes traders to sell the undersupplied tokens to the pool by raising the price above market price.

As illustrated in the example of WBTC / USDC pool, the mechanism works fairly well at preserving the principal for liquidity providers on both sides of the pool and allowing WBTC or USDC LPs to passively earn market-making profits.

WBTC / USDC pool, LP ownership; Source: https://dodo-pool-tracker.vercel.app/

Yet, one look at YFI / USDC pool illustrates that not everything is perfect. In theory, if one side of the pool is below 1, the other side should be above 1. Still we observe that both sides of the YFI / USDC pool are significantly below 1, suggesting that liquidity providers in both pools have suffered losses.

YFI / USDC pool, LP ownership; Source: https://dodo-pool-tracker.vercel.app/

These losses are primarily caused by DODOs inability to timely re-balance the undersupplied side of the pool. For DODO’s mechanism to work as expected, swift reaction to the incentives offered by DODO (i.e. fast re-balancing) is crucial, especially for tokens with highly volatile price movements. It is so, because the longer the time of token unbalance the more chances for significant change in market price . The change in market price during these periods could damage LP value, as illustrated below.

Example 5

Again, assume that there are 10 XYT and 500 USDC in the pools, with 1 XYT valued at 100 USDC. If the current balance of XYT token drops to 9 XYT, DODO will aim to re-balance XYT supply to 10. It does so by increasing the price of XYT above the market price to encourage traders to sell XYT tokens back to the pool.

However, if XYT appreciated to $110 before re-balancing took place, bringing XYT to the initial supply of 10 would not be possible without extracting value from USDC LPs.

  • initial balance: 10 XYT & 500 USDC

  • balance after the first trade: 9 XYT & 600 USDC

    XYT price jumps to $110 before the pool gets re-balanced

At this point, DODO does not have enough resources to re-balance XYT side of the pool, therefore bringing the total amount of XYT to 10 is possible only by sacrificing USDC side of the pool

  • hypothetical trader bringing 1 XYT to the pool would result in a new balance of: 10 XYT & ~488 USDC; in this scenario, USDC LPs on the aggregate would lose ~12 USDC (simplified calculation)

What usually happens though is that re-balancing takes place before the price appreciation. That would bring both sides of the pool close to the initial balance of 10 XYT and 500 USDC. On the other hand, a XYT price drop prior to re-balancing would generate profit for LPs in the above scenario, since DODO would be able to recover XYT side of the pool while spending less than 100 USDC, resulting in a balance of 10 XYT and >500 USDC.

When a certain token is undersupplied in the pool, DODO’s position is essentially a short position in that token, since it incurs losses with price appreciation and makes gains with the price depreciation.

Example 6

In addition, XYT LPs could suffer losses in the following scenario:

  1. initial balance: 10 XYT & 500 USDC

  2. balance after the first trade: 11 XYT & 400 USDC

    As mentioned above, having an undersupplied USDC side of the pool is similar to having a short position in USDC. Consequently, a XYT price drop to 90 USDC would mean relatively stronger USDC and simultaneously loss for the pool. At XYT = $90, DODO doesn’t have enough resources to rebalance USDC side of the pool, therefore bringing total amount of USDC to 500 is possible only by sacrificing XYT side of the pool

  3. hypothetical trader bringing 100USDC to the pool would result in a new balance: ~9.86XYT and 500USDC and the loss for LPs would be ~0.14XYT (simplified calculation)

    Again, XYT price increase prior to rebalance would generate profit for LPs in the above-scenario, since it would suggest relative weakening of USDC.

As illustrated in examples above, having efficient rebalancing is crucial for protecting LP value and minimizing the risk, otherwise DODO is inherently having a short position in one side of the pool and based on market fluctuation may generate profit / loss. By contrast, when pool is in balance DODO is market neutral.

Going back to YFI / USDC pool, the reason behind losses is inability to maintain market neutral position and therefore too much exposure to the large volatility of YFI token.

Another potential reason for the losses in YFI / USDC pair is vulnerability to oracle front-running. Namely, since DODO relies on ChainLink price feed, a trader could observe that the oracle price for particular token will go up in the next block and withdraw significant amount of the token from the pool, only to sell it immediately after the update. This action would result in arbitrage profit for trader and loss for DODO LPs.

Example 7

  1. initial balance: 10XYT & 500USDC XYT price feed about to go up to $110 in the next block

  2. trader front-runs the oracle, taking 1XYT (for simplicity) from the pool

  3. new balance: 9XYT & 600USDC Price formally updated At this point, DODO doesn’t have enough resources to rebalance XYT side of the pool, therefore bringing total amount of XYT to 10 is possible only by sacrificing USDC side of the pool

  4. trader exits the position after the update locking ~$12 profit, new balance: 10XYT & ~488USDC USDC LP Would Lose ~12USDC

    Although, the final result in example 5 and example 7 are the same, the latter one is much more dangerous for LPs. The trader in example 5 would likely be classified as random trading flow, without ability to predict the market direction. Therefore, being counter-party to such trader is acceptable. By contrast, the trader in example 7 is informative trader (arbitrageur) who will certainly create loss for LPs. Having both sides of YFI / USDC pool significantly below 1, may suggest that the reason is informative rather than random trade.

    Despite, DODO does offer single token exposure, LPs have to be mindful of the characteristic of the other pool token. For example, in theory because of single token exposure, if you were USDC LP you would be indifferent whether the other token in the pool is WBTC or YFI. Yet in practice the difference is great. The more volatile the other token in the pool is the more risk exposure you get.

    DODO Risk Summary

  • DODO resolves impermanent loss characteristic for Uniswap and it is not vulnerable to the COFIX like losses since it offers single token exposure

  • Yet, whenever DODO is not rebalancing token supply efficiently, LPs have indirect exposure to the other side of the pool. In such situations DODO LPs may earn profits / suffer losses based on the market price movement

  • Finally, DODO LPs would certainly make losses anytime arbitrage successfully front-runs the price feed

    The above losses for COFIX and DODO LPs are impermanent in nature, since they could disappear or even don’t necessarily exists if price movement is beneficial to market makers. Still, we can’t classify them as Impermanent Loss according to definition discussed earlier, rather we can define them as a risk of market making specific to each of these protocols.

    Below we summarize risks characteristic to each of the platforms discussed above.

Risk hedging — a vital part for sustainable development of AMM protocols

Market making is not a risk-free activity and regardless of whether it is done with the order book model or the AMM model. In either case, LPs would always need to beware of potential losses in adverse scenarios. Without understanding the risks, LPs are unable to accurately define the required rate of return for deposited capital nor to properly hedge their positions.

In respect to hedging, the growth in decentralized options markets could provide the much needed tools to AMM liquidity providers for hedging their risks. For instance, it is conceivable to automatically offset position through particular token derivative or derivative of a highly correlated asset. In more detail, in Example 5, after the first trade (before the price jump), DODO LPs may automatically long a call option on XYT token to offset the exposure. Similarly, COFIX LPs may want to purchase a call option on XYT token in Example 4 to get the exposure to the upside of the token. On the other hand, hedging could be costly and therefore too frequent hedging may squeeze profit margins.

The factors to consider here will include risk appetite, the size of most recent trades, characteristics of counter-party & underlying assets. Clearly, in DODO scenario, the more depleted the token from the pool the larger the need to hedge against the token upside. Similarly, whether the trading flow is random or informative also affects the hedging need. At this point, AMMs are not able to classify the trading flow, but in the future incorporating machine learning to analyze historical order flow from particular addresses may enable AMMs to obtain this information. Finally, if the underlying asset is relatively stable there is less risk and need for offsetting directional position.

** Cofix is the first to offer hedging options to its LPs, more details available at https://github.com/Computable-Finance/CoFiX-hedger

Conclusion

Simplicity in the design and the concept for LPs to understand is a key advantage of Uniswap in attracting a significant amount of LPs and assets. On the other hand, newer AMM solutions attempt to improve capital efficiency and are thus inevitably more sophisticated.

However, in any of these AMM solutions, and we believe in any market making activities, there are potential losses that will be incurred. LPs will have to be mindful of them, analyze and hedge for their risks according to their own risk profiles.

In such a fast-paced space, sometimes innovation comes first. As liquidity mining incentives are completing their initial mission of bootstrapping the protocols and attracting the early adopters, the real game starts. We need more professional frameworks and tools for analytics and hedging for AMM protocols to drive more sustainable adoption.

(DISCLAIMER: DODO is one of IOSG Portfolio Companies.)

🦄 About IOSG

Founded in 2017, IOSG Ventures is research and community-driven with offices across China, US and Singapore. We focus on Open Finance, Web3.0 and cross-chain ecosystems, investing in teams with top potential worldwide. Our portfolio covers more than 60 projects, including Layer-1 blockchains (Near, Polkadot, Cosmos), middleware (Celer, Raiden, Reach) and applications including DeFi (MakerDAO, Synthetix, UMA). We have been actively involved in various developer & DAO communities. We believe in long-term partnership and we work closely with our portfolios to advise and support them along their journey of entrepreneurship.

If you would like IOSG Ventures to consider your project, please send a summary of your project along with a pitch deck and/or white paper to [email protected]

Follow us on Twitter.