Decentralized exchanges, or DEXs, are a fundamental building block of DeFi that facilitate the trade of cryptocurrencies without a middleman. DEXs serve as the primary medium for new cryptocurrencies to achieve price discovery, as traders swap established currencies for fledgling projects. DEXs also provide a local exchange rate between two or more cryptocurrencies.
The Tie Research
Trader Joe’s New AMM: Liquidity Book
Introduction
In general, the largest projects deployed on blockchain networks tend to be automated market maker (AMM) DEXs. The AMM-style DEX serves as an alternative to an order book DEX, where buyers and sellers are matched one-to-one. In an AMM, financial actors called liquidity providers (LPs) provide cryptocurrencies to an exchangeable asset pair, or pool, in return for a pro-rata distribution of fees accrued from trading in the pool. Buyers and sellers then are able to swap cryptocurrencies using the pooled assets provided by the LP.
Naturally, this reliance on LPs necessitates strong incentive mechanisms to encourage their participation by maximizing returns and reducing risk. However, according to research conducted by topaze.blue, ~50% of depositors using the current industry standard, Uniswap v3, suffer negative returns from impermanent loss. This article will introduce Uniswap v3 and examine a new AMM from Trader Joe called the Liquidity Book, which provides new utility and mitigates some risk of impermanent loss that exists with current standards.
If you are unfamiliar with impermanent loss, read this primer.
Uniswap V3
In the last year, Uniswap v3 on Ethereum has seen monthly volumes in the range of $35-70bn, with $11.94bn of total value currently locked in Uniswap v3 smart contracts. It is one of the largest sources of liquidity in the cryptocurrency industry.
Uniswap v3’s primary innovation, compared to its Uniswap v2 counterpart, is concentrated liquidity. Concentrated liquidity enables LPs to allocate their liquidity in a set of specified price ranges rather than evenly across the entire price curve of a pool. LPs, or pool providers, can provide liquidity to the price ranges where they believe the trading fees are the highest, while at the same time providing liquidity depth to the price ranges that are most useful for traders. This allows for up to 4000x greater capital efficiency in Uniswap v3 compared to Uniswap v2.
Capital efficiency is a term used to describe the amount of capital required to achieve the same amount of liquidity depth between protocol versions. For example, if providing $20 to a price band spanning 10% of the curve in Uniswap v3 achieves the same amount of liquidity depth as $200 in Uniswap v2, the liquidity in the price band is 10x more capitally efficient in Uniswap v3 than in Uniswap v2.
Market participants want maximal capital efficiency for low fees, reliable pricing, and the best trading experience. With low capital efficiency, DEX traders face illiquid markets, high slippage, and high trading fees, while LPs risk higher rates of impermanent loss.
Despite capital efficiency improvements over v2, Uniswap v3 also introduced some drawbacks. In Uniswap v3, once price exits the range set by a pool provider, those asset pairs are no longer used for swaps. This means the LP no longer earns trading fees, and is still subject to the risks of impermanent loss. Furthermore, for LPs to resume earning trading fees, they must re-pool their assets in a different range, incurring additional gas fees.
When gas prices are high, many retail pool providers cannot afford to actively manage their positions. This leads to the centralization of liquidity provision, as only large LPs can continually absorb the cost to re-pool and remain profitable. With the mercenary nature of LPs, this could lead to unstable and illiquid markets when large actors choose to move between markets in search of higher yield. If you’d like to learn more about Uniswap v3, here is an article with in-depth examples.
Liquidity Book
Structure
The Liquidity Book is a new kind of AMM designed by the team behind Trader Joe, the largest DEX on Avalanche. The Liquidity Book protocol uses a form of concentrated liquidity they call “Discretized Liquidity.” Discretized liquidity arranges liquidity of an asset pair into discrete bins. Each bin has a specific price assigned to it, and users are able to provide liquidity to multiple bins at once. An example liquidity structure supplied by different LPs is visualized below:
Only one bin establishes the market price, which is determined by the lowest price bin that contains reserves of both assets. In the Liquidity Book, any bin above the active bin will contain only one asset, while any bin below the active bin will contain only the other asset.
LPs are able to provide single-asset liquidity to a bin if they anticipate the market price might move toward that bin. The higher proportion of an LP’s liquidity comprises the active bin, the more fees they earn, making choosing the right bin and liquidity composition important for maximizing their return on investment.
Each bin is its own constant sum market with its own bonding curve. This means that as asset composition changes within a bin, the price remains constant until there is only one asset left. In this way, executing trades has no price impact regardless of size, provided there is enough liquidity in the active bin. When an asset is exhausted in a bin, the bin above or below it becomes active. Additional token reserve assets are then exchanged at the price of the new bin. The market for the trading pair is made up of the aggregation of all of the bins.
Using the bin structure, LPs can allocate liquidity vertically across markets rather than horizontally as is the case with Uniswap v3. This is best visualized in the chart below.
Allocating liquidity vertically gives LPs more flexibility. If an LP wants to change their position, they can allocate more or less liquidity to new bins without altering their existing position. To adjust allocation in the horizontal paradigm, an LP must re-pool across their position price range.
Positions in the Liquidity Book are represented by LBTokens, which are compatible with the ERC-20 standard. Because LBTokens are effectively and functionally fungible, they become building blocks for complex strategies. Not only can protocols and users develop custom liquidity structures that match their risk profiles, but they can also easily manage their liquidity in response to market conditions.
Addressing Impermanent Loss
The primary improvement for LPs in the Liquidity Book model comes from the fee structure that helps combat impermanent loss caused by volatility. The Liquidity Book uses bin steps, or jumps from one bin to another, in order to measure instantaneous price volatility.
Total swap fees collected by LPs have two components, a base fee and a variable fee. The base fee represents the minimum fee rate for all swaps and has a maximum value equal to the bin step. The variable fee changes in response to market conditions and depends on the volatility accumulator.
The accumulator records instantaneous volatility based on the transaction frequency and impact. As each bin change represents a fixed increase or decrease in price, the accumulator can simply count how many bins the swap has crossed to calculate its impact on the pool in real time without relying on outside oracles.
When multiple large swaps occur in a short time frame, indicating market volatility, the volatility accumulator grows. If activity slows down beyond a certain point, the accumulator decays, and if there are no swaps after some time has passed, the accumulator resets. The variable fee follows the accumulator up to a ceiling value.
The variable fees make providing liquidity in volatile markets more appealing to LPs helping to maintain liquidity depth when it's the most needed. Furthermore, due to the volatility accumulator and the variable fees, LPs have the potential to outperform expected payoffs. Below is the fee-adjusted impermanent loss/gain that describes the potential change in liquidity pool value in different volatility environments.
This figure shows that in most market conditions when liquidity pools are sufficiently large, LPs will be profitable even after impermanent loss is factored in. LPs still face impermanent loss during extreme volatility, which is a greater factor in smaller markets.
Capital Efficiency and Market Depth Comparison
By comparing price impact of a swap from Trader Joe v1 to Trader Joe v2, we can find the maximum capital efficiency limits for each market with a given bin step as shown below:
Between both models, we see improvements in capital efficiency comparable to those of the Uniswap v3.
If you assume equally distributed liquidity across bins, you can plot the relative difference in market depth between the Liquidity Book model and Uniswap v3 across different Uniswap v3 price ranges.
This figure shows that the choice of price range in Uniswap v3 is a greater factor than the bin structure for market depth under this assumption. It also shows that the difference in the relative market depth remains within 1% for price ranges covering less than 60% in Uniswap v3 and becomes more substantial as the price range increases.
Closing Thoughts
The Liquidity Book protocol is a partial solution to one of the largest risks facing LPs in AMM DEXs. While impermanent loss can never be fully mitigated due to intrinsic volatility risks, the Liquidity Book DEX may be a step towards minimizing impermanent loss risks in normal market conditions. Money flows to where the payoffs are greatest and the risks are lowest, and the Liquidity Book offers potentially greater payoffs and lower risks than the current industry standard.
There are obstacles for industry-wide adoption, however, as the Liquidity Book model may not be a viable option for retail LPs on blockchains with high gas fees. For now, the first implementation of the Liquidity Book is currently undergoing smart contract audits, and more research from the Trader Joe team will soon follow.
This report is for informational purposes only and is not investment or trading advice. The views and opinions expressed in this report are exclusively those of the author, and do not necessarily reflect the views or positions of The TIE Inc. The Author may be holding the cryptocurrencies or using the strategies mentioned in this report. You are fully responsible for any decisions you make; the TIE Inc. is not liable for any loss or damage caused by reliance on information provided. For investment advice, please consult a registered investment advisor.
Sign up to receive an email when we release a new post