Uniswap v2 vs v3 in 2024: Detailed Comparison including Fees & Liquidity

Benson2024年11月11日

Key Takeaways

The key updates for Uniswap v3 contain four parts, namely concentrated liquidity, multiple fee tiers, governance, and price oracles. The main focus of these updates is on improving capital efficiency.

Uniswap v3 enables LPs to concentrate their liquidity within specific price ranges, optimizing capital use and potentially generating around 54% higher returns than v2; however, this depends on the fee tier and requires active management to keep liquidity optimally positioned.

In Uniswap v3, liquidity positions are represented by unique ERC-721 NFTs, adding some complexity compared to v2's simpler ERC-20 tokens. These NFTs make positions more tailored but also affect how easily they can be traded or transferred.

Uniswap v3 uses a geometric mean TWAP (time-weighted average price) for price calculations, which offers more accuracy and stability in volatile markets compared to v2's arithmetic mean TWAP.

Deciding between Uniswap v2 and v3 hinges on your individual needs and preferences. For active LPs who are comfortable with managing their positions and seek higher returns, v3 offers enhanced efficiency and control. If you prioritize simplicity and a passive approach to liquidity provision, Uniswap v2's ease of use might be a better fit.

Introduction: Navigating the Evolution of Uniswap

In the landscape of decentralized finance (DeFi), choosing the right platform for liquidity provision is crucial. Uniswap serves as an automated market maker (AMM) and a decentralized exchange (DEX). This peer-to-peer protocol allows users to trade cryptocurrencies directly with each other without the need for a centralized intermediary. Uniswap was designed to address the problem of high spreads, a common occurrence for illiquid assets on order-book exchanges

Uniswap v3 introduced advanced mechanisms such as flexible fee structures and enhanced capital efficiency, closely aligning its evolution with Ethereum's growth. As the chart illustrates the market caps of Uniswap (uni) and Ethereum (eth), their movements have shown an impressive relevance of 82.54%, highlighting the deep interconnectedness between them. This makes sense, given that Uniswap operates on Ethereum's blockchain, relying on its infrastructure for decentralized exchange functionalities. With Ethereum being the leader in the smart contract ecosystem, shifts in its market cap often reverberate through the Uniswap ecosystem, underscoring how intertwined these two are in shaping the future of DeFi.

Before the launch of Uniswap v3 in May 2021 (marked by the blue line below), the price of Uniswap tokens saw a strong upward trend, reflecting the widespread adoption of Uniswap v2 and the overall growth of the DeFi space. However, shortly after the launch, the market saw a downtrend, likely due to broader market corrections and adjustments to the new functionalities introduced in v3.

Despite price fluctuations, Uniswap v3 has revolutionized the traditional DeFi landscape with innovations like concentrated liquidity and a flexible fee structure. These upgrades enable liquidity providers to allocate capital more efficiently, which is crucial in volatile markets, such as today's, with Uniswap's price holding steady around $8 as of October 13, 2024.

For anyone seeking to maximize returns and optimize their DeFi strategies in 2024, understanding the differences between Uniswap v2 and v3 is essential.

Key Differences

Basically, Uniswap v2 operates on a simple principle: liquidity is distributed uniformly along the entire price curve. While straightforward, this approach leads to capital inefficiency, as much of the deposited assets sit idle, especially in pools with stable assets.

Uniswap v3 introduces four key updates: concentrated liquidity, multiple fee tiers, price oracles, and governance. The main focus of these updates is on improving capital efficiency, namelyconcentrated liquidity, a concept absent in v2. Now, you can choose a specific price range where your liquidity is active. This targeted approach significantly boosts capital efficiency, allowing for higher returns on your investment. Think of it as fine-tuning your liquidity provision to maximize your participation in trades.

Let's break down the key distinctions and how they impact an individual as a liquidity provider or trader.

Transaction Fees and Earning Potential

With both relying on Ethereum, transaction speed is directly influenced by the level of congestion on Ethereum and the associated gas fees. Higher network traffic can lead to slower transaction confirmations and increased gas costs.

What is Multiple Fee Tiers

Uniswap v3 introduces a key difference with its flexible fee structure. Unlike v2, which has a fixed 0.30% fee for all swaps, v3 offers multiple fee tiers: 0.05%, 0.30%, and 1%. This allows liquidity providers (LPs) to select pools with fee structures that align with the volatility of the specific trading pair.

For instance, stablecoin pairs, which experience minimal price fluctuations, are better suited for pools with lower fees, like the 0.05% or 0.30% tiers. Conversely, pairs involving more volatile tokens might benefit from higher fee tiers, like 1%, to compensate LPs for the increased risk. This flexibility in fee tiers in Uniswap v3 empowers LPs to optimize their returns based on their risk appetite and the characteristics of the trading pair.

