# Quick Guide to Crus v1

## &#x20;introduces:

* **Concentrated liquidity,** giving individual LPs granular control over what price ranges their capital is allocated to. Individual positions are aggregated together into a single pool, forming one combined curve for users to trade against
* **Multiple fee tiers** , allowing LPs to be appropriately compensated for taking on varying degrees of risk

These features make crus t**he most flexible and efficient AMM ever developed on zksync**:

* LPs can provide liquidity with **up to 4000x capital efficiency** relative to Uniswap v2, earning **higher returns on their capital**
* Capital efficiency paves the way for low-slippage **trade execution that can surpass both centralized exchanges and stablecoin-focused AMMs**
* LPs can significantly **increase their exposure to preferred assets** and **reduce their downside risk**
* LPs can sell one asset for another by adding liquidity to a price range entirely above or below the market price, approximating **a fee-earning limit order that executes along a smooth curve**

Crus's **oracles are now far easier and cheaper to integrate**. Oracles are capable of providing time-weighted average prices (TWAPs) on demand for any period within the last \~9 days. This removes the need for integrators to checkpoint historical values.

Also, Crus' gas cost for swapping on the Zksync mainline is slightly lower than other swaps!

Read on for more details on Crus. For a deeper technical overview check out the Crus's Core smart contracts.

## Concentrated Liquidity <a href="#concentrated-liquidity" id="concentrated-liquidity"></a>

In Uniswap v2, liquidity is distributed evenly along an x\*y=k price curve, with assets reserved for all prices between 0 and infinity. For most pools, a majority of this liquidity is never put to use. As an example, **the v2 DAI/USDC pair reserves just \~0.50% of capital for trading between $0.99 and $1.01** , the price range in which LPs would expect to see the most volume and consequently earn the most fees.

V2 LPs only earn fees on a small portion of their capital, which can fail to appropriately compensate for the price risk ("impermanent loss") they take by holding large inventories in both tokens. Additionally, traders are often subject to high degrees of slippage as liquidity is spread thin across all price ranges.

In curs,Crus LP's can **concentrate their capital within custom price ranges, providing greater amounts of liquidity at desired prices.** In doing so, **LPs construct individualized price curves** that reflect their own preferences.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FGGgxJN7PQjtuI2jWKq5H%2FGithub_%E3%80%81.jpg?alt=media&#x26;token=b1399e04-2890-498d-b09c-39b140c2c940" alt=""><figcaption></figcaption></figure>

LPs can combine any number of distinct concentrated positions within a single pool. For example, an LP in the ETH/DAI pool may choose to allocate $100 to the price ranges $1,000-$2,000 and an additional $50 to the ranges $1,500-$1,750.

By doing so, an LP can approximate the shape of any automated market maker or active order book.

**Users trade against the combined liquidity of all individual curves** with no gas cost increase per liquidity provider. Trading fees collected at a given price range are split pro-rata by LPs proportional to the amount of liquidity they contributed to that range.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FiYRqcoH2MQAWXY6eC9li%2FGithub1.jpg?alt=media&#x26;token=47843b5f-aeca-406c-87ff-39903cc51bdd" alt=""><figcaption></figcaption></figure>

### Capital Efficiency <a href="#capital-efficiency" id="capital-efficiency"></a>

By concentrating their liquidity, LPs can provide **the same liquidity depth as v2 within specified price ranges while putting far less capital at risk.** The capital saved can be held externally, invested in different assets, deposited elsewhere in DeFi, or used to increase exposure within the specified price range to earn more trading fees.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FOcNEI14x5iCAKrh4IJkq%2FGithub%202.jpg?alt=media&#x26;token=86d7a08a-3aef-4142-b5f3-4e7030081b61" alt=""><figcaption></figcaption></figure>

Let's illustrate with an example:

Alice and Bob both want to provide liquidity in an ETH/DAI pool on Zksync . They each have \\$1m. The current price of ETH is 1,500 DAI.

Alice decides to deploy her capital across the entire price range (as she would have in Uniswap v2). She deposits 500,000 DAI and 333.33 ETH (worth a total of \\$1m).

