Interpretation of Trader Joe's Liquidity Book protocol: AMM solution to discretize LP liquidity
Decentralized exchanges, or DEXs, are a fundamental building block of DeFi and are facilitating cryptocurrency transactions that eliminate middlemen. DEXs are the primary medium for price discovery in new cryptocurrencies because traders are exchanging established currencies for nascent project tokens. At the same time, DEXs also offer local exchange rates between two or more cryptocurrencies.
Generally speaking, the largest projects deployed on blockchain networks tend to be automated market maker (AMM) DEXs. AMM-style DEXs serve as an alternative to order book DEXs, where buyers and sellers are matched one-to-one.
In an AMM, financial participants called Liquidity Providers (LPs) provide cryptocurrency to asset pairs or funding pools and are rewarded for fees generated in pool transactions. With LPs providing the assets in the pool, buyers and sellers can exchange cryptocurrencies.
Naturally, this reliance on LPs requires strong incentives to encourage them to participate by maximizing returns and reducing risk.
This article will introduce the current industry standard AMM protocol, Uniswap V3, and examine a new type of AMM offered by Trader Joe, Liquidity Book. Liquidity Book provides new utility and mitigates some of the impermanence losses present in the current standard.
Over the past year, Uniswap V3 on Ethereum has traded between $35-70 billion per month, with a total value of $11.94 billion currently locked in Uniswap V3 smart contracts, the largest in the cryptocurrency industry One of the sources of liquidity.
Compared to Uniswap V2, the main innovation of Uniswap V3 is centralized liquidity.
Centralized liquidity enables LPs to distribute their liquidity within a specified set of price ranges, rather than equally across the entire price curve of the pool.
LPs or funding pool providers can provide liquidity to price ranges where they believe transaction fees are the highest, while providing liquidity depth to price ranges that are most useful to traders.
This makes Uniswap V3 4000 times more capital efficient than Uniswap V2.
Market participants want maximum capital efficiency for low fees, reliable pricing and the best trading experience. DEX traders face illiquid markets with high slippage and high transaction fees due to capital inefficiency, while LPs face a higher risk of impermanent loss.
Although an improvement over V2, the main disadvantage of Uniswap V3 is the increased impermanent loss of pool providers.
According to research conducted by Topaze.blue, about 50% of depositors in Uniswap V3 will experience negative returns due to impermanent losses.
In Uniswap V3, these asset pairs are no longer available for swap once the price exits the range set by the pool provider. This means that LPs no longer earn transaction fees, but are still subject to the risk of impermanent losses. Furthermore, in order for LPs to resume earning transaction fees, they must regroup their assets in a different scope, forcing additional gas fees.
When gas is high, many retail providers cannot actively manage their positions. This leads to a centralization of liquidity provision, as only a large volume of LPs can continually absorb costs to recapitalize and remain profitable. Since LPs are also in the running to make money, unstable and illiquid markets can result when large players choose to move between markets in search of higher returns.
Liquidity Book is a new AMM designed by the team at Trader Joe's, the largest DEX on Avalanche. The Liquidity Book protocol uses a form of centralized liquidity they call "discrete liquidity", which arranges the liquidity of asset pairs in different "discrete bins", each with a specific price , while the user can provide liquidity to multiple tanks at the same time, the following is an example of the liquidity structure provided by different LPs:
The market price will only be in a price box range, and the market price is determined by the lowest price that contains the two asset reserves. In Liquidity Book, any bin above the active price bin contains only one asset, and any bin below the active price bin contains only another asset.
If LPs anticipate that market prices may move towards a certain price box, they can provide liquidity for a single asset to that box. The higher the LP liquidity in the active box, the more fees they earn, so choosing the right price range and liquidity composition is important to maximizing their return on investment.
Each price bin has its own constant sum market, with its own bonding curve. This means that as the composition of an asset changes within a bin, the price remains the same until there is only one asset left. This way, as long as there is sufficient liquidity in the active box, no matter the size, executing trades will have no impact on the price. When a crate runs out of assets, the crates above or below it become active. Then, exchange additional token reserve assets for the price of the new box. The market for trading pairs is composed of the aggregation of all bins.
Using the box structure, LPs can distribute liquidity vertically in the market, rather than horizontally like Uniswap V3. This is most intuitively reflected in the figure below.
Distributing liquidity vertically gives LPs more flexibility. If an LP wants to change their position, they can allocate more or less liquidity to the new box without changing the existing position. But in the case of an adjusted allocation in horizontal mode, the LP must regroup within the price range of its position.
Positions in Liquidity Book are represented by LBTokens, which are compatible with the ERC-20 standard. Because LBTokens are functionally valid and fungible, they become the cornerstone of complex strategies. Not only can protocols and users develop custom liquidity structures that match their risk profile, but they can also be easily managed according to market conditions.
Resolve impermanent loss
The main improvement to LPs in the Liquidity Book model comes from the fee structure, which helps combat the impermanent losses caused by volatility. Liquidity Book uses price bin ranges, or jumping from bin to bin, to measure instantaneous price fluctuations.
The total swap fee charged by LP has two parts, one is the base fee and the other is the variable fee. The base fee represents the lowest fee rate for all swaps, and its maximum value is equal to the price box range. Variable fees vary with market conditions and depend on the volatility accumulator.
Volatility accumulation records instantaneous volatility based on trading frequency and impact. Since the change in each bin represents a fixed rise or fall in price, the accumulator can simply count how many price bins the swap spanned to calculate its impact on the pool in real-time without relying on external oracles.
Volatility builds up when multiple large swaps occur in a short period of time, signaling market volatility. Accumulation decays if activity slows down to a certain point, and resets if there is no swap after a period of time. Variable fees follow up to a cap.
Variable fees make providing liquidity in volatile markets more attractive to LPs, helping to maintain liquidity depth when it is most needed. Additionally, LPs have the potential to exceed expected returns due to volatility accumulation and variable fees. The chart below is fee-adjusted impermanent loss/gain, depicting potential changes in the value of liquidity pools in different volatility environments.
This figure shows that under most market conditions, when the liquidity pool is large enough, LPs will profit even after accounting for impermanent losses. During periods of extreme volatility, LPs still face impermanent losses, which can be a bigger factor in smaller markets.
Capital Efficiency and Market Depth Comparison
By comparing the swap price impact from Trader Joe V1 to Trader Joe V2, we can find the maximum capital efficiency limit for each market for a given price bin as follows:
Between these two models, we see improvements to Uniswap V3's capital efficiency.
The relative difference in market depth between the Liquidity Book model and Uniswap v3 for different Uniswap v3 price ranges can be plotted if liquidity is assumed to be evenly distributed across bins.
The graph shows that under this assumption, the choice of price range in Uniswap V3 has a greater impact on market depth than the price box structure. It also shows that in Uniswap v3, the difference in relative market depth remains within 1% when the price range coverage is below 60%, and becomes larger as the price range increases.
Liquidity Book protocol, a partial solution to one of the biggest risks facing LPs in AMM DEX.
While impermanent losses can never be fully offset due to inherent volatility risks, Liquidity Book DEX may be a way to minimize impermanent losses under normal market conditions. Money flows where the rewards are greatest and the risks are lowest, and Liquidity Book offers greater potential rewards and less risk than current industry standards.
However, there may be barriers to getting industry-wide adoption, and Liquidity Book may not be a viable option for retail LPs on the blockchain because of gas.
As it stands, the first implementation of Liquidity Book is currently undergoing a smart contract audit, which the Trader Joe team will be doing more research on soon.
Open-pit mining is a project to extract useful minerals in the crust from the surface down in an open environment with the help of mining, excavation and transportation equipment.