Feature

Uniswap v2

Uniswap v3

Fee Structure

Single fee tier of 0.30% for all swaps.

Multiple fee tiers per token pair: 0.05%, 0.30%, and 1% initially.

Fee Customization

No flexibility in fee settings.

UNI governance can add additional fee tiers and set the fee tier for each pool upon initialization.

Fee Distribution

Fees automatically added to the liquidity pool, resulting in compounded returns.

Fees are collected and held separately as the tokens in which they are paid, no compounding.

Protocol Fee

UNI governance can turn on a protocol fee, with limited flexibility in setting the fraction.

UNI governance has greater flexibility in setting the fraction of swap fees allocated to the protocol (1/N, where 4 ≤ N ≤ 10, or 0), and can be set on a per-pool basis.

Rationale for Fee Structure

The fixed 0.30% fee was suitable for most tokens historically.

Multiple fee tiers allow for greater flexibility and address the issue of a one-size-fits-all fee being too high for some pools (e.g., stablecoin pairs) and too low for others (e.g., pools with volatile tokens).

While it is hard to decide which are able to generate more profit, Uniswap Labs has conducted research highlighting a significant advantage of v3 in terms of earning potential for LPs: On average, non-rebalancing v3 positions yield around 54% higher fee returns compared to their v2 counterparts.

According to the chart, fee returns were initially lower In the early months following the launch of Uniswap v3 than those on v2 ,as liquidity and trading volume were still building up. However, as more market participants began integrating v3, fee returns on the new version steadily increased, surpassing those of v2 by the summer of 2021.

Screenshot 2024-10-13 at 11.32.04 AM.png

source: Uniswap

Specifically, this superior performance is consistent across various fee tiers, with the exception of the 5-bps tier, where v2 surprisingly outperforms v3.

Screenshot 2024-10-13 at 11.25.19 AM.png

source: Uniswap

Let's break down the fee return performance across different fee tiers:

100-bps fee tier: Full-range v3 positions in this tier exhibit an impressive average outperformance of approximately 80% overv2 positions.

1-bp fee tier: Range-bound v3 positions for stablecoin pairs in this tier demonstrate an even more remarkable outperformance, averaging around 160% higher fee returns compared to v2. This suggests that v3's concentrated liquidity model is particularly advantageous for stablecoin pairs with limited price volatility.

30-bps fee tier: Full-range v3 positions in this tier maintain a moderate advantage over v2, with an average outperformance of roughly 16% in fee returns.

The only outlier is the 5-bps fee tier, where non-rebalancing v3 positions underperform v2 by an average of approximately 68% in fee returns. This anomaly might be attributed to factors such as higher concentrated liquidity and the presence of professional market makers in v2 pools for this specific fee tier.

This research underscores the benefits of v3's concentrated liquidity model, allowing LPs to optimize their capital allocation and potentially achieve higher returns.

Liquidity

Liquidity serves as a most important upgrade in v3. In the early days of Uniswap v2, liquidity provision was spread evenly along the x*y=k curve, which meant that capital in the pool wasn't always being used efficiently. Each token pair had a single pool, and LPs deposited their assets into this pool, receiving fungible LP tokens in return. These tokens represented their share of the pool and entitled them to a portion of the trading fees.

Specifically, Uniswap v2 contains the following features:

Uniform distribution: Liquidity was spread evenly across the entire price range, meaning a portion of the capital sat idle, especially in pools where prices tended to remain stable.

Fungible LP tokens: All LP tokens for a given pool were fungible (namely identical and interchangeable). This made it easy for LPs to enter and exit positions.

Uniswap v3 revolutionized liquidity provision by introducing the concept ofconcentrated liquidity, enabling LPs to allocate their capital within specific price ranges rather than across the entire (0, infinity) spectrum. This meant that capital efficiency was greatly amplified the narrower the supported price range (i.e. a range of 0.99 → 1.01 instead of 0.9 → 1.1 is roughly 10x more capital efficient). This concentrated liquidity, known as a "position," enables LPs to allocate their funds more strategically. Once the trading price moves outside of this range, the liquidity in that position becomes inactive, meaning the LP can no longer collect trading fees. This innovation allows for more efficient capital use but requires LPs to be mindful of market movements.

Screenshot 2024-10-13 at 1.12.50 PM.png

Furthermore, unlike earlier versions that used fungible ERC-20 tokens, LP positions in Uniswap v3 are represented by NFTs (ERC-721 tokens). This is because each LP has its price curve, making their positions distinct and requiring NFTs to represent them.

The NFT you receive is uniquely generated based on the Uniswap pool and the parameters you set, representing your specific share in that pool and tailored to chosen liquidity position.

