• The Castle Chronicle
  • Posts
  • The Evolution of Liquidity Provision: A Deep Dive into DeFi's Architectural Plumbing

The Evolution of Liquidity Provision: A Deep Dive into DeFi's Architectural Plumbing

Castle Capital Research Report

Executive Summary 

The decentralized finance (DeFi) ecosystem has witnessed a rapid evolution in its liquidity provision models, transitioning from Automated Market Makers (AMMs) to more advanced systems. This report delves into the intricacies of these models, their advantages, and their potential future trajectories.

Where It All Began

  • Automated Market Makers (AMMs): Pioneered by platforms like Uniswap, Curve, and Balancer, AMMs replaced traditional order books with liquidity pools. The main benefit is permissionless trading from a user perspective - meaning anyone could trade assets on an algorithmic price curve defined by a constant product formula (x * y = k). Other benefits included permissionless listing. Despite these benefits, in constant product market makers (CPMMs) come with tradeoffs. For instance, LPs suffer from issues like impermanent loss as LP assets are continually rebalanced to maintain a 50/50 ratio.

The Status Quo

  • Concentrated Liquidity: Uniswap V3 introduced the concept of concentrated liquidity and multiple fee tiers, which is an extension of infinite-rage CPMMs. Specifically, infinite-range CPMMs spread liquidity across an infinite price curve whereas concentrated liquidity CPMMs only spread liquidity across a defined range. It offers LPs more control over their positions and optimizes capital efficiency, but it also brings complexities like increased risk of impermanent loss and the need for active management.

  • Automated Liquidity Management (ALM): Building on the foundation of concentrated liquidity AMMs, ALM is designed to optimize the benefits of concentrated liquidity while minimizing the risk of impermanent loss. ALMs accomplish this by actively and dynamically rebalancing/adjusting LP ranges as price moves. DEXs using ALM offer LPs enhanced control and capital efficiency while minimizing IL risks.

The Future

  • Hooks and Dynamic Fees: Uniswap V4, likely inspired by protocols like Ambient, promises enhancements such as Singleton contracts for efficient routing, dynamic fees, and hooks. Hooks are external contracts triggered during the swap process with the purpose of adding customized functionalities such as dynamic fee structures to counteract the Miner Extractable Value (MEV).

  • The combination of On- and Off-chain Liquidity Solutions: The liquidity landscape is evolving to integrate off-chain professional market makers (MMs) with on-chain LPs via the Request for Quote (RFQ) system. RFQs offer traders optimal pricing through a Dutch auction system, ensuring minimal slippage, MEV resistance, and often gasless trades

  • Another approach to this solution is on-chain order books like Vertex.

1. Moving Towards Decentralization

DeFi has grown tremendously from its humble beginnings, pushing from a few hundred monthly active users (MAUs) and ~$100-600k USD in TVL in 2018-2019 to ~2.8m MAUs and ~$46b USD in TVL as of November 2023. Importantly, the volume/TVL ratio has grown from 0.17% in 2019 to ~8% in November 2023 - highlighting DeFi’s increasing use cases for capital over time.

AMMs were the first real application that enabled on-chain activity en masse: trading ERC20 tokens using ETH as the base asset, enabling global access to permissionless and censorship-resistant liquidity provision and asset exchange.

Anyone with an ERC20 token and some ETH could add liquidity to an AMM and become a de facto MM, or LP, to facilitate asset exchange. These users could collect trading fees, and bypass listing fees, all while keeping sole custody of their own assets. 

On the trader side, anyone with ETH could go and trade their favorite long-tail assets on a front-end like Uniswap in a permissionless and non-custodial manner. This was the first time in human history where global trade of digital assets was purely programmatic, permissionless, and censorship-resistant.

Let's take a quick look at the enormous growth DEXs have had since their inception. Beginning in 2019, DEXs were netting ~$53m in average monthly volume. Fast forward to 2023 when DEXs have netted ~$76b in average monthly volume - an increase of ~1,434x in four years! 

This comes as solvency concerns have arisen with centralized exchanges (CEXs) and custodians like FTX, Celsius, and Genesis. The primary issues stem from the centralized (human) management of liquidity, reserves, and user funds. Thus, it begs the question: should all crypto trading be done via DEXs as they are programmatic, non-custodial, and decentralized?

