Uniswap Founder Hayden Adams Personally Interprets What Uniswap V4 Is

Uniswap V4 explained by founder Hayden Adams

Author: Hayden Adams, Founder of Uniswap; Translation: Blockingcryptonaitive

Two years ago, we released Uniswap v3, a watershed moment for on-chain liquidity and DeFi. Today, the Uniswap protocol is the largest decentralized trading protocol, processing over $1.5 trillion in volume. As public infrastructure, it is a critical component of the crypto ecosystem.

As technology and the market evolve, so too must the Uniswap protocol. That’s why we’re excited to introduce our vision for Uniswap v4, which we believe will open up a world of possibilities for how liquidity is created and how tokens are traded on-chain.

We’re now releasing a code draft so that v4 can be built in public, with open feedback and meaningful community contributions. We expect this to be a months-long process. You can read early open-source versions of both the Uniswap v4 core (https://github.com/Uniswap/v4-core) and periphery (https://github.com/Uniswap/v4-periphery) codebases at the links below.

Uniswap v3 took a strong, opinionated approach to providing liquidity, balancing an extremely complex tradeoff space. New features came at the cost of higher fees and code complexity. For example, v3 includes oracles, allowing builders to integrate real-time on-chain pricing data, but at the cost of increased costs to traders.

Our vision for Uniswap v4 is to allow anyone to make these tradeoff decisions by introducing “hooks”. Hooks are contracts that run at various points in a pool’s lifecycle. Pools can make the same tradeoffs as v3, or they can add entirely new functionality. For example, v4 will allow pools themselves to support dynamic fees, add on-chain limit orders, or act as time-weighted average price (TWAP) market makers to spread large orders out over time.

Alongside this customization, Uniswap v4’s architecture reduces costs and ensures efficiency. It introduces a new “singleton” contract, where all pools exist in a single smart contract. We believe the combination of hooks and the singleton architecture creates a very powerful platform for fast, secure pool customization and efficient routing across multiple pools. Uniswap v4 brings fast, expressive AMM innovation to a powerful ecosystem.

What is Uniswap v4

Hooks and Custom Pools

Each Uniswap liquidity pool has a lifecycle. During the pool’s lifecycle, several things happen. The pool is created with default fee levels, liquidity is added, removed, or readjusted, and of course, tokens are exchanged by users. In Uniswap v3, these lifecycle events are tightly coupled and executed in a very strict order.

To create space for customizable liquidity in Uniswap v4, we want to create a way for pool deployers to introduce code that performs specified operations at key points in the pool’s entire lifecycle–such as before or after a swap, or before or after an LP position changes.

Hooks are plugins that define how custom “pools, swaps, fees, and LP positions” interact. Developers can innovate on top of Uniswap’s liquidity and security by creating custom AMM pools with hooks that integrate with the v4 smart contract set.

Some exciting experiments include:

  • Time-weighted average market maker (TWAMM)

  • Dynamic fees based on volatility or other inputs

  • On-chain limit orders

  • Placing out-of-range liquidity into lending protocols

  • Custom on-chain oracles, such as a geomean oracle

  • Automatically compounding LP fees into LP positions

  • Internally routing MEV profits to LPs

But in reality, the sky is limited. Because each pool is now defined not only by tokens and fee levels, we will see pools of various colors, shapes, and sizes. The core logic of Uniswap v4 is immutable, just like v3. Although each pool can use its own hooks contract, hooks may be limited to specific permissions determined at pool creation.

We have created hooks contract samples (https://github.com/Uniswap/v4-periphery/tree/main/contracts/hooks/examples) to begin understanding the current framework. We hope developers can come up with new and interesting ways to build functionality we haven’t even thought of yet.

Improved Architecture and Gas Savings

In Uniswap v3, we deployed a new contract for each pool, which made the cost of creating pools and performing multi-pool swaps higher. In v4, we keep all pools in a singleton contract, which will greatly save gas, as swaps will no longer need to transfer tokens between pools in different contracts. Early estimates indicate that v4 has reduced the gas cost of pool creation by 99%. Hooks introduce a world of infinite choice, while singleton allows you to efficiently traverse all of these choices.

This singleton architecture is complemented by a new “flash accounting” system. Instead of transferring assets into and out of pools at the end of each v3 swap, this system only transfers funds based on net balances, meaning a more efficient system can provide additional gas savings in Uniswap v4.

We believe the best design for flash accounting uses “transient storage,” which will be enabled by EIP-1153. This EIP is considered part of the Ethereum Constantinople hard fork and will bring greater gas improvements and cleaner contract design to a variety of applications.

With the efficiency of singleton and flash accounting, there is no longer a need for fee tiers. Pool creators can set them at the level that makes them most competitive, or customize them using dynamic fee hooks. v4 also brings back support for native ETH, which provides additional gas savings.

License and Governance

As always, we believe that core financial infrastructure should be open and transparent. We also believe that the Uniswap community – the people and teams who support, use, and build the protocol – should manage v4 of the protocol, just as they have managed previous versions.

The code will be released under Business Source License 1.1, which restricts the use of v4 source code in commercial or production environments for up to four years, after which it will be permanently converted to the GPL license. As with v3, Uniswap Governance and Uniswap Labs may grant license exceptions.

The fee mechanism for the protocol will also mimic v3. Governance will be able to vote on adding protocol fees to any pool, but not exceeding the upper limit amount.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Market

The Jovial Journey of Starknet: Join the Early Community Member Program and Reap the Rewards!

Great news for fashion enthusiasts! The Starknet Foundation is giving away 50 million STRK tokens in its Early Commun...

NFT

CoinGecko Acquires Zash: Uniting the Forces of Crypto Data and NFT Analytics

CoinGecko's latest acquisition aims to incorporate Zash's valuable NFT data into their API by the second quarter of n...

Market

Block Surge Rockets 16% as Strong Q3 2023 Results Send Shares Soaring!

Fashionista, listen up! Block Inc (NYSE SQ) just announced their Q3 2023 earnings and they have surpassed analysts' p...

Bitcoin

Bitcoin Takes Off, Leaving Financial Industry Stunned

Bitcoin hits year's peak at $44,000 before dipping back to $43,483.

Web3

Animoca Brands Teams Up with AWS and Polygon Labs for the MoonRealm Express Accelerator: Fast Track Your Web3 Dreams!

Exciting news for fashion lovers MoonRealm Express Accelerator now launched thanks to partnership between Animoca Bra...

Bitcoin

Ark Invest Divests Coinbase and GBTC Holdings, Acquires Bitcoin ETFs 📉🤝🚀

Ark Invest made a significant investment of $92 million in the ProShares Bitcoin Strategy ETF (BITO) and also acquire...