To summarize, here are the primary features of the v3 upgrade:

Enhanced Capital Efficiency: Concentrated liquidity allows LPs to optimize their returns by providing liquidity within the price ranges they anticipate will see the most trading activity.

Granular Control and Customization: With concentrated liquidity, LPs gain greater control over their exposure to price volatility and can tailor their positions to align with their risk tolerance and market outlook.

Non-Fungible Positions: Since each position has a specific price range and may have different amounts of uncollected fees, unique credentials should be a must.

Oracle

Before we jump into the differences, let's understand the foundation—the TWAP oracle. Both Uniswap v2 and v3 utilize this mechanism to calculate the average price of an asset over a specific time period. Think of it like a moving average, but instead of simply averaging prices, it takes into account how long each price was in effect. This makes the TWAP oracle more resistant to short-term price fluctuations and manipulations, making it a reliable price feed for DeFi protocols.

Below chart shows how TWAP is calculated, as the difference in this cumulative price can then be divided by the length of the interval to create a TWAP for that period.

image.png

source: Uniswap Docs

However, Uniswap v3 didn't just stick with the existing TWAP mechanism; it brought some notable improvements to the table–Geometric Mean TWAP: Uniswap v3 shifted from using an arithmetic mean TWAP to a geometric mean TWAP. Why is this important? Arithmetic mean TWAPs tend to overweight periods of high prices, especially in volatile markets. The geometric mean, on the other hand, smooths out this bias by considering the product of prices rather than their sum. This makes it a more precise representation of the average price.

To wrap up, Uniswap's transition from v2 to v3 showcases significant advancements in oracle design, with the shift to the geometric mean TWAP offering greater precision and resilience against volatility.

Security

Ethereum's move to PoS brought about numerous benefits, but it also introduced new security considerations. In a PoW system, the mining process is inherently random, making it difficult to predict who will mine the next block. However, PoS relies on validators who are selected to propose blocks based on their staked ETH. This shift to a deterministic process means that validators know in advance if they will be proposing blocks, potentially enabling them to manipulate oracle prices if they have malicious intent.

While Uniswap v3 does not come up with a perfect solution, it does incorporate features that aim to mitigate the risks of oracle manipulation.

Concentrated Liquidity: As mentioned before, this allows LPs to allocate their capital within specific price ranges. While primarily aimed at improving capital efficiency, concentrated liquidity can inadvertently increase the cost of manipulating prices, as larger amounts of capital would be required to move the price significantly.

Multiple Fee Tiers: The introduction of multiple fee tiers for pools enables the creation of pools with lower fees, attracting more liquidity. Higher liquidity can make price manipulation more expensive and challenging.

To further tackle these security challenges, researchers from Uniswap Labs have proposed several effective approaches. These include Promoting Wide-Range Liquidity,Modified TWAP Oracles, and Time Weighted Median Price (TWMP) Oracles. TWMP Oracles, in particular, enhance resistance to manipulation by calculating the median price over a set period, making it difficult for attackers to influence the price unless they control the majority of blocks. Together, these strategies help create a more secure and resilient Uniswap v3 platform.

License

While the main focus of v3's upgrades is on enhancing liquidity and fee structures, it also introduces a crucial licensing feature to guard against “vampire attacks.”

Both Uniswap v1 and v2 utilize the General Public License (GPL), which grants users the freedom to copy, run, distribute, and modify the software. However, this freedom comes at a cost.

Back in 2020, Uniswap faced a major setback when SushiSwap cloned its v2 code. SushiSwap launched with added incentives like the SUSHI token, successfully attracting over $800 million in liquidity from Uniswap. This dramatic shift caused Uniswap's collateral value to drop by around 74% and led to a mass migration of users. Clearly, there was a need for a licensing model that could prevent such aggressive cloning while still embracing the open-source principles of the DeFi space.

Hence, Uniswap v3 adopted a new license called BSL 1.1, which includes the following key features:

Time-Limited Restriction: The two-year restriction on commercial use gives Uniswap a head start in building an ecosystem around its v3 codebase.

Copyright Protection: The BSL leverages copyright law to enforce its restrictions.

Legal Recourse: Uniswap can sue for contributory copyright infringement if third parties commercially use a protocol derived from the Uniswap v3 code within the initial two years.

While the BSL provides strong protection, it's not perfect. Determined developers could still copy Uniswap's code and operate anonymously, making enforcement difficult. Additionally, the long-term impact on the DeFi ecosystem is a trade-off between open-source collaboration and proprietary protection. While it guards against misuse, widespread adoption of similar licenses could stifle the collaboration and innovation that drive open-source development.

