For Web3, we are about to go through a difficult June in the bear market, but Crypto developers will not stop. Today, Uniswap released a draft code for Uniswap V4 so that V4 can be built publicly. Bankless talked with Hayden Adams, the founder of Uniswap, to get an in-depth understanding of all the feature updates of this upcoming V4 version.
Before that, let’s first get familiar with the details of the previous version V3. Uniswap V3 was released in May 2021, introducing centralized liquidity (liquidity can be provided within a specific price range), which significantly improved the capital efficiency of DEX and established Uniswap as the largest DEX in the DeFi field. Currently, Uniswap accounts for 57.4% of the on-chain transaction volume in DeFi, which is 3 times that of the second-ranked DEX in the field.
The vision of Uniswap V4 is to allow anyone to make these trade-off decisions by introducing “Hooks”. Here are the main features of Uniswap V4:
Hooks
The core feature of Uniswap V4 is hooks, which are snippets of code that run at a specific moment in the lifecycle of a pool. Compared to previous Uniswap versions, the new version of the pool is more customizable, so hooks play an important role whether it is creating a pool, LP (liquidity provider) adding/removing liquidity, or before/after a swap.
For example, pegs can be used to create pools with dynamic swap fees that change based on market conditions, rather than pre-set and static swap fees. At the same time, pegs also enable traders to place more complex orders, such as limit orders or TWAP (time-weighted average price) orders, which buy/sell a certain amount of tokens within a certain period of time.
Not only that, but the peg also allows Uniswap’s liquidity to be used in different ways. This is similar to Balancer’s Boosted Pools, where excess liquidity can be deposited into other protocols, such as lenders, to earn additional yield.
These examples of hooks are just some of the applications that the Uniswap team has come up with. Beyond that, anyone can build and deploy their own hooks without permission.
Note: In DeFi, Hooks is a programming concept that refers to a set of functions or code snippets that are automatically triggered when a smart contract performs a specific operation. It can be used to execute custom logic before, after, or during a specific event. Hooks provide developers with a way to execute custom logic at different stages of a smart contract. By using hooks, developers can implement more flexible, customizable, and scalable DeFi applications.
The Singleton
The second major change brought by Uniswap V4 is the introduction of the Singleton pattern. As the name suggests, Singleton is a single contract that contains all the different pools in Uniswap V4. This is different from previous Uniswap versions, where each pool was stored in its own independent contract.
This model significantly improves V4's Gas efficiency, as complex Swaps will be routed through a single contract, rather than multiple different contracts, which would consume large amounts of Gas. Using Singleton mode is estimated to reduce the cost of deploying new pools (i.e. new trading pairs) by up to 99%.
Singleton also takes advantage of what Uniswap Labs calls a "flash accounting system." This will further reduce gas costs when trading on a DEX, because only the net balance of tokens in the pool is transferred when the swap is completed. This is different from Uniswap V3, which transfers all assets involved in the transaction into/out of the pool during the swap process.
Governance, Release, and Distribution
Uniswap V4 will be governed by Uniswap DAO and UNI Token holders.
Like V3 and V2 before it, the protocol will include a fee switch that Uniswap governance can activate on a pool-by-pool basis to take a portion of the fees generated by liquidity providers.
V4 will be released under the Business Source License 1.1, which will last for four years and restrict the protocol to use only by governance-approved entities.
Finally, it’s worth noting that Uniswap V4 is not about to be released. According to Hayden in the podcast, the code for V4 has not yet been finalized and audited, so it will be released at some point before the protocol is officially released.
What it means for DeFi
V4 will have a wide-ranging impact on Uniswap itself and DeFi as a whole.
First, the upgrade should help Uniswap maintain its position as the largest DEX by volume, as pegs make the protocol more capital efficient, more customizable, and more gas efficient relative to V3. The latter two features should help Uniswap attract more order flow from DEX aggregators and longer-tail, heterogeneous pairs, while maintaining its dominance in higher volume pairs like ETH/USDC, ETH/USDT, ETH/DAI, etc.
In addition, this upgrade enables Uniswap to create more types of orders, such as TWAP and limit orders, which should help Uniswap attract more traders with diverse needs to turn to DEX, thereby enhancing its competitiveness with CEX. From this perspective, the previous collapse of FTX and the recent regulatory pressure on CEXs such as Binnace and Coinbase have led to a significant increase in on-chain trading activities. The current situation may help DEXs such as Uniswap become more competitive in crypto trading.
In May, the DEX/CEX volume ratio reached an all-time high before falling back. As Uniswap V4 matures, it seems that it has a great chance to push this ratio to new heights.
Finally, V4 should help make Uniswap a more composable protocol. Uniswap V3 was notoriously difficult to build on due to fork permissions and the challenges of managing centralized liquidity positions. Between the peg and the Singleton model, it seems easier to build and leverage V4 liquidity relative to the V3 version. This could bring a new wave of interesting applications and spark a wave of creativity at a time when the DeFi industry desperately needs innovation.
Overall, Uniswap V4 should help push the DeFi space forward and bring a better future to DeFi. However, it will take some time before it is launched. By then, DeFi will once again lead the Crypto industry.