What Is Uniswap V4?
article-1374

What Is Uniswap V4?

8 Min.

Basics

In June 2023, Uniswap disclosed the draft code for Uniswap V4, which proposed significant new features to its decentralized exchange (DEX) protocol. The new functionalities include "hooks" that enable the customization of liquidity pools, a singleton design that makes cross-pool liquidity more efficient, and the reintroduction of native ETH trading pairs. Uniswap V4 is projected to bring various benefits, such as greater customization, better efficiency, reduced gas, and advanced trading strategies. However, there are some potential limitations to Uniswap V4, such as the possibility for Uniswap to collect a portion of the withdrawal fees and its license which restricts the usage of its source code.

Exploring Uniswap

Uniswap is a decentralized exchange (DEX) operating on EVM-compatible blockchains, facilitating trades of various digital assets through an automated market maker (AMM) model. This system does away with traditional order books, streamlining the trading process.

Inspired by the concept of on-chain automated market-making introduced by Ethereum co-founder Vitalik Buterin, Uniswap was launched in 2018 by Ethereum developer Hayden Adams. Uniswap has since become a leading DEX, with substantial trading volumes and greater liquidity compared to its peers. By 2023, it had solidified its position among the top decentralized exchanges based on metrics like trading volume, liquidity, and active user count.

The platform has gone through several versions, with Uniswap V2 launching in 2020 and Uniswap V3 in 2021. In June 2023, Uniswap released a draft code for Uniswap V4, which offers significant new features. Before exploring the upcoming functionalities in Uniswap V4, let's take a moment to review how the earlier versions of Uniswap have shaped its trajectory.

Uniswap V1 Overview

Uniswap V1, the initial version of the decentralized exchange, debuted in November 2018 as a proof-of-concept. The most notable innovation in this version was the adoption of the Constant Product Market Maker (CPMM) model.

Departing from the conventional order book-based approach, Uniswap allowed users to pool their tokens into designated trading pairs, like ETH/DAI, to earn a portion of the fees generated from trades within the pool. This version enabled token swaps between ether (ETH) and ERC-20 tokens, as well as between different ERC-20 tokens. However, to exchange one ERC-20 token for another, users had to follow a two-step process:

  1. Swap the first ERC-20 token for ether (ETH).
  2. Swap ether (ETH) for the desired ERC-20 token.

This additional step was required because Uniswap V1's smart contracts only supported direct liquidity pools with ether (ETH). While Uniswap V1 introduced groundbreaking concepts, it also had its drawbacks. It was vulnerable to arbitrage due to inefficiencies in its pricing mechanism, and it experienced significant slippage during high-volume transactions.

Uniswap V2 Overview

To address the limitations of its predecessor, Uniswap V2 was launched in May 2020, introducing key enhancements to the original design. Uniswap V2 refined the automated market maker (AMM) model by enabling direct token-to-token swaps, which reduced slippage and boosted capital efficiency.

A significant addition in V2 was the introduction of flash swaps, allowing users to temporarily withdraw any amount from a liquidity pool for use in the same transaction, provided they return the original amount along with a fee. This feature opened doors for arbitrage and yield farming without the need for upfront capital. Uniswap V2 also implemented Time-Weighted Average Prices (TWAP), which allows other decentralized applications to reliably reference Uniswap prices for greater stability and security.

Uniswap V3 Overview

Uniswap V3, launched in May 2021, addressed the need for greater capital efficiency and concentrated liquidity. This version allows liquidity providers to define specific price ranges for their contributions, leading to enhanced capital use and the opportunity to earn higher fees. Another change in Uniswap V3 is the introduction of multiple fee tiers, including 0.05%, 0.30%, and 1.00%, which cater to varying risk tolerances and trading volumes.

Additionally, Uniswap V3 introduced Non-Fungible Liquidity (NFL), giving liquidity providers NFTs that represent their share in the liquidity pools. This innovation allows users to trade, sell, or transfer their positions without impacting the assets in the pool. Uniswap V3 also made strides in scalability by integrating with Ethereum's Layer 2 solution, Optimism, reducing transaction fees and increasing platform scalability.

What's New in Uniswap V4?