In short, Uniswap v3's BSL is a smart move to defend against attempts to drain its liquidity and user base. It offers immediate benefits by securing Uniswap's market position and encouraging ecosystem growth. However, the long-term effects on the open-source DeFi landscape remain to be seen. As the DeFi world evolves, it will be interesting to watch how effective the BSL is in maintaining Uniswap's edge and shaping future licensing practices.

Detailed Comparison

Feature

Uniswap v2

Uniswap v3

Transaction Fees and Earning Potential

Fee Structure

Single fee tier of 0.30% for all swaps.

Multiple fee tiers: 0.05%, 0.30%, and 1% initially, with the ability for UNI governance to add more.

Fee Customization

No customization options. All pools for a given token pair use the same fee.

LPs choose a fee tier when creating a pool, allowing for customized fees based on token pair volatility and risk.

Protocol Fee

Can be enabled by UNI governance, with a portion of swap fees directed to the protocol.

UNI governance has greater flexibility in setting the protocol fee, choosing any fraction from 1/4 to 1/10, or 0, on a per-pool basis.

Earning Potential

Generally lower compared to v3, especially for active LPs. Passive liquidity provision is possible, with automatic fee compounding.

Generally offers 54% higher returns, especially in the 1bps and 100bps tiers. But underperforms v2 in the 30bps tier.

Liquidity

Liquidity Distribution

Uniform distribution along the entire price curve (0, ∞) for a token pair.

Concentrated liquidity allows LPs to allocate capital within specific price ranges, leading to greater capital efficiency, especially around the current price.

LP Tokens

Fungible ERC-20 tokens representing ownership of a portion of the pool's liquidity.

Non-fungible positions due to concentrated liquidity and separate fee collection.

Capital Efficiency

Lower compared to v3. A significant portion of liquidity might remain unused, especially in volatile markets.

Significantly higher due to concentrated liquidity. LPs can allocate capital within active trading ranges, leading to more efficient use of funds.

Oracle Design

TWAP Mechanism

Tracks the sum of prices at the beginning of each block, allowing for the calculation of arithmetic mean TWAP.

Tracks the sum of log prices, enabling the calculation of geometric mean TWAP, which is considered more accurate for representing average prices over time.

Price Calculation

External contracts need to manage accumulator checkpoints for accurate TWAP calculations.

Accumulator checkpoints are integrated into the core contract, simplifying TWAP calculation for external contracts and users.

Integration Ease

Can be more challenging for external contracts due to the need for external accumulator checkpoint management.

Easier integration for external contracts due to built-in accumulator checkpoints and a convenience function for retrieving historical accumulator values.

Security

Risk Mitigation Strategies

Relies on the economic disincentive of losing value to arbitrageurs or back-runners.

Similar to v2, but the cost of manipulation can be influenced by factors like the distribution of concentrated liquidity.

License

Code Licensing

Open-source and licensed under GPL, allowing for free copying, modification, and distribution.

Open-source, but utilizes a BSL 1.1 aims to deter cloning and "vampire attacks", restricting unauthorized commercial use for two years, after which the license converts to GPL.

Summary: Should I Use Uniswap v2 or v3?

Uniswap v2 and v3 both have pros and cons, and deciding which is "better" really comes down to your individual needs and preferences. Both versions have their own strengths, and the decision comes down to what you value most—efficiency or simplicity.

Uniswap v3: Efficiency and Control

Uniswap v3 stands out for its concentrated liquidity, allowing LPs to allocate capital within specific price ranges, leading to more efficient use of funds. This can result in higher returns, with studies showing v3 positions outperforming v2 by an average of 54% in terms of fee returns. Additionally, v3 offers flexible fee tiers—ranging from 0.05% to 1%—allowing for more tailored pricing based on market volatility. v3 also improves the Time-Weighted Average Price (TWAP) oracle, making on-chain price data more reliable and easier to use. Overall, v3 provides granular control for LPs, perfect for those who actively manage liquidity positions.

Uniswap v2: Simplicity and Familiarity

For those who prefer a straightforward approach, Uniswap v2 remains an excellent option. Its single fee tier and uniform liquidity distribution make it easier for less experienced users to understand and use. v2 also allows for passive liquidity provision, where LPs can deposit tokens and let the protocol handle the rest, with fees automatically compounded.

When deciding between the two, consider your trading habits. If you actively manage liquidity positions and seek to maximize returns, v3's features like concentrated liquidity and flexible fees may suit you better. However, if you prefer a hands-off approach, v2's simplicity might be more appealing. Additionally, think about the types of token pairs you trade—stablecoin pairs may benefit from v3's lower fees, while volatile pairs might perform better with v3's higher fees.

Ultimately, the best choice depends on your level of comfort with technical complexities and how actively you want to manage your positions.

10s 洞悉市場
Your One-Stop Crypto Investment Powerhouse