Bob instead creates a concentrated position, depositing only within the price range from 1,000 to 2,250. He deposits 91,751 DAI and 61.17 ETH, worth a total of about $183,500. He keeps the other $816,500 himself, investing it however he prefers.

While Alice has put down 5.44x as much capital as Bob, _they earn the same amount of fees_, as long as the ETH/DAI price stays within the 1,000 to 2,250 range.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FjSoEduyemBIz8SqTYDaQ%2FGithub%203.jpg?alt=media&#x26;token=296c6a8c-9e9c-4854-949c-0dea9eac1e5b" alt=""><figcaption></figcaption></figure>

Bob's custom position also acts as a kind of stop-loss for his liquidity. Both Alice and Bob's liquidity will be entirely denominated in ETH if the price of ETH falls to $0. However, Bob will have lost just $159,000, versus Alice's $1m. Bob can use his additional $816,500 to hedge against downside exposure or to invest in any other conceivable strategy.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FXeIqCZXsNFGCDW4rL6Ti%2FGithub%204.jpg?alt=media&#x26;token=ab121409-e0f4-4b90-b39d-c24b161956fe" alt=""><figcaption></figcaption></figure>

Instead of providing equivalent liquidity depth as a v2 LPs with less capital, v3 LPs can choose to provide **greater depth with the same amount of capital** as their v2 counterparts. This requires **taking on more price risk** ("impermanent loss") while supporting greater amounts of trading and earning higher fees.

LPs in more stable pools will likely provide liquidity in particularly narrow ranges. If the \~$25m currently held in the Uniswap v2 DAI/USDC pair was instead concentrated between 0.99 — 1.01 in Crus, it would provide the same depth as $5bn in Uniswap v2 as long as the price stayed within that range. **If the \~$25m was concentrated into the 0.999 - 1.001 range it would provide the same depth as $50b in Uniswap v2.**

The tool below calculates the capital efficiency gains of a concentrated liquidity position (centered around the current price) relative to allocating capital across the entire price curve.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FbABPYHESjJWWO0uurvfg%2FGithub_5.jpg?alt=media&#x26;token=207b8db8-71be-4af5-a149-f39de3f81822" alt=""><figcaption></figcaption></figure>

At launch, capital efficiency gains will max out at 4000x for LPs providing liquidity within a single 0.10% price range. The crus pool factory is technically capable of supporting ranges as granular as 0.02%, translating to a maximum 20,000x capital efficiency gains relative to v2. However, more granular pools can increase swap gas costs and might be more useful on zksync.

### Active Liquidity <a href="#active-liquidity" id="active-liquidity"></a>

If market prices move outside an LP's specified price range, their liquidity is effectively removed from the pool and is no longer earning fees. In this state, an LP's liquidity is composed entirely of the less valuable of the two assets, until the market price moves back into their specified price range or they decide to update their range to account for current prices.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2F0B0MLTHqsu6pS5P84aCb%2FGithub%206.jpg?alt=media&#x26;token=711caa3d-c802-4758-921b-13b56a20e77c" alt=""><figcaption></figcaption></figure>

In Crus, it is theoretically possible for no liquidity to exist in a given price range. However, we expect rational LPs to continuously update their price ranges to cover the current market price.

### Range Orders <a href="#range-orders" id="range-orders"></a>

Crus's LP customizability opens up a novel order feature to complement market orders, which we are calling 'range orders'.

LPs can deposit a single token in a custom price range above or below the current price: if the market price enters into their specified range, they sell one asset for another along a smooth curve while earning swap fees in the process.

Depositing to a narrow range feels similar to a traditional limit order. For example, if the current price of DAI is below 1.001 USDC, Alice could add \\$10m worth of DAI to the range of 1.001 — 1.002 DAI/USDC.