Uniswap V4, not yet officially released, promises several new features and improvements, as detailed in its draft code and whitepaper. Here are some of the key changes:

  1. Hooks and Custom Pools: Uniswap V4 introduces "hooks," customizable contracts that can be triggered at various points in a liquidity pool's lifecycle. This provides developers with more flexibility to run specific code when liquidity is added, removed, or adjusted. For example, hooks could enable pools to apply dynamic fees, implement on-chain limit orders, or act as time-weighted average market makers (TWAMM), which spread large trades over time to reduce market impact. The potential uses for hooks are broad, allowing developers to create custom liquidity pools that could, for instance, use different on-chain oracles or integrate with lending protocols. This level of customization could make Uniswap V4 a more adaptable platform for various use cases.
  2. Singleton Contract: Unlike Uniswap V3, where each liquidity pool had its own contract, Uniswap V4 consolidates all pools into a single contract. This reduces gas costs for creating new pools and makes multi-pool swaps more efficient. Uniswap estimates that this new design could lower the cost of pool creation by up to 99%.
  3. Flash Accounting: Complementing the singleton architecture, Uniswap V4 introduces flash accounting, which changes how token transfers are handled. In earlier versions, each swap or liquidity operation required immediate token transfers. With flash accounting, these transfers are deferred to the end of the operation, reducing complexity and costs. This change also improves routing efficiency, which is crucial given the potential increase in liquidity pools due to hooks.
  4. Native ETH Trading Pairs: Uniswap V4 reintroduces native ETH trading pairs. While Uniswap V1 supported ETH/ERC-20 pairs, later versions required wrapping ETH into WETH, leading to additional gas costs. Uniswap V4, thanks to its singleton and flash accounting structure, allows for direct trading with both ETH and WETH, offering users a more cost-effective experience. Native ETH transfers typically consume about half the gas of ERC-20 transfers, potentially reducing transaction fees significantly.

Benefits of Uniswap V4

Uniswap V4 brings new opportunities for liquidity creation and on-chain token trading. The key advantages include:

  1. Greater Customization: The addition of "hooks" enables developers to implement unique functionalities in liquidity pools. This flexibility is likely to lead to innovative trading features tailored to specific needs.
  2. Improved Efficiency: With "hooks," singleton contracts, and flash accounting, Uniswap V4 is expected to streamline transaction routing, enhancing overall efficiency.
  3. Reduced Gas Costs: The updated architecture of Uniswap V4 could significantly lower gas fees, making the platform more appealing to a broader user base.
  4. Potential for Higher Returns for Liquidity Providers: With flexible fee structures, liquidity providers (LPs) could have more opportunities for increased earnings by setting dynamic fees.
  5. Advanced Trading Strategies: Uniswap V4's new features, such as time-weighted average market maker (TWAMM), limit orders, and dynamic fees, open the door to more complex trading strategies, appealing to experienced traders seeking sophisticated options.

Potential Drawbacks of Uniswap V4

Uniswap V4, while bringing many enhancements, also comes with some potential limitations, including:

  1. Fee Collection Complexity: Uniswap V4 has two distinct governance fee mechanisms: swap fees and withdrawal fees, each with its own rules. As with Uniswap V3, the Uniswap DAO and UNI token holders can decide to collect a percentage of swap fees from specific pools. Additionally, in Uniswap V4, governance can also take a capped portion of the withdrawal fee if a pool's "hooks" are configured to include withdrawal fees. This dual mechanism may complicate governance and fee structures.
  2. Restricted Licensing: Uniswap V4 is licensed under the Business Source License 1.1, which restricts commercial or production use of the source code for up to four years. After this period, the code transitions to a General Public License (GPL). Some community members have criticized this licensing approach, arguing that it challenges Uniswap's commitment to being truly open-source.

Conclusion

The decentralized exchange (DEX) landscape is in constant flux, with new platforms and protocols emerging all the time. Uniswap, a leading figure in this space, is launching its fourth version five years after its debut in 2018. Each iteration has brought improvements, and Uniswap V4 continues this trend with groundbreaking changes designed to expand the possibilities of DEXs.

However, this flexibility may come with increased complexity for users. With Uniswap V4's open-ended design, developers have almost limitless room to create customized liquidity pools using "hooks," but users will need to understand how these pools work and what each "hook" does before engaging. This could raise the learning curve for users who aren't familiar with these new features. Despite this, the advantages of Uniswap V4 could be considerable. As with any new technology, users should take the time to do their own research (DYOR) to understand the risks and benefits before diving in.

Uniswap
DEX
Follow us
Hexn operates under HEXN (CZ) s.r.o. and HEXN Markets LLC. HEXN (CZ) s.r.o. is incorporated in the Czech Republic with the company number 19300662, registered office at Cimburkova 916/8, Žižkov, Praha. HEXN (CZ) s.r.o. is registered as a virtual assets service provider (VASP). HEXN Markets LLC is incorporated in St. Vincent and Grenadines with the company number 2212 LLC 2022, registered office at Beachmont Business Centre, 379, Kingstown, Saint Vincent and the Grenadines