Uniswap v2 vs v3 in 2024: Detailed Comparison including Fees & Liquidity

Benson2024年11月11日

Key Takeaways

The key updates for Uniswap v3 contain four parts, namely concentrated liquidity, multiple fee tiers, governance, and price oracles. The main focus of these updates is on improving capital efficiency.

Uniswap v3 enables LPs to concentrate their liquidity within specific price ranges, optimizing capital use and potentially generating around 54% higher returns than v2; however, this depends on the fee tier and requires active management to keep liquidity optimally positioned.

In Uniswap v3, liquidity positions are represented by unique ERC-721 NFTs, adding some complexity compared to v2's simpler ERC-20 tokens. These NFTs make positions more tailored but also affect how easily they can be traded or transferred.

Uniswap v3 uses a geometric mean TWAP (time-weighted average price) for price calculations, which offers more accuracy and stability in volatile markets compared to v2's arithmetic mean TWAP.

Deciding between Uniswap v2 and v3 hinges on your individual needs and preferences. For active LPs who are comfortable with managing their positions and seek higher returns, v3 offers enhanced efficiency and control. If you prioritize simplicity and a passive approach to liquidity provision, Uniswap v2's ease of use might be a better fit.

Introduction: Navigating the Evolution of Uniswap

In the landscape of decentralized finance (DeFi), choosing the right platform for liquidity provision is crucial. Uniswap serves as an automated market maker (AMM) and a decentralized exchange (DEX). This peer-to-peer protocol allows users to trade cryptocurrencies directly with each other without the need for a centralized intermediary. Uniswap was designed to address the problem of high spreads, a common occurrence for illiquid assets on order-book exchanges

Uniswap v3 introduced advanced mechanisms such as flexible fee structures and enhanced capital efficiency, closely aligning its evolution with Ethereum's growth. As the chart illustrates the market caps of Uniswap (uni) and Ethereum (eth), their movements have shown an impressive relevance of 82.54%, highlighting the deep interconnectedness between them. This makes sense, given that Uniswap operates on Ethereum's blockchain, relying on its infrastructure for decentralized exchange functionalities. With Ethereum being the leader in the smart contract ecosystem, shifts in its market cap often reverberate through the Uniswap ecosystem, underscoring how intertwined these two are in shaping the future of DeFi.

Before the launch of Uniswap v3 in May 2021 (marked by the blue line below), the price of Uniswap tokens saw a strong upward trend, reflecting the widespread adoption of Uniswap v2 and the overall growth of the DeFi space. However, shortly after the launch, the market saw a downtrend, likely due to broader market corrections and adjustments to the new functionalities introduced in v3.

Despite price fluctuations, Uniswap v3 has revolutionized the traditional DeFi landscape with innovations like concentrated liquidity and a flexible fee structure. These upgrades enable liquidity providers to allocate capital more efficiently, which is crucial in volatile markets, such as today's, with Uniswap's price holding steady around $8 as of October 13, 2024.

For anyone seeking to maximize returns and optimize their DeFi strategies in 2024, understanding the differences between Uniswap v2 and v3 is essential.

Key Differences

Basically, Uniswap v2 operates on a simple principle: liquidity is distributed uniformly along the entire price curve. While straightforward, this approach leads to capital inefficiency, as much of the deposited assets sit idle, especially in pools with stable assets.

Uniswap v3 introduces four key updates: concentrated liquidity, multiple fee tiers, price oracles, and governance. The main focus of these updates is on improving capital efficiency, namelyconcentrated liquidity, a concept absent in v2. Now, you can choose a specific price range where your liquidity is active. This targeted approach significantly boosts capital efficiency, allowing for higher returns on your investment. Think of it as fine-tuning your liquidity provision to maximize your participation in trades.

Let's break down the key distinctions and how they impact an individual as a liquidity provider or trader.

Transaction Fees and Earning Potential

With both relying on Ethereum, transaction speed is directly influenced by the level of congestion on Ethereum and the associated gas fees. Higher network traffic can lead to slower transaction confirmations and increased gas costs.

What is Multiple Fee Tiers

Uniswap v3 introduces a key difference with its flexible fee structure. Unlike v2, which has a fixed 0.30% fee for all swaps, v3 offers multiple fee tiers: 0.05%, 0.30%, and 1%. This allows liquidity providers (LPs) to select pools with fee structures that align with the volatility of the specific trading pair.

For instance, stablecoin pairs, which experience minimal price fluctuations, are better suited for pools with lower fees, like the 0.05% or 0.30% tiers. Conversely, pairs involving more volatile tokens might benefit from higher fee tiers, like 1%, to compensate LPs for the increased risk. This flexibility in fee tiers in Uniswap v3 empowers LPs to optimize their returns based on their risk appetite and the characteristics of the trading pair.