Source: The Block

Indeed, the data in the chart above shows that DEXs are gaining steam against their CEX counterparts: with the ratio of DEX:CEX spot trade volume rising to ~14.2%. However, DEXs still house several inefficiencies relative to CEXs such as reduced capital efficiency and liquidity depth. 

The purpose of this article is to shed light on the inherent limitations of AMMs and how on-chain DEXs, and their liquidity management architectures, are evolving to fix them. Specifically, the article provides a complete overview of the current DEX liquidity management architecture, the biggest innovators, and unique approaches to bringing a CEX-like experience on-chain.

2. Where It All Began

2.1 The Constant Product Market Maker

Uniswap V1 (Uni V1), and their constant product market maker (CPMM), was the arguable 0-1 innovation that sparked decentralized trading in DeFi. CPMM is a pricing model wherein the price of a given asset is a function of the reserves in the liquidity pair. 

Specifically, if we have a pair of x and y tokens, we define the total reserves as k. The term “product” in CPMM means that the constant, k, is always equal to the product, or multiplication, of x and y reserves in the liquidity pool. 

Put more simply, this reserve formula is x*y=k (see image below).

As k is always constant and in dollar-denominated terms, the relative price in x and y must shift to maintain it. For instance, let’s say you hold ETH (x) and want to buy UNI (y) from the ETH/UNI LP. When you enter your order, the CPMM recognizes that you will be adding to the reserves of ETH (x) and reducing the reserves of UNI (y) in the LP, because you’re giving ETH to obtain UNI. 

So, in order for kinitial = kfinal, the dollar value of y has to increase (i.e. the price of UNI increases to maintain k). The inverse is true if you are selling y to obtain x: the price of x must increase, to maintain the constant product, k. Importantly, arbitrageurs maintain the prices of x and y across DEXs/CEXs using price oracles as a reference.

In making price a constant function of LP reserves, it allows market making to be totally automated and programmatic, without any need for traditional bid/ask order books or a third party. In addition, it never allows asset prices to go to zero (i.e. run out of reserves) because k can never be equal to zero. This ultimately creates the reserve curve shown previously, wherein the supply x or y can never cross the axes. These types of positions are aptly termed “infinite range” LPs as they exist on an infinite curve and collect trading fees along the way.

Despite its usefulness, Uni V1 and CPMMs have several limitations. First, liquidity providers had to initially deposit exactly 50% of token x and 50% of token y in dollar value terms. Maintaining this equal weight (to keep k constant) along the curve can result in impermanent loss (IL). 

IL refers to the LP losing value in their position versus simply holding an equal-weight portfolio of tokens x and y outside of the DEX. If the value of one asset in the LP appreciates significantly, simply holding that token will almost always outperform providing liquidity despite the LP collecting trading fees along the infinite range. 

The image below provides a good visual representation of IL, where there is only a small window of price action that allows the LP to be profitable.

Another problem with Uni V1 was that all token pairs were denominated in ETH as the base asset. So, trading ERC20 to ERC20 required routing between separate LP contracts (as the assets were siloed to their unique pairs) and was very gas-intensive. 

Additionally, as the price of assets was governed by the constant product formula (x*y=k), Uni V1 could act as a price oracle for all traded assets. However, since the pricing data wasn't stored over time (i.e. the price reported by the oracle was not an average but a snapshot at that exact point in time), it could be manipulated, making it flawed for composability across DeFi. 

In March of 2020, Uniswap introduced the second iteration of their platform and fixed some of these problems. Specifically, Uniswap V2 (Uni V2) enabled base assets to be any ERC20 (i.e. wETH) and LP reserves are held under the same contract - so routing multi-hop trades were orders of magnitude more efficient and less gas intensive than before. Moreover, to bolster its pricing oracle, V2 recorded and stored the price before the first trade of each block. This allowed the oracle to output the time-weighted average price (TWAP) versus a snapshot of the price at any given point in time. Thus the pricing feed was much harder for attackers to manipulate.

Despite these innovations, the problem of IL remained. Moreover, another major problem became increasingly apparent: having an infinite range LP dramatically reduced the capital efficiency of your liquidity. As liquidity is spread across an infinite range, most of it remains idle, diluting potential fees. 

