Differences to Uniswap V3

The invention of the Automated Market Makers has been one of the most significant innovations in the history of DeFi. The debut of Uniswap V1 revolutionized the way trading was conducted, offering a decentralized, permissionless platform on a scale that wasn’t possible before.

Fast forward to today, where most decentralized exchanges in crypto are still using Uniswap’s code or variations of it. Now Liquidity Book is taking the next step and opening an entirely new page in the book of DeFi.

Merchant Moe, powered by the Liquidity Book (LB) algorithm, seeks to improve the experience for liquidity providers and traders while staying true to the spirit of DeFi. But what sets it apart as a groundbreaking innovation, and how can LB benefit all DeFi users?

Concentrated Liquidity

The constant product formula, utilized by both Uniswap V2 and Moe Classic, sets the pricing mechanism for assets within their pools, denoted by the equation x*y=k. It is clear that as the quantity of x rises, y must fall, and vice versa.

This model guarantees unlimited liquidity - the pool buys and sells tokens at all prices, including when they approach 0 and infinity. This is very convenient for traders, as they always have a place to sell and buy. It's a boon for traders, ensuring constant buy and sell opportunities. Yet, since many cryptocurrencies frequently trade within specific ranges, distributing liquidity across all conceivable prices is not capital efficient.

Concentrated liquidity massively improves liquidity depth at the most traded price points. Liquidity providers have the discretion to select price ranges they are willing to supply their tokens. Let’s say they anticipate that $$$ will trade between 15 and 20 dollars in the coming few months. They can opt-in to provide liquidity for $$$-USDC at this interval instead of at the whole range (i.e., between 0 and ∞).

Enhanced capital efficiency translates to increased fee earnings for liquidity providers who opt for narrower ranges. However, should the price move outside the bin, the bin becomes "inactive," halting fee accumulation. Providers then face a choice: rebalance their tokens to a new bin or wait for the price to return to its previous value.

Ticks vs Bins

Uniswap V3 implements Concentrated Liquidity by dividing all available price space with ticks. Users can choose any two of those ticks and provide liquidity in the range between them. The smart contract then aggregates all liquidity at the current price for trading.

Liquidity Book, on the other hand, separates the price range into discrete bins. Liquidity providers deposit into their selected price bins, and Merchant Moe's smart contract taps into the bin matching the current price.

While seemingly similar, there is one crucial distinction. Price can belong to multiple tick ranges but will always be in only one bin. Consider the following example:

For simplicity, you can think of bins as a collection of bundled constant sum pools. Instead of using the x*y=k formula, each bin uses the x+y=k instead. With it, the price isn’t dependent on the pool's composition and is constant throughout the whole bin. This maintains a stable price within each bin and only shifts when a bin's liquidity is exhausted.

Price Impact

Price impact is an inherent issue with constant product exchanges. In these AMMs, because the amount of assets in the pool changes during the swap, the quoted price differs from the actual one. That difference is referred to as price impact and is unavoidable, especially with large transactions.

Uniswap V3 and Liquidity Book tackle the problem of price impact a bit differently. They both mitigate this impact through the capital efficiency of concentrated liquidity. This essentially allows pools to perform as if they had more liquidity than they actually do. More liquidity means less price volatility on each swap. Although, unique to Liquidity Book’s design, the price impact when trading inside one bin is completely eliminated.

Thanks to the Constant Sum formula in the Liquidity Book, price impact only occurs if the price moves from one bin to another during the trade. This means that if the swap utilizes liquidity in only one bin, it is performed with zero price impact.

Flexibility

Liquidity Book also surpasses Uniswap V3 in fungibility. Uniswap's tick-based design necessitates ERC-721 NFTs to represent liquidity positions, severely complicating integration with protocols designed for ERC-20 tokens.

NFTs also make managing liquidity positions difficult, time-consuming and expensive. For example, changing ranges involves multiple complex transactions. Users must withdraw their tokens, define new ticks and re-deposit with gas paid at each step.

In contrast, Liquidity Book wraps positions into the much more versatile custom contract similar to the ERC-1155 standard. Therefore, LB positions behave like regular fungible ERC-20 tokens, making a wide range of custom strategies readily available.

Users can manage and deploy those strategies themselves or rely on third-party solutions that build on top of the Liquidity Book. The strategies can include:

  • limit orders - providing liquidity below or above the current price;

  • custom bonding curves - depositing in multiple bins to mimic a specific distribution;

  • active liquidity provision - moving liquidity to the current price bin to capture maximum fees;

All these things are available with Uniswap V3 but require more resources due to the non-fungible nature of liquidity.

Impermanent Loss

Impermanent loss (IL) occurs when the price of the pooled assets changes compared to the one they were deposited at. It is referred to as “impermanent”, as if prices return to previous values, the loss will be negated. However, the loss often becomes permanent for many liquidity providers as cryptocurrency markets are extremely volatile, with prices swinging in both directions.

While Uniswap V2 and others attempt to offset IL with fixed swap fees and liquidity mining incentives, Liquidity Book introduces a variable fee model. This model adjusts fees in tandem with asset volatility. Tracked by a volatility accumulator that responds to rapid price shifts, fees are increased during volatility, aiding providers in recouping potential losses.

When the frequency of transactions drops, the accumulator will gradually reduce by a prespecified reduction factor until it reaches a new equilibrium. In cases when transactions occur especially rare, the accumulator will reset to a number of bin changes in the current swap. Each bin has its own separate volatility fee, which is capped at a certain amount to prevent it from growing out of proportion.

Summary

Liquidity Book allows Merchant Moe to offer better capital efficiency for liquidity providers than legacy exchanges like Uniswap V2. Simultaneously, it massively reduces the price impact for most traders. It can even offer swaps with zero price impact for assets like stablecoins that are expected to trade inside one bin most of the time.

While it shares the concentrated liquidity concept with Uniswap V3, it offers several significant improvements over it. Namely, it makes managing positions easier thanks to the fungible design of liquidity tokens. It also makes those tokens more composable, positioning them to become a core piece of Mantle Network’s DeFi infrastructure.

Liquidity Book grants users unprecedented control over their assets, optimizing liquidity provision to align with individual goals. The volatility accumulator and adaptable fees offer a sustainable solution to alleviate Impermanent Loss.

DeFi has evolved significantly since the first AMMs, and with Merchant Moe's Liquidity Book, the future of liquidity provision on Mantle Network is more efficient, adaptable, and trader-friendly than ever.

Last updated