Feature

Uniswap v2

Uniswap v3

Fee Structure

Single fee tier of 0.30% for all swaps.

Multiple fee tiers per token pair: 0.05%, 0.30%, and 1% initially.

Fee Customization

No flexibility in fee settings.

UNI governance can add additional fee tiers and set the fee tier for each pool upon initialization.

Fee Distribution

Fees automatically added to the liquidity pool, resulting in compounded returns.

Fees are collected and held separately as the tokens in which they are paid, no compounding.

Protocol Fee

UNI governance can turn on a protocol fee, with limited flexibility in setting the fraction.

UNI governance has greater flexibility in setting the fraction of swap fees allocated to the protocol (1/N, where 4 ≤ N ≤ 10, or 0), and can be set on a per-pool basis.

Rationale for Fee Structure

The fixed 0.30% fee was suitable for most tokens historically.

Multiple fee tiers allow for greater flexibility and address the issue of a one-size-fits-all fee being too high for some pools (e.g., stablecoin pairs) and too low for others (e.g., pools with volatile tokens).

While it is hard to decide which are able to generate more profit, Uniswap Labs has conducted research highlighting a significant advantage of v3 in terms of earning potential for LPs: On average, non-rebalancing v3 positions yield around 54% higher fee returns compared to their v2 counterparts.

According to the chart, fee returns were initially lower In the early months following the launch of Uniswap v3 than those on v2 ,as liquidity and trading volume were still building up. However, as more market participants began integrating v3, fee returns on the new version steadily increased, surpassing those of v2 by the summer of 2021.

Screenshot 2024-10-13 at 11.32.04 AM.png

source: Uniswap

Specifically, this superior performance is consistent across various fee tiers, with the exception of the 5-bps tier, where v2 surprisingly outperforms v3.

Screenshot 2024-10-13 at 11.25.19 AM.png

source: Uniswap

Let's break down the fee return performance across different fee tiers:

100-bps fee tier: Full-range v3 positions in this tier exhibit an impressive average outperformance of approximately 80% overv2 positions.

1-bp fee tier: Range-bound v3 positions for stablecoin pairs in this tier demonstrate an even more remarkable outperformance, averaging around 160% higher fee returns compared to v2. This suggests that v3's concentrated liquidity model is particularly advantageous for stablecoin pairs with limited price volatility.

30-bps fee tier: Full-range v3 positions in this tier maintain a moderate advantage over v2, with an average outperformance of roughly 16% in fee returns.

The only outlier is the 5-bps fee tier, where non-rebalancing v3 positions underperform v2 by an average of approximately 68% in fee returns. This anomaly might be attributed to factors such as higher concentrated liquidity and the presence of professional market makers in v2 pools for this specific fee tier.

This research underscores the benefits of v3's concentrated liquidity model, allowing LPs to optimize their capital allocation and potentially achieve higher returns.

Liquidity

Liquidity serves as a most important upgrade in v3. In the early days of Uniswap v2, liquidity provision was spread evenly along the x*y=k curve, which meant that capital in the pool wasn't always being used efficiently. Each token pair had a single pool, and LPs deposited their assets into this pool, receiving fungible LP tokens in return. These tokens represented their share of the pool and entitled them to a portion of the trading fees.

Specifically, Uniswap v2 contains the following features:

Uniform distribution: Liquidity was spread evenly across the entire price range, meaning a portion of the capital sat idle, especially in pools where prices tended to remain stable.

Fungible LP tokens: All LP tokens for a given pool were fungible (namely identical and interchangeable). This made it easy for LPs to enter and exit positions.

Uniswap v3 revolutionized liquidity provision by introducing the concept ofconcentrated liquidity, enabling LPs to allocate their capital within specific price ranges rather than across the entire (0, infinity) spectrum. This meant that capital efficiency was greatly amplified the narrower the supported price range (i.e. a range of 0.99 → 1.01 instead of 0.9 → 1.1 is roughly 10x more capital efficient). This concentrated liquidity, known as a "position," enables LPs to allocate their funds more strategically. Once the trading price moves outside of this range, the liquidity in that position becomes inactive, meaning the LP can no longer collect trading fees. This innovation allows for more efficient capital use but requires LPs to be mindful of market movements.

Screenshot 2024-10-13 at 1.12.50 PM.png

Furthermore, unlike earlier versions that used fungible ERC-20 tokens, LP positions in Uniswap v3 are represented by NFTs (ERC-721 tokens). This is because each LP has its price curve, making their positions distinct and requiring NFTs to represent them.

The NFT you receive is uniquely generated based on the Uniswap pool and the parameters you set, representing your specific share in that pool and tailored to chosen liquidity position.