Once DAI trades above 1.002 DAI/USDC, Alice's liquidity will have fully converted into USDC. Alice must withdraw her liquidity (or use a third-party service to withdraw on her behalf) to avoid automatically converting back into DAI if DAI/USDC starts trading below 1.002.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FIgN45djcks4AHFOSEq8V%2FGithub7.jpg?alt=media&#x26;token=02578e61-74a8-438e-a50a-d56e963013ce" alt=""><figcaption></figcaption></figure>

The average execution price of a fully executed range order is the geometric average of the minimum and maximum price: in Alice's case, the execution price equals 1.001499 DAI/USDC for a total of $1,001,499. This execution price does not account for additional swap fees earned during the period in which prices trade within the 1.001 — 1.002 DAI/USDC range.

Range orders within wider ranges may prove particularly useful for profit-taking, buying the dip, and primary issuance events: in the later use case, issuers are now able to deposit liquidity in a single asset and specify the exact range of prices across which they wish to sell their tokens.

### Non-Fungible Liquidity <a href="#non-fungible-liquidity" id="non-fungible-liquidity"></a>

As a byproduct of per-LP custom price curves, liquidity positions are no longer fungible and are not represented as ERC20 tokens in the core protocol.

Instead, LP positions will be represented by non-fungible tokens (NFTs). However, common shared positions can be made fungible (ERC20) via peripheral contracts or through other partner protocols. Additionally, trading fees are no longer automatically reinvested back into the pool on LPs' behalf.

Over time we expect increasingly sophisticated strategies to be tokenized, making it possible for LPs to participate while maintaining a passive user experience. This could include multi-positions, auto-rebalancing to concentrate around the market price, fee reinvestment, lending, and more.

## Flexible Fees <a href="#flexible-fees" id="flexible-fees"></a>

Crus offers LPs three separate fee tiers per pair — 0.05%, 0.30%, and 1.00%. This array of options ensures that LPs tailor their margins according to expected pair volatility: LPs take on more risk in non-correlated pairs like ETH/DAI and, conversely, take on minimal risk in correlated pairs like USDC/DAI.

Although distinct fee tiers may lead to some degree of liquidity fragmentation, we believe that most pairs will calibrate to an 'obvious' fee tier, which then serves as the canonical market. We expect like-kind asset pairs to congregate around the 0.05% fee tier and pairs like ETH/DAI to use 0.30%, while exotic assets might find 1.00% swap fees more appropriate. governance can add additional fee tiers as needed.

Uniswap v2 introduced a protocol fee switch, which allowed a flat 5 basis point (16.66% of LP fees) fee to be turned on by governance. Uniswap v3 protocol fees are far more flexible. Fees will be off by default, but can be turned on by governance on a per-pool basis and set between 10% and 25% of LP fees.

## Advanced Oracles <a href="#advanced-oracles" id="advanced-oracles"></a>

Uniswap v2 introduced time weighted average price (TWAP) oracles. These oracles serve as a critical piece of DeFi infrastructure, and have been integrated into dozens of projects, including Compound and Reflexer.

V2 oracles work by storing cumulative sums of Uniswap pair prices on a per-second basis. These price sums can be checked once at the beginning of a period and once at the end to calculate an accurate TWAP over that period.

Curs offers significant improvements to the TWAP oracle, making it possible to calculate any recent TWAP within the past \~9 days in a single on-chain call. This is achieved by storing an array of cumulative sums instead of just one.

<figure><img src="https://2868688320-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fr2KB0hDgQ5aUkkLZV7MT%2Fuploads%2FMsc3q4Zq1ZLga2BFnhGx%2FGithub_%E3%80%81%20%E5%89%AF%E6%9C%AC%208.jpg?alt=media&#x26;token=620b243b-697a-4690-b8f9-a05df290df28" alt=""><figcaption></figcaption></figure>

This array of historical price accumulators makes it far easier and cheaper to create more advanced oracles that include simple-moving averages (SMA), exponential moving averages (EMA), outlier filtering, and more.

Despite this major improvement, the gas cost to Uniswap traders for keeping oracles up to date has been reduced by \~50% relative to v2. The costs for calculating TWAPs in external smart contracts is significantly cheaper as well.