Instead, LPs could capture more fees if their liquidity was concentrated around the average trading price. If IL can be mitigated to some extent by LP fee capture, it stands to reason you’d want to offer LPs the ability to dynamically adjust the price range they are providing liquidity on. This led to the development of Uni V3, which enabled users to concentrate their liquidity around specified price ranges.

Before we delve into Uni V3 and concentrated liquidity, it is important to consider two more liquidity primitives that attempted to tackle IL and the “fee capture” problem in different ways. Both of which appear to be inspirations for components of the Uni V2 and V3 design.

2.2 Curve’s Stable AMM - SAMM

Curve has become the dominant DEX for stable and correlated asset swaps across DeFi, with projected 2023 annual volume sitting at ~$81b and daily volume to TVL currently at ~6.5% (for October 2023). All this despite events such as the UST depegging, the FTX collapse, and the recent Vyper exploit. So, how did it become the powerhouse that it is today? It dramatically improved upon the capital efficiency of the traditional CPMM model employed by Uni V1-2.

The strength of Curve’s design lies in its ability to move away from the infinite range liquidity model by “linearizing” the price curve around the expected trading price. The protocol can accomplish this due to its focus on stable assets (which should always trade at the desired peg) and like-priced assets (ETH:stETH should always trade 1:1). 

Curve’s stableswap combines Uni’s CPMM model with a linear price function model at a tighter range. The linear price function is, as its name suggests: a linear step function where the price is kept constant with respect to the sum of reserves (x + y = k) versus the product of reserves (x * y = k). This approach results in zero slippage as price is constant, however as the model is linear, reserves of one asset can eventually go to zero. Additionally, if demand for one asset outweighs the others, the pool can become imbalanced. 

Remember that in Uni’s CPMM model, the price curve is a hyperbola that keeps assets in a relative balance based on their product (x * y = k). The beauty of Curve is it bolsters this approach by combining it with a linear price function:

  • Utilizing the linear price function to keep the price constant while it remains close to the expected trading range.

  • Employing the constant product model as price moves outside of that range to keep reserves balanced.

As Curve facilitates stable pricing within a defined reserve range, it dramatically increases capital efficiency and reduces IL for LPs. As the model essentially abolishes slippage for traders and they can anticipate stable pricing, volume and fee capture by LPs also increase dramatically. This year alone Curve is set to produce ~$53m in fees, primarily from stablecoin <-> stablecoin trading. Importantly, Curve enabled a few additional features on top of the Stableswap invariant design. 

  • LP reserves could be lent out on money markets such as AAVE in what is known as “boosted pools”. This allowed LPs to gain yield on their idle assets in addition to obtaining trading fees. 

  • Curve instituted what is known as “metapools” wherein assets are paired against an LP token of another “base” pool. This allowed LPs to gain additional fee revenue on their LPs. For instance, LPs could deposit stablecoins into the Curve 3Pool, and then deposit their 3Pool LP token into the GUSD LP to obtain greater fee capture than offered by the 3Pool alone.

  • Curve V2 enabled concentrated liquidity around the linear portion of the price curve and altered the range of the tails in the CPMM portion. This was implemented along with the introduction of dynamic fees, exponential moving average-based internal pricing oracles and internal repegging. 

  • Curve pioneered the 3pool, wherein USDC, USDT, and DAI could be deposited as reserves and traded against the two assets used in the Uniswap model. 

With respect to the last feature, the 3pool hedges depeg/volatility risk for stable assets and can be tweaked for other use cases as well. For instance, what if one could lower IL for LPs by allowing them to weigh the assets they LP outside of the canonical 50/50 construct? 

Enters Balancer.

2.3 Balancer’s Rebalancing Pools

Released before, and possibly inspiring some of the Curve 3pool design, Balancer aimed to enhance the LP/trading experience with user-defined liquidity pools within the CPMM model. Using Balancer pools, an LP could create a pool with any number of assets and weigh those assets in any way desired. Moreover, Balancer's V2 design houses the liquidity of all pools under one contract, making routing between pools capital efficient with minimal gas fees.

Say you want to provide liquidity to the ETH/USDC pair on Uniswap, but are afraid of IL because you believe that the price of ETH is going to increase. Balancer allows you to provide liquidity with different weight ratios, for example, 80% ETH and 20% USDC. Due to the different ratios, the impact of trades in your pool is different from a 50/50 pool.