To summarize, here are the primary features of the v3 upgrade:

Enhanced Capital Efficiency: Concentrated liquidity allows LPs to optimize their returns by providing liquidity within the price ranges they anticipate will see the most trading activity.

Granular Control and Customization: With concentrated liquidity, LPs gain greater control over their exposure to price volatility and can tailor their positions to align with their risk tolerance and market outlook.

Non-Fungible Positions: Since each position has a specific price range and may have different amounts of uncollected fees, unique credentials should be a must.

Oracle

Before we jump into the differences, let's understand the foundation—the TWAP oracle. Both Uniswap v2 and v3 utilize this mechanism to calculate the average price of an asset over a specific time period. Think of it like a moving average, but instead of simply averaging prices, it takes into account how long each price was in effect. This makes the TWAP oracle more resistant to short-term price fluctuations and manipulations, making it a reliable price feed for DeFi protocols.

Below chart shows how TWAP is calculated, as the difference in this cumulative price can then be divided by the length of the interval to create a TWAP for that period.

image.png

source: Uniswap Docs

However, Uniswap v3 didn't just stick with the existing TWAP mechanism; it brought some notable improvements to the table–Geometric Mean TWAP: Uniswap v3 shifted from using an arithmetic mean TWAP to a geometric mean TWAP. Why is this important? Arithmetic mean TWAPs tend to overweight periods of high prices, especially in volatile markets. The geometric mean, on the other hand, smooths out this bias by considering the product of prices rather than their sum. This makes it a more precise representation of the average price.

To wrap up, Uniswap's transition from v2 to v3 showcases significant advancements in oracle design, with the shift to the geometric mean TWAP offering greater precision and resilience against volatility.

Security

Ethereum's move to PoS brought about numerous benefits, but it also introduced new security considerations. In a PoW system, the mining process is inherently random, making it difficult to predict who will mine the next block. However, PoS relies on validators who are selected to propose blocks based on their staked ETH. This shift to a deterministic process means that validators know in advance if they will be proposing blocks, potentially enabling them to manipulate oracle prices if they have malicious intent.

While Uniswap v3 does not come up with a perfect solution, it does incorporate features that aim to mitigate the risks of oracle manipulation.

Concentrated Liquidity: As mentioned before, this allows LPs to allocate their capital within specific price ranges. While primarily aimed at improving capital efficiency, concentrated liquidity can inadvertently increase the cost of manipulating prices, as larger amounts of capital would be required to move the price significantly.

Multiple Fee Tiers: The introduction of multiple fee tiers for pools enables the creation of pools with lower fees, attracting more liquidity. Higher liquidity can make price manipulation more expensive and challenging.

To further tackle these security challenges, researchers from Uniswap Labs have proposed several effective approaches. These include Promoting Wide-Range Liquidity,Modified TWAP Oracles, and Time Weighted Median Price (TWMP) Oracles. TWMP Oracles, in particular, enhance resistance to manipulation by calculating the median price over a set period, making it difficult for attackers to influence the price unless they control the majority of blocks. Together, these strategies help create a more secure and resilient Uniswap v3 platform.

License

While the main focus of v3's upgrades is on enhancing liquidity and fee structures, it also introduces a crucial licensing feature to guard against “vampire attacks.”

Both Uniswap v1 and v2 utilize the General Public License (GPL), which grants users the freedom to copy, run, distribute, and modify the software. However, this freedom comes at a cost.

Back in 2020, Uniswap faced a major setback when SushiSwap cloned its v2 code. SushiSwap launched with added incentives like the SUSHI token, successfully attracting over $800 million in liquidity from Uniswap. This dramatic shift caused Uniswap's collateral value to drop by around 74% and led to a mass migration of users. Clearly, there was a need for a licensing model that could prevent such aggressive cloning while still embracing the open-source principles of the DeFi space.

Hence, Uniswap v3 adopted a new license called BSL 1.1, which includes the following key features:

Time-Limited Restriction: The two-year restriction on commercial use gives Uniswap a head start in building an ecosystem around its v3 codebase.

Copyright Protection: The BSL leverages copyright law to enforce its restrictions.

Legal Recourse: Uniswap can sue for contributory copyright infringement if third parties commercially use a protocol derived from the Uniswap v3 code within the initial two years.

While the BSL provides strong protection, it's not perfect. Determined developers could still copy Uniswap's code and operate anonymously, making enforcement difficult. Additionally, the long-term impact on the DeFi ecosystem is a trade-off between open-source collaboration and proprietary protection. While it guards against misuse, widespread adoption of similar licenses could stifle the collaboration and innovation that drive open-source development.

