Uniswap V3 Explained (2024)

Uniswap V3 Explained (3)

Uniswap, one of the world’s most popular DEXs, is one of the leaders in the race to surpass centralized institutions. After getting to one of the highest TVLs among all DeFi projects, the Uniswap team launched a new version of this famous DEX — Uniswap v3. In this article, I’ll explain Uniswap V3 which you all need to know!

Let’s start with Uniswap…

Uniswap is a protocol on Ethereum for swapping ERC20 tokens. Unlike most exchanges, which are designed to take fees, Uniswap is designed to function as a public good — a tool for the community to trade tokens without platform fees or middlemen. Also unlike most exchanges, which match buyers and sellers to determine prices and execute trades, Uniswap uses a simple math equation and pools of tokens and ETH to do the same job.

Looking for Uniswap API? Try Bitquery.

Before we take a look at Uniswap v3, we must remind ourselves of its evolutionary path and the difference between v1 and v2. It will help us understand why the new features are the only natural thing that could happen for Uniswap to be one of the leaders in the DeFi space.

Uniswap V3 Explained (4)

Uniswap v1 was first launched on the Ethereum mainnet on November 2, 2018. Even though it wasn’t the first DEX, it certainly was the first one to catch the eye of Crypto lovers.

Uniswap is based on the Automated Market Maker (AMM) model. This model relies on a mathematical formula to price assets. Rather than placing orders, AMMs rely on Liquidity Providers (LPs) who invest in trading pairs in Liquidity Pools.

Uniswap is a Constant Function Market Maker, or more specifically, a Constant Product Market Maker. That means that the ratio of trading pairs in every liquidity pool must respect the Constant Product Formula:

x*y=k

where k is a constant, x is the reserve of the first asset, and y is the reserve of the second asset.

This means that all the LPs are to provide additional liquidity in a way that wouldn’t change k. Also, everyone traded had to be aware of the total amount of the funds locked to avoid high slippage.

Uniswap v1 supported only ETH-ERC20 trading pairs, so you could only swap ETH for a single ERC20 token. So, if you wanted to swap USDC for DAI, you had to swap USDC for ETH and then go to the ETH-DAI pool to get DAI.

Uniswap V3 Explained (5)

Another feature Uniswap v1 introduced was LP tokens. Every liquidity provider would get the amount of LP token proportional to the percentage of total liquidity they added. These LP tokens represent LP’s contribution to the pool and could be sold/traded or burned to redeem the deposited tokens. Furthermore, every trade on Uniswap incurred a 0.30% trading fee. These fees were automatically sent to the liquidity reserve as a reward for LPs providing liquidity.

Uniswap v1 was a proof-of-concept for a new type of decentralized marketplace. Its initial success was a signal for the team to immediately reiterate for an even better solution. Uniswap v2 was launched in May 2020.

In short, Uniswap v2 was a much better and more user-friendly version of Uniswap v1. The main problem of v1 addressed in this new version was the absence of ERC20-ERC20 token pools. This incurred much higher costs and slippage for users who wanted to swap one ERC20 token for another.

ERC20-ERC20 Pools

Uniswap v2 introduced ERC20-ERC20 liquidity pools to solve this so-called “ETH bridging” problem. They even used Wrapped ETH instead of native ETH in the core contracts. However, end-users could still use ETH through helper contracts.

Uniswap V3 Explained (6)

Oracles

This second version of Uniswap also implements a new functionality that enables highly decentralized and manipulation-resistant on-chain price feeds.

Flash Swaps

Another groundbreaking feature that v2 introduced was Flash Swaps. These Flash Swaps allowed users to withdraw as much as they wanted of any ERC20 token on Uniswap at no upfront cost and do anything they wanted with them (execute arbitrary code), provided that by the end of the transaction execution.

Even though Uniswap v1 still existed after v2 was launched, it didn’t take too long for LPs to transfer most of the liquidity from one version to another. Uniswap v2 experienced huge success, passing even some of the most famous centralized exchanges in daily trading volume. This success made Uniswap v2 one of the most forked projects — SushiSwap being its biggest competitor that was created as a fork.

Uniswap v3 is the forthcoming new and improved DEX that will run on the Ethereum blockchain and be powered by the same automated market maker (AMM) model as v2 but loaded with new developments aimed at maximizing returns for traders and liquidity providers, minimizing price slippage, and managing downside risks.