The IL is minimized because the weight of one asset is less than the other. Meaning, your pool will always be rebalanced by arbitrageurs to maintain an 80% relative ETH position - similar to simply holding 80% of your portfolio in ETH. This dramatically reduces your risk of IL because if the value of ETH increases, the majority of your LP is still in that asset (see IL comparisons below)!

As an LP, Balancer offers the benefit of trading fees, whilst also limiting your exposure to IL. However, it is important to note that non 50%/50% pools incur more slippage, thus less volume and fees. Despite having less volume/fees, enabling the ability to add any number of assets to a pool allowed any LP the ability to create a de facto index fund, a weighted portfolio of assets that continually rebalance over time. 

Similar to Curve, Balancer V2 has incorporated:

  • Boosted pools, wherein idle LP reserves can be lent out.

  • Composable stable pools using Curve’s hybrid AMM approach.

  • Managed pools where portfolio managers can dynamically alter asset weights.

  •  Linear pools that can be used to swap assets directly to their wrapped yield-bearing counterpart.

Uniswap, Curve, and Balancer created some unique innovations that shaped the liquidity landscape of today.

3. The Status Quo

3.1 Concentrated Liquidity and Uniswap V3

The most fundamental shift in on-chain liquidity from its inception to its current state is the move towards concentrated liquidity (CL). CL is the ability of an LP to reduce its idle reserve assets by packing its liquidity into a tighter price range. As this model was pioneered by Uniswap, let’s look at Uni V3 as the primary example.

Recall that in Uni V1-2, LPs covered the price range from 0 to infinity. With this model, at any given time the LP reserves were outside the trading range and thus not capturing trading fees. 

Uni V3 fixes this problem of idle reserves by allowing LPs to define the price range that they provide liquidity in (i.e. ±50% from the current trading price). In this way, LPs can concentrate their reserves in the ranges most utilized for trading, so they are more exposed to trading volume and fee capture.

In Uni V3, the price ranges for LPs are defined by granular price ticks set by the AMM. All trading that occurs within these predefined ranges exhibits the typical CPMM price function, however, this must be updated as the price moves out of one range and into another (think of it as nested CPMM functions).

This is different from the infinite range CPMM: from an LP perspective, the moment the asset's price moves out of its range, one of the reserve tokens is entirely converted into the other. Meaning if the price of token x goes up and exits the range, all of the assets in their LP position will be converted to token y.

All fees generated within a specific range are distributed pro-rata solely to the LPs providing liquidity within that range, amplifying fee capture on a range basis. Importantly, an LP can create as many positions with as many ranges as desired. As these positions are not fungible (because they are unique), they are represented as NFTs. This creates a liquidity reserve distribution where the depth of liquidity within each range is unique and dynamic (see below).

This optionality offers significant flexibility for LPs, but it also introduces additional risks. For instance, the risk of IL increases dramatically with volatility for those using tight ranges. 

As mentioned, the instant the price of the asset moves outside of the LP range, one reserve token is completely converted to the other. Let’s say the price of ETH is $2K and you’re providing ETH/USDC in a ± 20% range ($1.6K - $2.4K). To do this, you put in 1E and ~$2.4K stables into the range (notional value of ~$4.4K). You look at Twitter (X) and Blackrock announces that their ETH ETF was just approved and the price immediately moves +50% ($3K). 

The instant the value of ETH goes above your upper bound ($2.4K), you are solely holding USDC. If you initially provided $4.4K, your net LP position is now worth ~$4.6K versus ~$5.4K if you just held your ETH and stables outside the LP. So, your IL is -15%. 

IL is obviously more magnified if you don’t rebalance/adjust your range and remain in USDC as the price continues to increase. For instance, say you forget to rebalance and ETH goes to $4K, your IL is now -30%.

* Note you can use this handy calculator to estimate your IL in Uni V3

3.2 Horizontal vs Vertical Liquidity Aggregation

While Uniswap and many other CL-AMMs use the granular tick model, some DEXs, such as Trader Joe, have opted for a different method to define LP ranges and manage reserves within those ranges. 

Let’s compare:

These design considerations led to several key benefits:

  • Treating ranges as bins renders the positions fungible, enhancing their composability compared to Uniswap's NFT model.

  • Bins aggregate liquidity vertically (as they are discrete) versus horizontally (typical range-bound positions).

  • Vertical aggregation allows for the LP distribution to take on any shape desired (see below).

  • This enables unique flexibility for LPs, as they can decide which bins to add reserves to, whilst also defining their liquidity strategy.

  • Dynamic fees, which allow LPs to capture more fees when trading is volatile to help combat IL

In summary, the Liquidity Book offers LPs:

  • Flexibility. 

  • The ability to mitigate IL via dynamic fees.

  • Ensures minimal slippage for traders swapping within the active bin's range (linear function price curve).

The bin model is beginning to gain wider adoption with DEXs like Maverick Protocol coming online. With all of the benefits provided, it will be interesting to see if other DEXs will move towards this model.

3.3 Does Concentrated Liquidity Actually Improve Fee Capture for LPs?

In a study by Austin Adams and Gordon Liao, they discovered that, on average, Uni V3 outperforms Uni V2 LP fees by 54%. Specifically, for token pairs within the 1%, 0.3%, 0.05%, and 0.01% V3 positions, they outperform, or underperform, Uni V2 positions by 80%, 16%, -68%, and 160%, respectively. 

Highlighting the two largest outperformers, the 1% and 0.01% fee tiers, it can be surmised that highly volatile, new pairs and stable pairs outperform in Uni V3 vs V2. However, it should be noted that the volatile pairs used in this study were infinite-range LPs, not rebalanced CL positions. Thus, it is more likely that the observed “outperformance” is a function of volume and fee tier versus the type of liquidity provided.

Indeed, the scatter plot above confirms that higher fee tiers in uni V3 produce more fees in aggregate. This is not surprising as they require less volume to produce the same amount of net fees for LPs. So, the question still remains, does CL actually outperform infinite-range LPs?

In a comprehensive study conducted by 0xfbifemboy, it's evident that approximately half of the LPs (48.6%) in the ETH/USDC Uni V3 pool turn a profit over IL. Despite profiting, the degree of profitability is very low, with the mean being at zero (see below). This means that only an incredibly small handful of LPs utilizing CL are significantly outperforming IL on a fee-capture basis.

What can we learn about these wallets that do outperform significantly?

If we examine the price tick ranges of the 200 most profitable LPs, we find that the range (in USD terms) in which they deposit is quite narrow. In fact, for wallets with the highest profitability, the range was often less than a $100 spread on ETH! Interestingly, the 200 wallets that incurred the most losses also opted for tighter ranges. It appears that the primary difference between these “winner” and “loser” LPs is actively managing their positions.

Looking at the average duration of the LP from the 200 most profitable wallets, we can see that more often than not, these positions are only open for a few hours to a day (see below). This implies that they are actively managing the LP: burning their position as price exits their range and minting a new, tight-range LP to accommodate these swings. Yet again, just like the most profitable wallets, the bottom wallets also have low-duration LPs - what gives? 

0xfbifemboy argues that the primary distinction is that the top wallets utilize their LP as a limit order. Let’s say you are directionally biased that the price of ETH will increase. You could add out-of-range LP, above the current price. As the price goes up and enters your range, your LP becomes active and is now converting reserves from ETH to USDC. As the price goes beyond your range, you swap your USDC to ETH, rinse, and repeat. This dramatically lowers your risk to IL (as you are moving with the price) and allows you to capture fees along the way.

In summary, it seems that CL is advantageous for astute LPs, with emphasis on the term “astute”. It's evident that for passive, non-directional, retail LPs, providing liquidity in tight ranges is not only unprofitable but also significantly elevates IL risk. Even for astute LPs, it seems essential to consider the gas costs and price directionality of the assets they're providing to ensure profitability. 

With all of this complexity, it makes even hardened DeFi veterans question whether it is even worth providing liquidity. Fortunately for them, some DEXs have integrated automated liquidity management natively into their protocols. This enables passive LPs to seamlessly provide concentrated liquidity and capture fees while minimizing their IL risk.

3.4 Automated Liquidity Management and Strategies

