In June 2023, Uniswap released the draft code for Uniswap V4, which proposed major new functionalities to the decentralized exchange (DEX) protocol.
The new features include "hooks" that provide customization of liquidity pools, a singleton design that makes cross-pool liquidity more efficient, and the return of native ETH trading pairs.
Uniswap V4 is expected to provide numerous benefits, including greater customization, better efficiency, reduced gas, and advanced trading strategies.
There are some potential limitations to Uniswap V4, however, such as the ability for Uniswap to collect a portion of the withdrawal fees and its license that limits the use of its source code.
What Is Uniswap?
Uniswap is a decentralized exchange (DEX) that operates on the Ethereum blockchain. It allows users to trade various digital assets using an automated market maker (AMM) model, eliminating the need for traditional order books.
Initially inspired by Ethereum co-founder Vitalik Buterin's concept of an on-chain automated market maker, Uniswap was created by Ethereum developer Hayden Adams in 2018.
Uniswap has grown to be a leader in the DEX market, boasting significant trading volumes and deeper liquidity compared to other DEXs. As of 2023, Uniswap ranks among the top DEXs based on various metrics such as trading volume, liquidity, and number of active users.
Uniswap has undergone various iterations, launching Uniswap V2 in 2020 and Uniswap V3 in 2021. In June 2023, Uniswap released the draft code for Uniswap V4, which includes major new functionalities.
But before we delve into Uniswap V4’s new features, let’s review the past iterations of Uniswap to better understand its evolution.
An Introduction to Uniswap V1
The initial iteration, Uniswap V1, was launched in November 2018 as a proof-of-concept platform. Its primary innovation was the introduction of the Constant Product Market Maker (CPMM) model.
Instead of relying on the traditional order book-based system, Uniswap allowed anyone with spare tokens to pool them in a specific trading pair (e.g., ETH/DAI) and in return earn a share of the fees collected from users who trade against the liquidity pool.
Swap ERC-20 Token 1 for ether (ETH).
Swap ether (ETH) for ERC-20 Token 2.
This process was necessary because the Uniswap V1 smart contracts only supported direct liquidity pools between ERC-20 tokens and ether (ETH).
While Uniswap V1 was groundbreaking, it had its limitations, including inefficiencies in its pricing algorithm that could be exploited by arbitrageurs, and high slippage for large-volume transactions.
An Introduction to Uniswap V2
In response to the challenges faced by Uniswap V1, the Uniswap V2 was launched in May 2020 featuring several crucial improvements. Uniswap V2 adjusted its AMM model to include direct token-to-token swaps, leading to lower slippage and improved capital efficiency.
Additionally, V2 introduced flash swaps, which allowed users to withdraw as much as they want from a liquidity pool and do anything with those funds as long as they return the withdrawn amount (plus a fee) within the same transaction. This facilitated arbitrage and yield farming opportunities without requiring upfront capital.
Uniswap V2 also introduced the concept of Time Weighted Average Prices (TWAP), which made it easier for other decentralized applications to securely use prices from Uniswap.
An Introduction to Uniswap V3
Launched in May 2021, Uniswap V3 focused on addressing issues related to capital efficiency and concentrated liquidity. Uniswap V3 lets liquidity providers choose specific price ranges within which their assets will be used, consequently earning higher fees as a result of increased capital utilization.
Uniswap V3 also introduced multiple fee tiers (0.05%, 0.30%, and 1.00%) to better accommodate different risk levels and trading volumes.
Non-Fungible Liquidity (NFL) is another new feature that allows liquidity providers to receive NFTs representing their share in liquidity pools, letting users trade, sell, or transfer their liquidity positions without affecting the underlying assets in the pool.
Another noteworthy feature of Uniswap V3 is its integration with Ethereum's Layer 2 solution, Optimism, which aims to reduce transaction fees and improve the scalability of the platform.
What’s New with Uniswap V4?
While Uniswap V4 has not yet been released officially, the potential features and improvements are published in its draft code and whitepaper. They include the following:
1. “Hooks” and custom pools
Uniswap V4 would allow anyone to make customization through the introduction of "hooks," which are contracts that run at various points of a liquidity pool's lifecycle.
To better understand “hooks”, it’s important to recognize that each liquidity pool has a lifecycle from creation, to liquidity being added, removed, or adjusted. “Hooks” allow developers to add code that performs designated actions at key points throughout the pool’s lifecycle.
For example, “hooks” can be added to allow liquidity pools to support dynamic fees natively, add on-chain limit orders, or act as a time-weighted average market maker (TWAMM) to spread out large orders over time to minimize price impact.
Customization of liquidity pools via “hooks” can be boundless, ranging from using various on-chain oracles to depositing unused liquidity into lending protocols. Ultimately, “hooks” would offer developers significant flexibility to create liquidity pools customized to suit specific needs.
In Uniswap V3, a new contract was deployed for every liquidity pool, making creating pools and performing multi-pool swaps more expensive.
A major change in Uniswap V4 is that all the pools are held in one contract. This will provide important gas savings because swaps will no longer need to transfer tokens between pools held in different contracts. Estimates by Uniswap show that Uniswap V4 could reduce pool creation gas costs by 99%.
3. Flash accounting
The singleton design complements another architectural change in Uniswap V4 called flash accounting.
In previous versions of Uniswap, each operation such as token swaps or adding liquidity to a pool ended by transferring tokens. In Uniswap V4, external transfers are only made at the end, which simplifies pool operations and reduces costs.
Singleton and flash accounting enable more efficient and economical routing across multiple pools. Considering the introduction of “hooks” would increase the number of liquidity pools, this benefit is especially useful.
4. Native ETH trading pairs
Uniswap V4 is bringing back native ETH in trading pairs.
As explained above, Uniswap V1 was limited to ETH/ERC-20 token pairs. In Uniswap V2, however, native ETH pairs were removed due to implementation complexity and concerns of liquidity fragmentation across WETH and ETH pairs.
Both Uniswap V2 and Uniswap V3 require the vast majority of users to wrap their ETH to WETH before trading on the Uniswap Protocol, requiring extra gas.
Through the introduction of singleton and flash accounting, Uniswap V4 allows for both WETH and ETH pairs to be traded. This would benefit users as native ETH transfers (21k gas) are about half the gas cost of ERC-20 transfers (40k gas).
What Are the Benefits of Uniswap V4?
Uniswap V4 is designed to open up more possibilities for how liquidity is created and how tokens are traded on-chain. Their benefits include:
“Hooks” allow developers to add new functionalities to liquidity pools with great flexibility. This is expected to spur the emergence of innovative pools with customized trading features.
The introduction of “hooks”, singleton contract and flash accounting could lead to improved efficiency in transaction routing.
3. Gas reduction
Uniswap V4’s new features are expected to further reduce gas costs. This could attract more users to the protocol.
4. Potential for increased earnings for LPs
There could be dynamic fee structures that offer liquidity providers (LPs) more control and potential for increased earnings.
5. Advanced trading strategies
New features like the time-weighted average market maker (TWAMM), limit orders, and dynamic fees could enable more advanced trading strategies that weren’t possible in previous versions. These could be attractive to sophisticated traders.
What Are the Potential Limitations of Uniswap V4?
There are some potential limitations with Uniswap V4. They include:
1. Fee collection
Uniswap V4 has two separate governance fee mechanisms: swap fees and withdrawal fees, each with different mechanisms. Similar to Uniswap V3, Uniswap governance (Uniswap DAO and UNI token holders) can elect to take a capped percentage of the swap fee on a particular pool.
In Uniswap V4, governance has the ability to take a capped percentage of that withdrawal fee if “hooks” initially choose to turn on withdrawal fees for a pool.
2. License that limits usage
Uniswap V4 is to be released under the Business Source License 1.1, which limits the use of the Uniswap V4 source code in a commercial or production setting for up to four years, at which point it will convert to a General Public License (GPL) license into perpetuity. This has led some community members to criticize that the latest iteration of Uniswap is not really open-source.
The decentralized exchange (DEX) market is an ever-evolving space, with new protocols and platforms emerging regularly. Uniswap is a dominant player in the DEX space and is releasing its fourth version five years after its inception in 2018, with each of the protocol’s past iterations adding new upgrades that improved functionality.
Nevertheless, the potential benefits of Uniswap V4 seem significant. For users, it’s always important to do your own research (DYOR) and fully understand what you are getting into.