Foreword: Two years ago, Uniswap v3 was released, which was a watershed for on-chain liquidity and DeFi. Today, the Uniswap protocol is the largest decentralized trading protocol, processing more than $1.5 trillion in trading volume. As a public infrastructure, it is an important part of the crypto ecosystem.

As technology and markets evolve, the Uniswap protocol must also evolve, and Uniswap v4 will open up a world of possibilities for how liquidity is created and how tokens can be traded on-chain.

On June 13, 2023, Uniswap released the Uniswap V4 code draft so that v4 can be built publicly and obtain public feedback and meaningful community contributions. The V4 draft mentioned in the blog is expected to be a months-long process.

Uniswap V4 Breakdown

Hooks

The defining feature of Uniswap V4 is hooks. Hooks are snippets of code that run at some point in the pool’s lifecycle — either at pool creation, after LPs add/remove liquidity to a pool, or before/after a swap. Hooks are important because they enable a greater degree of pool customization than previous generations of Uniswap.

For example, hooks can be used to create pools with dynamic swap fees that change based on market conditions, rather than pools that are pre-set and static.

Hooks also enable traders to place more complex orders, such as limit orders or TWAP (time-weighted average price) orders to buy or sell a certain amount of tokens within a given period of time.

Additionally, hooks allow Uniswap’s liquidity to be used in different ways. Similar to Balancer’s boosted pool, the pool’s excess liquidity can be deposited into other protocols, such as lenders, to earn additional yield.

These examples are just ones the Uniswap team came up with. Anyone can build and deploy their own hooks without permission.

Singleton

The second biggest change brought by Uniswap V4 is the introduction of Singleton. As the name suggests, Singleton is a single contract that contains all the different pools in Uniswap V4. This is different from previous iterations of Uniswap, where each pool was kept in its own separate 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 can be very gas-intensive. It is estimated that the use of Singleton can also reduce the cost of deploying new mining 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 the DEX, by simply transferring the net balance of tokens out of the pool after the swap is complete. This is different from Uniswap V3, where all assets involved in the transaction are transferred in/out of the pool during the swap process.

Governance, Release, and Distribution

Uniswap V4 will be governed by the Uniswap DAO and UNI 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 cut of the fees incurred by liquidity providers.

V4 will be released under the Business Source License 1.1, which will be valid for four years and restrict use of the protocol to governance-approved entities.

What Uniswap V4 means for DeFi

V4 will have broad implications for Uniswap itself and DeFi as a whole.

For beginners, the upgrade should help Uniswap maintain its position as the largest decentralized exchange by volume, as hooks improve the protocol’s capital efficiency relative to V3 while being more customizable and gas efficient. The latter two features should help Uniswap capture more order flow from DEX aggregators and long-tail exotic pairs while maintaining its dominance in high-volume pairs such as ETH/USDC, ETH/USDT, ETH/DAI, etc.

Additionally, the ability to create more order types (such as TWAP and limit orders) should help Uniswap become more competitive with centralized exchanges by attracting more sophisticated traders to DEXs. This, combined with the broader structural trend of trading activity moving on-chain following the FTX debacle and the recent regulatory pressure on CEXs like Binance and Coinbase, could help Uniswap challenge these competitors more severely.

The DEX/CEX volume ratio hit an all-time high in May before falling back. Uniswap V4 seems likely to push this ratio to new heights.

4 should help make Uniswap a more composable protocol. Uniswap V3’s lack of expressiveness and challenges managing concentrated liquidity positions have made it difficult to build on top of it. With ooks and singletons, it seems easier to build and leverage liquidity on V4 than on V3. This could lead to a ton of new, interesting applications and spark a wave of creativity in DeFi at a time when the industry desperately needs it.

Ending: It is worth noting that the release of Uniswap V4 is not imminent. According to Hayden on the podcast, the V4 code has not yet been finalized and audited, and the code should be finalized sometime before the release of the protocol. Uniswap V4 helps drive the DeFi industry forward and is an exciting new upgrade for DeFi. DeFi has been silent for a long time, and this new upgrade is pushing the price up ahead of time, making DeFi interesting again.