To achieve genuine profitability as an LP (beyond liquidity mining rewards), one must actively manage their positions with fluctuating prices. However, this process is highly time-intensive and challenging for the average user, which is why many DEXs have natively automated this process with automated liquidity management (ALM).

Trader Joe incorporates strategies and ALM in a few different ways, giving LPs the ability to choose their preferred liquidity distribution shape when adding reserves to a pool.

Let’s compare a few of these distributions and their risks/benefits to LPs:

Joe also natively supports ALM through their Auto-Pools, offering LPs a one-click method to add reserves, which are then managed by Joe's automated rebalancing strategies. In the future, Auto-Pool tokens can be deposited into farms for additional yield.

Similar to Joe, Maverick Protocol gives LPs an out-of-the-box liquidity management solution, defined as Automated Liquidity Placement (ALP). In this approach, liquidity is dynamically adjusted within pools when predefined price triggers are reached. Put simply, this shifts liquidity so that it is always concentrated around the quoted trading price (based on TWAP), effectively improving fees for LPs and reducing slippage for traders.

Maverick also provides native strategies for price directionality - enabling LPs to choose “liquidity modes” (see above). Mode static is similar to traditional CL-AMMs without active management. Whereas “mode right” and “mode left'' allow LPs to take directional bias of an asset when entering a position. 

Say you know that there is a large Optimism (OP) unlock happening on a given date. You believe that this is a bearish unlock and that OP price will decline. Prior to the unlock you create a “mode left” LP position by adding your USDC single-sided liquidity to the bin immediately to the left of the current price. 

If your prediction is correct and the price of OP declines, then you will collect any trading fees (as the price rebounds on the way down) and remain almost fully in USDC. However, if your prediction is incorrect and instead the unlock is bullish (the price of OP goes up) you will remain fully in USDC. In this instance, you are protected from the downside (your LP remains primarily in USDC and collects fees) but you miss the opportunity to catch the upside in the event the price increases.

Mode both is likely the optimal strategy for unbiased LPs (farmers) as it enables bi-directional liquidity shifts based on an asset's TWAP. This allows LPs to continuously collect fees and minimizes IL risk, but doesn’t remove it entirely as slippage will always create inefficiencies as the assets are rebalanced. Backtests show that this model is much better than passive LPs on other CPMMs - with 8x and 6x improvements in capital efficiency and returns respectively on the ETH/USD pair in 2019. All of this occurs while also safeguarding LPs from IL.

Like Joe, in the future Maverick will enable boosted pools (where LP tokens are lent out for additional yield) and bin/strategy-specific incentivization from partners. While both protocols enable out-of-the-box solutions, these may not be the best strategies and still require LPs to alter their strategy depending on price action and market conditions. To fully abstract the role of liquidity management from LPs, protocols like Thena Finance offer ALM marketplaces where LPs can pick different liquidity managers when they join pools.

Thena Finance introduced what they refer to as Fusion Pools, a combination of Algebra Finance concentrated liquidity solutions and various ALM services. As of now, Thena enables users to choose between Gamma Strategies, Ichi, and DeFiEdge. While Gamma, Ichi, and DeFiEdge are currently the only ALMs operating on Thena’s fusion pools, they plan to onboard more to create a competitive marketplace for LPs. This may be a winning strategy over out-of-the-box solutions because competition between strategy providers will create the best-in-class products for LPs.

In summary, the trend to provide ALM at the DEX interface is starting to gain steam. Eventually, ALM providers will act as the primary intermediary between the user layer (LP) and the underlying swap infrastructure layer (DEXs). 

Of note, there are many ALM providers not mentioned here who are innovating in this area. Empirical data on ALM performance over longer timescales is needed to validate how useful each product is to LPs.

4. The Future

4.1 Hooks and Ambient

Ambient pioneered the use of hooks and added many benefits not available in Uni V3.

These benefits include: 

  • Housing all liquidity pairs in a Singleton contract, enabling more efficient routing.

  • Dynamic fees, akin to Trader Joe, that enhance fee generation during volatility.

  • Boosted pools, similar to Curve and Balancer, to increase yield via lending idle liquidity.

  • Hooks to enhance LP flexibility. 

As we have touched on most of these things above, let’s focus on hooks.

