frogs-logo

A product of the New Order DAO

HomeFrogs ProNewsletterSubmissions
Back
1rZGvZDhV0bhBcO48s35iX

Trader Joe V2: The Liquidity Book

In a previous article, we introduced the Crocswap AMM as a potential challenger to the dominance of Uniswap. Today we have another challenger entering the battlefield in Trader Joe's new Liquidity Book AMM.

As the alternative layer 1 movement picked up steam, Avalanche stood out as one of the big winners. Facilitating a total of 194.27M transactions to date with a total of 3.08M accounts created, it’s fair to say that Avalanche fared well in the battle of the L1s.

As we learned very quickly, no L1 ecosystem is complete without its own native DEX. They are in fact a cornerstone of any L1 ecosystem because the industry is still majorly populated by traders and investors. Seeing this gap on Avalanche, @0xmurloc & @cryptofishx decided to co-found Trader Joe, which has now gone on to become the most popular dApp on the Avalanche blockchain.

Trader Joe launched on the 4th of July 2021, and as the charts below show, “AVAX Season” pretty much kicked off right after the launch. Of course, this is also correlated with the rest of the market turning around at that point in time, but it's fair to say that Trader Joe played a major role in the growth of Avalanche activity.

Monthly Active Users on Avalanche

Monthly Active Users on Avalanche

Monthly Transactions on Avalanche

Monthly Transactions on Avalanche

A Quick History Lesson

Trader Joe started off as a fork of Uniswap V2. The success was undeniable seeing that they have facilitated a total volume of over $88B while generating over $265M in fees for their LPs and token holders.

However, the Uni v2 model is part of a class of AMMs that can be categorized as first generation AMMs. As a DEX grows bigger, they need to become more optimised. The Uni v2 model was convenient for passive LPs and traders. However, convenience can only take a DEX so far. As a DEX scales, problems such as impermanent loss, capital inefficiency, and trade execution start to become more apparent.

Teams across DeFi started working on potential solutions for a more optimised AMM. This led to a whole wave of innovation in the AMM space pioneered by Uni v3 and their pivot to concentrated liquidity. After that came Curve v2 with their general AMM allowing users to have the same Curve experience but with non-pegged assets. Crocswap came with their own single contract AMM, and Primitive Finance came up with the concept of RMMs.

The story doesn’t end there, though. Now another competitor is joining in on the battle to become the best AMM. Rather than simply forking Uni V3, the team at Trader Joe has decided to build their very own AMM in-house.

Introducing: The Liquidity Book

When designing a perfect AMM, one needs to consider the demands of 3 different parties:

  • Traders
  • Liquidity Providers (LPs)
  • Protocol Owners

Traders want zero slippage trades and access to a lot of tokens. LPs want good yield with impermanent loss protection with the option to single sided stake, and they also want the ability to passively manage their LP positions while being assured that their capital is secure on the protocol. Protocol Owners typically want access to a lot of tokens, permissionless creation of liquidity pools, assurance of security, and little to no dependence on token emissions.

Of course, it is impossible to cater to all stakeholders. Some trade-offs need to be made. Therefore, the team at Trader Joe boiled down the priorities for a perfect AMM to focus on zero slippage trades, security, passive liquidity management, and access to a lot of tokens.

The liquidity book is the AMM that checks all of these boxes by retaining the accessibility while fixing some of the inefficiencies of the x*y=k AMM.

Under The Hood

The marquee feature of the liquidity book is their upgraded version of concentrated liquidity called Liquidity Bins.

Liquidity is divided into separate bins with each bin acting as its own constant sum pool using x+y=k rather than x * y=k. Each bin has its own price range and users can deploy liquidity as they please into any of the bins. However, only one liquidity bin is used at any given time. The smart contract will only use liquidity from the bin that corresponds to current price until all the liquidity from that bin has been depleted and then price moves to the next bin.