In short, Uniswap v3's BSL is a smart move to defend against attempts to drain its liquidity and user base. It offers immediate benefits by securing Uniswap's market position and encouraging ecosystem growth. However, the long-term effects on the open-source DeFi landscape remain to be seen. As the DeFi world evolves, it will be interesting to watch how effective the BSL is in maintaining Uniswap's edge and shaping future licensing practices.

Detailed Comparison

Feature

Uniswap v2

Uniswap v3

Transaction Fees and Earning Potential

Fee Structure

Single fee tier of 0.30% for all swaps.

Multiple fee tiers: 0.05%, 0.30%, and 1% initially, with the ability for UNI governance to add more.

Fee Customization

No customization options. All pools for a given token pair use the same fee.

LPs choose a fee tier when creating a pool, allowing for customized fees based on token pair volatility and risk.

Protocol Fee

Can be enabled by UNI governance, with a portion of swap fees directed to the protocol.

UNI governance has greater flexibility in setting the protocol fee, choosing any fraction from 1/4 to 1/10, or 0, on a per-pool basis.

Earning Potential

Generally lower compared to v3, especially for active LPs. Passive liquidity provision is possible, with automatic fee compounding.

Generally offers 54% higher returns, especially in the 1bps and 100bps tiers. But underperforms v2 in the 30bps tier.

Liquidity

Liquidity Distribution

Uniform distribution along the entire price curve (0, ∞) for a token pair.

Concentrated liquidity allows LPs to allocate capital within specific price ranges, leading to greater capital efficiency, especially around the current price.

LP Tokens

Fungible ERC-20 tokens representing ownership of a portion of the pool's liquidity.

Non-fungible positions due to concentrated liquidity and separate fee collection.

Capital Efficiency

Lower compared to v3. A significant portion of liquidity might remain unused, especially in volatile markets.

Significantly higher due to concentrated liquidity. LPs can allocate capital within active trading ranges, leading to more efficient use of funds.

Oracle Design

TWAP Mechanism

Tracks the sum of prices at the beginning of each block, allowing for the calculation of arithmetic mean TWAP.

Tracks the sum of log prices, enabling the calculation of geometric mean TWAP, which is considered more accurate for representing average prices over time.

Price Calculation

External contracts need to manage accumulator checkpoints for accurate TWAP calculations.

Accumulator checkpoints are integrated into the core contract, simplifying TWAP calculation for external contracts and users.

Integration Ease

Can be more challenging for external contracts due to the need for external accumulator checkpoint management.

Easier integration for external contracts due to built-in accumulator checkpoints and a convenience function for retrieving historical accumulator values.

Security

Risk Mitigation Strategies

Relies on the economic disincentive of losing value to arbitrageurs or back-runners.

Similar to v2, but the cost of manipulation can be influenced by factors like the distribution of concentrated liquidity.

License

Code Licensing

Open-source and licensed under GPL, allowing for free copying, modification, and distribution.

Open-source, but utilizes a BSL 1.1 aims to deter cloning and "vampire attacks", restricting unauthorized commercial use for two years, after which the license converts to GPL.

Summary: Should I Use Uniswap v2 or v3?

Uniswap v2 and v3 both have pros and cons, and deciding which is "better" really comes down to your individual needs and preferences. Both versions have their own strengths, and the decision comes down to what you value most—efficiency or simplicity.

Uniswap v3: Efficiency and Control

Uniswap v3 stands out for its concentrated liquidity, allowing LPs to allocate capital within specific price ranges, leading to more efficient use of funds. This can result in higher returns, with studies showing v3 positions outperforming v2 by an average of 54% in terms of fee returns. Additionally, v3 offers flexible fee tiers—ranging from 0.05% to 1%—allowing for more tailored pricing based on market volatility. v3 also improves the Time-Weighted Average Price (TWAP) oracle, making on-chain price data more reliable and easier to use. Overall, v3 provides granular control for LPs, perfect for those who actively manage liquidity positions.

Uniswap v2: Simplicity and Familiarity

For those who prefer a straightforward approach, Uniswap v2 remains an excellent option. Its single fee tier and uniform liquidity distribution make it easier for less experienced users to understand and use. v2 also allows for passive liquidity provision, where LPs can deposit tokens and let the protocol handle the rest, with fees automatically compounded.

When deciding between the two, consider your trading habits. If you actively manage liquidity positions and seek to maximize returns, v3's features like concentrated liquidity and flexible fees may suit you better. However, if you prefer a hands-off approach, v2's simplicity might be more appealing. Additionally, think about the types of token pairs you trade—stablecoin pairs may benefit from v3's lower fees, while volatile pairs might perform better with v3's higher fees.

Ultimately, the best choice depends on your level of comfort with technical complexities and how actively you want to manage your positions.

扫码获取更多资讯
为加密投资者打造的一站式投资研究平台