Hooks are external contracts that can be called at any point in the swap lifecycle. This capability allows developers to design “plugins” that execute based on specific triggers or consistently at any stage within the cycle. Put simply, hooks allow developers to customize anything associated with swaps. 

Hooks could be used to:

  • Create dynamic fee structures based on volatility triggers

  • Implement a token buy/sell “tax” 

  • Enable TWAP orders, where traders can DCA into assets 

  • Enable limit orders

  • Enable the lending out of idle liquidity

  • Create customized oracles

  • Auto compound LP fees

  • Circumvent MEV by adjusting trade orders based on “tips” given to the LPs by swappers

The possibilities with hooks are endless: we believe that hooks as a service, similar to ALMs, will be a burgeoning business model/narrative as the space moves forward.

4.2 The Merge of On- and Off-chain Liquidity Solutions

Another current trend is the shift towards utilizing off-chain professional market makers, in combination with on-chain LPs, to offer traders the most competitive pricing. The interface between traders and the off-chain market maker is what is known as a Request for Quote (RFQ) system.

In an RFQ system, traders express their “intent” to enter a trade: this is why it is sometimes referred to as “intent-based” architecture. On the backend, intents are translated in the form of a quote (target price and order size) and relayed to off-chain MMs who manage private, on-chain liquidity pools. 

Typically, this is done via a Dutch auction wherein MMs stream quotes to “solvers” (usually run by the DEX/Aggregator) in a price decay model, where solvers will eventually accept the quote listed as it gets closer to the intended target price. It's crucial to note that this entire procedure is automated, ensuring minimal to no delay from the trader's perspective.

Ultimately, this interaction manifests as a symmetric, bilateral agreement between the trader and the MM. The “swap” is just a bilateral transfer of funds and is thus not impacted by slippage, MEV, or any price model invariant. The operation of generating and streaming quotes is gasless, as they are simple signatures. The only gas paid is upon confirming the agreement (transfer) to execute the “trade”. This can be sponsored by the market makers themselves, so the trade can be gasless from a trader's perspective. 

The RFQ model is depicted below.

Prominent examples of teams employing this system include Hashflow, CoW Swap, 1inch, and Paraswap. However, numerous other DEXs are starting to adopt this model due to its inherent advantages for users (cue Uniswap X). 

The benefits of RFQ over traditional systems are:

  • Competitive pricing due to the Dutch auction system and peer-to-peer order matching.

  • Zero slippage as the market maker pools are not subject to CPMM architecture - it is a symmetric agreement.

  • MEV-resistance as market maker pools are privately managed and signatures prevent trade order manipulation.

  • Bridgeless cross-chain swapping since the “trade” is merely a bilateral transfer of assets between identical wallets on any EVM-compatible chain.

  • Gasless orders as quotes are streamed via signatures and fillers may pay the transfer fees.

  • Maintained transparency as all quotes and transfers are executed on-chain.

It is easy to see from trader and market maker perspectives why RFQ is inherently a better trading system. But, what about retail LPs?

For now, market makers oversee their own private on- and off-chain reserve pools that are not accessible by retail LPs. As a portion of the collateral managed by MMs is off-chain for hedging purposes, opening deposits to retail LPs would require their permission to have custody over their assets. This may bode well in the future for structured, custodial products, but it is an inherent limitation to this model versus traditional AMMs.

Currently, hybrid models that integrate both traditional AMMs and RFQ models appear to be the most beneficial. For instance, projects like CoW Swap, 1inch, and Paraswap use solvers to determine the most competitive price for traders - whether DEX-based or RFQ-based. These projects can also utilize RFQ for “just in time” liquidity so that if a trade is routed through a DEX, they can offset any slippage with RFQ, something that Range Protocol has proposed for retail LPs in their ALM.

In conclusion, we believe that the future lies in a blend of on-chain and off-chain trading solutions. Specifically, the combination of AMMs, ALMs, and RFQ systems provides the best execution for traders and the best risk/reward for LPs.

4.3 Central Limit Order Books (CLOB) and Hybrid CLOB/AMM Solutions

The integration of Central Limit Order Books (CLOBs) and hybrid CLOB/AMM solutions also represents a significant advancement in decentralized trading. Exemplified by platforms like Vertex, this integration marks a pivotal shift in how decentralized exchanges (DEXs) operate, enhancing both the sophistication and efficiency of trading experiences.