Let’s look at an example to better understand this. Suppose the two assets in a trading pair are JOE and USDC. Liquidity can be provided across a variety of bins (i.e. price ranges). If the market price of AVAX is $20 and the bin step is 0.2%, then only liquidity from the $19.99 or $20.03 bin will be used until it’s depleted.

The graph below is a representation of how liquidity bins work.

Trader Joe's Liquidity Bins

Trader Joe's Liquidity Bins

This design allows for zero-slippage trades. The constant sum formula used in each bin means that if a swap uses liquidity only from one bin then there is no price impact, but if there is a large swap causing a change from one bin to another, then there will be some price impact. The other obvious benefit is that it brings a high level of customizability for LP position construction.

Another key difference for the liquidity book is that the LP token receipt is fungible. So rebalancing positions across multiple bins is a lot easier and cheaper. Oftentimes it can also be done within one transaction. This is extremely beneficial for vault strategies that will be constantly monitoring and frequently re-adjusting positions. How this Bin architecture looks under the hood can be seen with this comparison graphic:

Liquidity Book's Liquidity, as Compared to Uniswap v3

Liquidity Book's Liquidity, as Compared to Uniswap v3

Although discretized bin liquidity is the standout feature of the liquidity book, it is not the only novel innovation. The Volatility accumulator is a mechanism built to measure market volatility. It essentially measures the amount of bin changes that happen when a swap has been executed. The more bin changes a swap has mademeans the volatility is higher, and higher volatility means the accumulator ramps up. If there are fewer or no bin changes then the accumulator decays back down to zero.

The purpose of collecting this volatility data is to activate a Surge Pricing feature, which is essentially a variable fee that is applied to swaps, in addition to the base fee. Protocols like Uniswap have a standard fee for each pool. But as we know, the majority of the LP positions on Uniswap end up losing money due to impermanent loss because the fees generated do not compensate for the impermanent loss.

With the liquidity book, as the volatility accumulator for a pool spikes up, the variable fee mechanism automatically increases the fees for LPs in that pool and when volatility is low, the fees decrease. The main purpose of this is to protect LPs against impermanent loss. Since most LPs lose money on concentrated liquidity due to either poor management or a poor understanding of impermanent loss, it may dissuade prospective LPs from providing liquidity. With variable fees ensuring minimal impact from impermanent loss, Trader Joe should see an increase in overall liquidity across the protocol.

It's also worth noting that the volatility accumulator doesn’t rely on any external data/feeds. Data is taken directly from the pools so the accumulator updates in real time.

Key Improvements

Implementing concentrated liquidity through liquidity bins rather than tick ranges allows for more capital efficiency and lower price impact on trades. When this is combined with fungible LP tokens which makes readjusting positions easier, the overall liquidity will be much higher which further reduces slippage and price impact.

The volatility accumulator is a novel way to protect against impermanent loss. Rather than paying from the treasury or paying a base fee, a variable fee has a greater likelihood of minimizing impermanent loss for LPs which would likely attract many more LPs to the protocol.

Concluding Thoughts

What started off as a Uniswap fork has now blossomed into a next generation AMM that could be a serious potential challenger to the dominance of Uniswap. AMMs make up a significant portion of the DeFi market share as a sector. Hence, innovation naturally followed. Now it comes down to marginal improvements in key areas that end up making a big difference in terms of the amount of users and liquidity that can be attracted. The liquidity book is doing exactly that. The improvements made will not only benefit Trader Joe but the Avalanche ecosystem as a whole.

While it is impossible to predict who the winner will be in the battle of the AMMs, what can be said for sure is that us, the users, will always benefit by getting a consistently superior on-chain trading experience.

Published on Sep 23 2022

Written By:

Leftside Emiri

Leftside Emiri

@LeftsideEmiri
newo-logo

Copyright © 2024 NEW ORDER. All Rights Reserved

Privacy PolicyToken Terms and Conditions