Uniswap has been a victim of its own success, receiving heavy criticism that its popularity is slowing down the Ethereum network and causing transaction gas fees to skyrocket. Also, Uniswap has seen the repeated exploitation and copying of its code by competitors like Sushiswap and Binance Smart Chain.

Uniswap v3 boosts the efficiency of its AMM model, which is one of the most significant features to observe when comparing DEXs.

Through the introduction of a concentrated liquidity concept, liquidity providers have the ability to supply their assets in a definite price range for which they deposit liquidity. Moreover, they have given tier-based rewards based on the degree of risk they are taking on in any particular pool. This can incentivize more liquidity providers to participate as the rewards would potentially help offset some of their potential losses in supplying liquidity to a wider price range.

The combination of these features enhanced the efficiency of the AMM model that supports Uniswap v3’s DEX, which would benefit traders thanks to more liquidity. Furthermore, liquidity providers can also possibly gain higher returns on their capital with as much as 4000x efficiency.

Uniswap v3 launched on May 5, 2021, on the Ethereum mainnet. There are the main feature updates that were introduced in Uniswap V3:

  1. More Decentralization
  2. Concentrated liquidity
  3. Better Security
  4. New fee tiers
  5. Oracle feed developments
  6. Range Orders
  7. Non-Fungible Liquidity
  8. License

These features will work together in achieving better capital efficiency for the platform’s traders and greater risk management for liquidity providers.

Now, let’s go through some of the Uniswap V3 features one by one to understand them a bit better.

Concentrated Liquidity

Concentrated liquidity is the main concept behind V3.

When LPs provide liquidity to a V2 pool, liquidity is distributed evenly along the price curve. Although this allows for handling all price ranges between 0 and , it makes the capital quite inefficient. This is because most assets usually trade within certain price ranges. This is especially visible in pools with stable assets that trade within a very narrow range. As an example, Uniswap DAI/USDC pool only uses around 0.5% of capital for trading between $0.99 and $1.01 — a price range where the vast majority of trading volume goes through. This is also the volume that makes the majority of trading fees for the LPs.

Uniswap V3 Explained (7)

This means that in this particular example, 99.5% of the remaining capital is pretty much never used.

In V3, LPs can choose a custom price range when providing liquidity. This allows for concentrating capital within ranges where most of the trading activity occurs.

Uniswap V3 Explained (8)

To achieve this, V3 creates individualised price curves for each of the liquidity providers.

Before V3, the only way to allow LPs to have individual curves was to create a separate pool per curve. These pools if not aggregated together resulted in high gas costs if a trade had to be routed across multiple pools.

What is important is that users trade against combined liquidity that is available at a certain price point. This combined liquidity comes from all the price curves that overlap at this specific price point.

LPs earn trading fees that are directly proportional to their liquidity contribution in a given range.

Capital Efficiency

Concentrating liquidity offers much better capital efficiency for liquidity providers.

Uniswap V3 Explained (9)

To understand it better, let’s go through a quick example.

Uniswap V3 Explained (10)

Alice and Bob both decide to provide liquidity in the ETH/DAI pool on Uniswap V3. They each have $10,000 and the current price of ETH is $1,750.

Alice splits her entire capital between ETH and DAI and deploys it across the entire price range (similar to V2). She deposits 5,000 DAI and 2.85 ETH.

Bob, instead of using his entire capital, decides to concentrate his liquidity and provides capital within the price range from 1,500 to 2,500. He deposits 600 DAI and 0.37 ETH — a total of $1200 and keeps the remaining $8800 for other purposes.

What is interesting is that as long as the ETH/DAI price stays within the 1,500 to 2,500 range, they both earn the same amount of trading fees. This means that Bob is able to provide only 12% of Alice’s capital and still makes the same returns — making his capital 8.34 times more efficient than Alice’s capital.

On top of that, Bob is putting less of his overall capital at risk. In case of a quite unlikely scenario of ETH going to $0, Bob’s and Alice’s entire liquidity would move into ETH. Although they would both lose their entire capital, Bob puts a much smaller amount at risk.

LPs in more stable pools will most likely provide liquidity in particularly narrow ranges. If the $25M currently held in the Uniswap v2 DAI/USDC pool were instead concentrated between the 0.99–1.01 price range in v3, it would provide the same depth as $5B in Uniswap v2 as long as prices stayed within that range.

Uniswap V3 Explained (11)

When V3 launches, the maximum capital efficiency is at 4000x when compared to V2. This will be achievable when providing liquidity within a single 0.1% price range. On top of that, the V3 pool factory will be able to support ranges as granular as 0.02% — which translates to a maximum of 20,000x capital efficiency relative to V2.