A CLOB is a traditional trading mechanism predominantly used in centralized exchanges. It organizes all buy and sell orders for an asset, matching them based on price and time priority. This method affords traders greater control, allowing them to set precise prices for buying or selling.

This hybrid CLOB/AMM design merges the precision of CLOB with the liquidity and user-friendliness of AMMs. 

Key advantages include:

  • Enhanced Price Discovery: Aggregating buy and sell orders through CLOB leads to more accurate market pricing.

  • Increased Liquidity: Integration with AMMs ensures continuous liquidity, even for less frequently traded assets.

  • Reduced Slippage: Combining order books and liquidity pools minimizes slippage, particularly for large orders.

  • Flexibility in Order Types: Traders can utilize various order types, such as limit orders, which are typically unavailable in standard AMM setups.

  • Efficient Trade Execution: Automatic routing of trades through either the CLOB or AMM mechanism, optimizing execution.

Vertex stands out as a cutting-edge example of this hybrid model. It is a fully on-chain trading venue and risk engine, enhanced by an off-chain sequencer, creating a robust, integrated trading platform.

Key features of Vertex include:

  • On-Chain Trading Venue and Risk Engine: Utilizing the CPMM function for its AMM.

  • Off-Chain Sequencer: A high-performance orderbook offering CEX-grade speed for order matching, aiming for decentralization through Vertex governance.

  • Unified Liquidity Pool: Combining AMM liquidity with automated traders' liquidity via the sequencer, ensuring the best available price execution.

  • Unique Liquidity Advantages: Continuous liquidity for both illiquid and liquid assets, with support for passive LP asset pools and long-tail DeFi assets.

  • Cross-Margined DEX: Integrating spot, perpetuals, and money markets into a singular system, offering self-custody control.

  • MEV Protection: The sequencer operates on millisecond timescales, minimizing MEV extraction while leveraging Arbitrum's L2 features for enhanced security.

  • Risk Checks and User Autonomy: Sequencer-level risk checks reduce transaction costs, maintaining user autonomy and security.

The integration of CLOB and hybrid CLOB/AMM solutions, particularly through platforms like Vertex, signifies another approach to evolving decentralized trading. This hybrid model blends the efficiency of centralized exchanges with the decentralized, trustless nature of AMMs.

5. Conclusion

The DeFi liquidity landscape is experiencing a transformative phase. From the rudimentary beginnings of AMMs, which democratized liquidity provision and trading, we've seen a shift towards more intricate and efficient systems. The creation of ALMs, whose birth stemmed from Uni V3's introduction of concentrated liquidity, represents a significant stride in addressing the inherent limitations of AMMs. These advancements not only optimize capital efficiency but also empower LPs with greater control, albeit with the trade-off of increased complexity and active management requirements.

The concept of hooks in Ambient and their potential applications further underscore the sector's innovative spirit. These "plugins" can revolutionize the trading process, offering dynamic functionalities ranging from auto-compounding LP fees to countering the pervasive issue of MEV. Such innovations are a testament to the DeFi community's relentless pursuit of refining and enhancing the decentralized trading experience, ensuring it remains robust, flexible, and user-centric.

Lastly, the fusion of on-chain and off-chain liquidity solutions, particularly through the RFQ system, and/or hybrid CLOB/AMM models may prove to be a groundbreaking development. These hybrid approaches promise traders the best of both worlds: the trustless, transparent nature of on-chain solutions and the efficiency and competitive pricing of off-chain market makers. As these systems become more prevalent, they could well set new industry standards, offering traders seamless, efficient, and cost-effective trading experiences. The future of DeFi, with its amalgamation of AMMs, CLOBs, ALMs, and RFQ systems, looks poised to redefine the paradigms of decentralized trading, ensuring a more optimized and inclusive financial ecosystem for all.

Use our referral system to spread the word about the Chronicle!

Brought to you by Squigs

Thanks for reading, please give us a follow on Twitter at @Castle__Cap and visit our website to learn more about our services and get in touch.

Virtually yours,

The Castle

The Alpha Assembly

Receive Telegram notifications of our posts and those of our partners! Join the Alpha Assembly Telegram channel today!

The central hub for everything crypto:

Reply

or to participate.