Concentrated Liquidity
New way of providing liquidity in Spookyswap V3
Overview
Providing liquidity is essential for decentralized exchanges like SpookySwap to function. It allows users to trade assets on the platform while ensuring that there are sufficient funds available for transactions. Providing liquidity awards the contributors to earn swapping fees from the pairs they provide. Your liquidity can earn even more rewards (BOOs) if they're staked at farms.
Concentrated Liquidity
The Idea
The key feature of SpookySwap V3 is concentrated liquidity, which allows liquidity to be allocated within a specific price range. In earlier versions, liquidity was distributed uniformly across the entire price curve from 0 to infinity.
This uniform distribution enabled trading throughout the entire price interval (0, ∞) without any loss of liquidity. However, in many pools, a significant portion of this liquidity remained unused.
Take stablecoin pairs, for example, where the relative prices of the two assets tend to remain stable. The liquidity outside the typical price range of a stablecoin pair is seldom utilized. For instance, in the SpookySwap V2 DAI/USDC pair, approximately 0.50% of the total available capital is engaged in trading within the narrow price range of $0.99 to $1.01, where liquidity providers (LPs) expect to see the highest volume and earn the most fees.
With SpookySwap V3, liquidity providers can concentrate their capital within smaller price intervals than (0, ∞). For a stablecoin/stablecoin pair, an LP might choose to allocate their capital solely to the 0.99 - 1.01 range. This concentration results in deeper liquidity around the mid-price, enabling traders to benefit from improved pricing and allowing LPs to earn higher trading fees on their invested capital. We refer to liquidity concentrated within a finite interval as a "position." LPs can have multiple positions within a single pool, each creating unique price curves that reflect their individual preferences.
Liquidity providers (LPs) can combine multiple concentrated positions within a single pool. For instance, an LP in the ETH/DAI pool could allocate $100 to the price range of $1,000-$2,000 and an additional $50 to the range of $1,500-$1,750.
This approach allows LPs to mimic the shape of any automated market maker or even an active order book (range orders).
Traders interact with the combined liquidity of all individual positions without any increase in gas costs per liquidity provider. The trading fees collected within a given price range are distributed proportionally among LPs based on the liquidity they contributed to that specific range.
By concentrating their liquidity, LPs can provide the same depth of liquidity as in V2 within specified price ranges while risking less capital, resulting in higher capital efficiency.
Active Liquidity
As the price of an asset fluctuates, it may move outside the price bounds set by liquidity providers (LPs) for a given position. When this happens, the liquidity within that position becomes inactive and ceases to earn fees.
When the price shifts in one direction, LPs accumulate more of one asset as swappers demand the other, eventually resulting in their entire liquidity being composed of just one asset. In V2, this behavior is less common since LPs typically do not reach the upper or lower bounds of the asset prices (i.e., 0 and ∞). However, if the price reenters the specified interval, the liquidity becomes active again, and LPs who are within the range can start earning fees once more.
Importantly, LPs can create multiple positions, each with its own designated price interval. Concentrated liquidity allows the market to determine an optimal distribution of liquidity, as rational LPs are incentivized to concentrate their liquidity while ensuring that it remains active.
Non-Fungible Liquidity
Due to the unique custom price curves created by each liquidity provider (LP), liquidity positions are no longer fungible and are not represented as ERC20 tokens within the core protocol.
Instead, LP positions are represented by non-fungible tokens (NFTs). However, common shared positions can still be made fungible (ERC20) through peripheral contracts or collaborations with partner protocols. Additionally, trading fees are no longer automatically reinvested back into the pool on behalf of the LPs.
In the future, we anticipate that increasingly sophisticated strategies will be turned into a token (tokenized), enabling LPs to engage while enjoying a more passive user experience. This could include features like multi-positions, automated re-balancing to concentrate liquidity around the market price, fee reinvestment, lending, and more.
The Role of Ticks
To achieve concentrated liquidity, the previously continuous spectrum of price space has been divided into discrete segments known as ticks.
Ticks serve as the boundaries between distinct areas in price space, with each tick representing a 0.01% increase or decrease in price at any point along this spectrum.
These ticks act as the limits for liquidity positions. When a liquidity provider (LP) creates a position, they must select the lower and upper ticks that define the borders of their position.
As the spot price fluctuates during swaps, the pool contract continuously exchanges the outbound asset for the inbound asset, utilizing all available liquidity within the current tick interval until the next tick is reached. At this point, the contract transitions to the new tick, activating any dormant liquidity within a position that has its boundary at this newly active tick.
While each pool contains the same number of underlying ticks, only a subset of them can function as active ticks in practice. Due to the design of the V3 smart contracts, tick spacing is directly linked to the swap fee structure. Lower fee tiers permit closer active ticks, while higher fees result in wider spacing of potential active ticks.
Although inactive ticks do not affect transaction costs during swaps, crossing an active tick does increase the cost of the transaction in which it occurs. This is because crossing a tick activates the liquidity within any new positions that use that tick as a boundary.
In scenarios where capital efficiency is crucial, such as stablecoin pairs, narrower tick spacing enhances the granularity of liquidity provisioning, likely reducing price impact during swaps and leading to significantly better pricing for stablecoin transactions.
Impermanent Loss
Impermanent Loss (aka IL) is one of the risks you take on as a liquidity provider and is a result of how AMMs function. Here are two articles to better explain it:
They will give you an idea of what IL is and how you are affected by it.
TL;DR: Large swings in the relative price difference of the two tokens in the pool could result in a loss compared to holding the tokens themselves if you withdraw at that precise moment (hence the term impermanent). The loss is only "permanent" if you withdraw your liquidity, however, that does not mean the IL will necessarily go away over time. Generally speaking, the trading fees received for being a liquidity provider and the yield from the farm can offset IL risk, but nothing is guaranteed.
Last updated