# Concentrated Liquidity

## Uniswap: brief history

<figure><img src="/files/XkQkDxIKypX1lIVG4Vtg" alt=""><figcaption></figcaption></figure>

Uniswap was one of the most successful early DEXs, pioneering the concept of **automated market makers** (AMMs) and **liquidity pools**, opening the doors to **decentralized finance**.

{% hint style="info" %}
A liquidity pool is a smart contract that contains a reserve of two or more cryptocurrency tokens in a decentralized exchange (DEX). Liquidity pools enable users to buy and sell crypto without the need for centralized market makers (CEX).
{% endhint %}

Founded in 2018 on the Ethereum blockchain, Uniswap V1 functions as an automated liquidity protocol.&#x20;

It was followed by V2, which introduced direct ERC-20 pools, flash swaps, and an improved price oracle.

In May 2021, Uniswap launched V3, a significant upgrade introducing **concentrated liquidity**.

## V2 Liquidity Approach

In Uniswap v2, liquidity is evenly distributed along an **x\*y=k** price curve, with assets reserved for all prices between 0 and infinity. For most pools, most of this liquidity is **never used**.\
\
For example, a v2 stable pair uses only \~0.50% of capital for trading between $0.99 and $1.01, that is the price range where LPs would expect to see the most volume and consequently earn the most fees.\
\
The liquidity in the v2 pools is distributed across the **full price curve**, and while this makes it a more straightforward approach for the user, it results in inefficient capital usage.

## Concentrated Liquidity

{% embed url="<https://streamable.com/e/5s142a>" %}

Concentrated liquidity refers to liquidity that is allocated within a specific price range. In traditional liquidity distribution, assets could be traded across the entire range (0, ∞). |\
\
However, with concentrated liquidity, LPs can focus their capital on narrower price intervals, rather than the entire range. This results in more tailored price curves, greater capital efficiency, and deeper liquidity for traders.

<figure><img src="/files/2UseClTBaq00oCPKyrB5" alt=""><figcaption></figcaption></figure>

For instance, in a stablecoin/stablecoin pair, an LP might decide to allocate capital only within the $0.99 - $1.01 price range. This creates deeper liquidity around the mid-price, allowing LPs to earn higher trading fees from their capital.

Earlier AMMs used the Constant Function Market Maker (CFMM) model, which kept the balance between two tokens in a pool constant, regardless of their price. \
\
This meant liquidity was spread across all price ranges, leading to lower trading fees for LPs and higher slippage, as most liquidity remained unused.

Concentrated liquidity improves on this by allowing LPs to allocate liquidity to specific price ranges.

This creates concentrated positions where LPs earn higher fees based on their contribution to the active price range. \
\
As the price fluctuates, liquidity from different LPs is used for swaps, and traders benefit from deeper liquidity and reduced slippage.

<figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXd3RlDUkJkkT54x3jotFD3U-qh0dHCAY1GiJdrlBZKwhbOoxFbZHO0jho7yzSe7WFYM1C5IGrAjVGYBjj1uKK52RyhQ-nq_38kDFXYPYCpm5DTeK7A_XUzpj39uy7259qOmzSKw?key=7X_f_sT-Fg5t2KVZk5TPhH4V" alt=""><figcaption><p>Differences between CFMM and CLAMM</p></figcaption></figure>

Let’s look at the example: LP (Bob) invests $1 million across the entire ETH/DAI price range, while another LP (Alice) concentrates $183,500 within the 2,000 to 3,250 range. \
\
Despite Bob investing 5.44 times more, Alice earns the same fees, making their capital more efficient.

If the price moves outside Alice’s range, she will stop earning fees and their funds will be converted to the less valuable token, while Bob faces less impermanent loss.&#x20;

In a worst-case scenario, Alice loses $183,500 (16% of their capital), while Bob loses everything.

## **Increased Complexity**

Concentrated liquidity models introduce additional complexity compared to traditional liquidity pools, requiring liquidity providers to actively manage and monitor their positions within specific price ranges.

Poorly chosen ranges or incorrect price predictions could result in lower returns or potential losses.\
\
When assets move along the price curve within a given price range, your ratio of assets changes as swaps take place.\
When an LP specifies a price range for liquidity, they effectively place a limit buy and sell order.&#x20;

The consequence of an asset’s price moving out of range is a position comprised fully of the underperforming asset that no longer earns fees.\
\
Liquidity providers need to carefully select the price ranges in which they concentrate their funds. <br>

{% hint style="info" %}
Although manual concentrated liquidity management improves efficiency from many perspectives, active management is essential to ensure that liquidity remains consistently within the optimal range.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://swapxfi.gitbook.io/swapx-docs/protocol-design-and-features/algebra-integral-v4/concentrated-liquidity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
