The founder of Uniswap personally explained what is Uniswap V4

Author: Hayden Adams, founder of Uniswap; translation: Golden Finance cryptonaitive

Two years ago, we released Uniswap v3, which was a watershed moment for on-chain liquidity and DeFi. Today, the Uniswap protocol is the largest decentralized exchange protocol, handling over $1.5 trillion in transaction volume. As a public infrastructure, it is an important part of the crypto ecosystem.

As technology and markets evolve, so 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 are releasing code drafts now so that v4 can be built publicly, with open feedback and meaningful community contributions. We expect this to be a months-long process. You can read the open-source early releases of the Uniswap v4 core and peripheral repositories.

Uniswap v3 takes a robust, opinionated approach to providing liquidity, balancing an incredibly complex space of tradeoffs. New features come at the cost of higher expense and code complexity. For example, v3 includes oracles, allowing builders to integrate real-time on-chain pricing data, at the expense of some increased costs for exchangers.

Our vision for Uniswap v4 is to allow anyone to make these trade-off decisions by introducing "hooks". Hooks are contracts that run at various points in the pool's lifecycle. Pools can make the same tradeoffs as v3, or they can add entirely new functionality. For example, v4 will allow the pool itself to support dynamic fees, add on-chain cap orders, or act as a time-weighted average market maker (TWAMM) to spread out large orders over time.

Along with this customization, Uniswap v4's architecture reduces costs and ensures efficiency. It introduces a new "singleton" contract where all mining pools are in one smart contract. We believe the combination of hooks and singleton architecture creates a very powerful platform - fast and secure pool customization and efficient routing across multiple pools. Uniswap v4 brings fast, expressive AMM innovation in a robust ecosystem.

What is Uniswap v4

Hooks and Custom Pools

Every Uniswap liquidity pool has a lifecycle. During the lifecycle of a pool, several things happen. Create pools with default fee tiers; add, remove, or realign liquidity; and of course swap tokens for users. In Uniswap v3, these lifecycle events are tightly coupled and executed in a very strict order.

To create room for customizable liquidity in Uniswap v4, we wanted to create a way for pool deployers to introduce code that would perform specified actions at key points throughout the pool's lifecycle -- such as before or after a swap, or LP position changed before or after.

Hooks are plugins that customize how "pools, swaps, fees, and LP positions" interact. Developers can innovate on top of the liquidity and security of the Uniswap protocol, creating custom AMM pools through hooks integrated with v4 smart contracts.

Some exciting experiments include:

  • Time Weighted Average Market Maker (TWAMM)
  • Dynamic fees based on volatility or other inputs
  • Chain limit price list
  • Deposit out-of-range liquidity into the lending agreement
  • Customized on-chain oracles, such as geomean oracles
  • Automatic compounding of LP fees to LP positions
  • Internalized MEV profit distribution to LP

But in reality, the sky is limited. Because each pool is now defined by more than just tokens and fee tiers, we will see pools of all colors, shapes, and sizes. The core logic of Uniswap v4 is the same as that of v3, which is not upgradeable. While each pool can use its own hooks smart contract, hooks can be limited to specific permissions determined at pool creation time.

We've created sample hooks contracts (to get started with the current framework. We hope that developers will come up with new and interesting ways to build functionality that we haven't even thought of yet.

IZt5dTyWvZhAh5oUjlqYMifKiVbJ9eWdtL6zJLeI.jpeg

Improved Architecture and Save Gas

In Uniswap v3, we deployed a new contract for each pool, which made creating pools and performing multi-pool swaps more expensive. In v4, we keep all pools in a singleton contract, which will greatly save gas, because swap will no longer need to transfer tokens between pools in different contracts. Early estimates show that v4 reduces pool creation gas costs by 99%. Hooks introduce a world of endless options, and singletons allow you to efficiently span all of them.

This singleton architecture is complemented by a new "flash accountin" system. Instead of transferring assets in and out of the pool at the end of each swap in v3, the system transfers only based on the net balance - meaning a more efficient system could provide additional gas savings in Uniswap v4.

We believe the best design for flash computing uses "transient storage", which will be enabled by EIP-1153. The EIP is considered part of the Ethereum Cancun hard fork and will bring greater Gas improvements and cleaner contract designs to various applications.

With the efficiency of singleton and flash calculation, there is no need to limit the fee level. 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.

lUyPbi55vcfKn25pLfHYsQPpsuNIxA9FUST17Iae.jpeg

License and Governance

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

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

The protocol fee mechanism will also be modeled after v3. Governance will be able to vote to add protocol fees to any pool up to a capped amount.

View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Share
Comment
0/400
No comments
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)