Active Liquidity

V3 also introduces the concept of active liquidity. If the price of assets trading in a specific liquidity pool moves outside of the LP’s price range, the LP’s liquidity is effectively removed from the pool and stops earning fees. When this happens, the LP’s liquidity shifts completely towards one of the assets and they end up holding only one of them. At this point, the LP can either wait until the market price moves back into their specified price range or they may decide to update their range to account for current prices.

Uniswap V3 Explained (12)

Although it is entirely possible that there will be no liquidity at a specific price range, in practice this would create an enormous opportunity for liquidity providers to indeed provide liquidity to that price range and start collecting all trading fees. From the game theory point of view, we should be able to see a reasonable distribution of capital with some LPs focusing on narrow price ranges, others focusing on less likely but more profitable ranges and yet another one choosing to update their price range if the price moves out of their previous range.

Uniswap V3 Explained (13)

Range Limit Orders

Range Limit Orders is the next feature enabled by concentrated liquidity.

Uniswap V3 Explained (14)

This allows LPs to provide a single token as liquidity in a custom price range above or below the current market price. When the market price enters into the specified range, one asset is sold for another along a smooth curve — all while still earning swap fees in the process.

This feature, when used together with a narrow range, allows for achieving a similar goal to a standard limit order that can be set at a specific price.

For example, let’s assume that DAI/USDC trades below 1.001. An LP can decide to deposit their DAI to a narrow range between 1.001 and 1.002. Once DAI trades above 1.002 DAI/USDC the whole LP’s liquidity is converted into USDC. At this point, the LP has to withdraw its liquidity to avoid automatically converting back into DAI once DAI/USDC goes back to trading below 1.002.

Uniswap V3 Explained (15)

Non-Fungible Liquidity

As each LP can basically create its own price curve, the liquidity positions are no longer fungible and cannot be represented by well-known ERC20 LP tokens.

Uniswap V3 Explained (16)

Instead, provided liquidity is tracked by non-fungible ERC721 tokens. Despite this, it looks like LP positions that fall within the same price range will be able to be represented by ERC20 tokens either via peripheral contracts or through other partner protocols.

On top of this, trading fees are no longer automatically reinvested back into the liquidity pool on LPs’ behalf. Instead, peripheral contracts can be created to offer such functionality.

Flexible Fees

Uniswap v3 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.

Uniswap V3 Explained (17)

Advanced Oracles

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.

V3 makes it possible to calculate any recent TWAP within the past ~9 days in a single on-chain call.

On top of this, the cost of keeping oracles up to date has been reduced by around 50% when compared to V2.

These are pretty much all the main features behind Uniswap V3.

Uniswap V3 Explained (18)

What is interesting is that all of these features haven’t caused an increase in the gas cost. Rather the opposite, the most common feature — a simple swap will be around 30% cheaper than its V2 equivalent.

License — Preventing Uniswap v3 Copycats

This could be seen as contrasting to the open-source philosophy of Blockchain. The team announced the time-delayed license for Uniswap v3. This means that Uniswap v3 Core has launched under the Business Source Licence 1.1. This has limited the use of the Uniswap v3 source code in commercial or production use for up to two years.

They decided to do this to prevent potential future copycats, such as SushiSwap. However, all code needed for external integrations isn’t affected by this license.

Since its inception, Uniswap has been the leading DEX and one of the world’s most popular DeFi platforms. They brought innovation with every new iteration.

Uniswap v3 is not only enabling a higher return on capital for its users, but it also brings new possibilities to the developer community to build an ecosystem around it.

It looks like Uniswap V3 can be a game-changer when it comes to AMMs. It basically combines the benefits of a standard AMM with the benefits of a stable-asset AMM — all of this while making capital way more efficient. This makes V3 a super flexible protocol able to accommodate a whole range of different assets.

With the super high capital efficiency of V3, even if the existing liquidity is split between V2, V3 and V3 on Optimism, it should still be way more than enough to facilitate trading with low slippage across all of these 3 protocols.

Uniswap V3 Explained (19)

One challenge of Uniswap V3 is that providing liquidity may become a bit harder, especially for less sophisticated users. Choosing the wrong price range may magnify the chances of being affected by impermanent loss and it will be interesting to see the development of third-party services that could help with choosing optimal strategies for allocating liquidity. Continue reading for more stories. Follow me on Linkedin to stay connected → https://www.linkedin.com/in/ishanshahzad/

Uniswap V3 Explained (2024)
Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6056

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.