Original article: Our Vision for Uniswap v4

By Hayden Adams

Compiled by: Frank, Foresight News

 

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 more than $1.5 trillion in transactions, and serves not only as a public infrastructure but also an important part of the crypto ecosystem.

As technology and markets evolve, the Uniswap protocol must also evolve, which is why we are introducing our vision for Uniswap v4, which we believe will open up endless possibilities for creating liquidity and on-chain trading.

We are now releasing code drafts so that v4 can be built in the open with open feedback and meaningful community contributions. We expect this to be a multi-month process, and you can read open source early versions of Uniswap v4 core and other repositories, read the draft technical whitepaper, and learn more about how to contribute here.

Uniswap v3 takes a powerful and innovative approach to liquidity, balancing an extremely complex space where new features come at the cost of higher fees and code complexity. For example, v3 establishes oracles, allowing developers to integrate real-time on-chain pricing data, but at the cost of increased transaction costs for traders.

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 stages of the liquidity pool’s operational lifecycle. Liquidity pools can make the same trade-offs as v3, or add entirely new functionality.

For example, v4 will allow native support for dynamic fees, adding on-chain limit orders, or acting as a time-weighted average market maker (TWAMM) to spread large orders over time.

In addition to this customization, Uniswap v4’s architecture reduces costs and ensures efficiency. It introduces a new “singleton” contract where all liquidity pools are housed in one smart contract. We believe the combination of hooks and the singleton architecture creates a very powerful platform — fast, secure custom liquidity 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 Liquidity Pools

Each Uniswap liquidity pool has a lifecycle. During the lifecycle of a liquidity pool, several things happen, including users creating liquidity pools with default fee tiers; liquidity being added, removed, or rebalanced; and users trading tokens.

In Uniswap v3, these lifecycle events are tightly coupled and executed in a very strict order.

To make room for customizable liquidity in Uniswap v4, we want to create a way for liquidity pool deployers to introduce code that performs specified actions at key points in the lifecycle of a liquidity pool — such as before or after a token is traded, or before or after an LP position changes.

Enter “hooks”, plugins that customize how liquidity pools, swaps, fees, and LP positions interact with each other. Developers can innovate on top of the liquidity and security of the Uniswap protocol to create custom AMM pools through “hooks” that integrate with v4 smart contracts.

Some experiments we are interested in include:

  • Time Weighted Average Market Maker (TWAMM);

  • dynamic fees based on volatility or other inputs;

  • On-chain limit orders;

  • Deposit excess liquidity into lending protocols;

  • Customized on-chain oracles, such as the geometric mean oracle;

  • Automatically compound LP fees to LP positions;

  • Internalized MEV profits are distributed to LPs;

But in reality, there are no limits to imagination. Since each liquidity pool is now defined by more than just a token and a fee tier, we will see liquidity pools of all colors, shapes, and sizes. The core logic of Uniswap v4 is the same as v3 and is not upgradeable. While each liquidity pool can use its own "hook" smart contract, the "hook" can only be limited to specific permissions determined when the liquidity pool is created.

We created example "hook" contracts to start understanding 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.

Improve the architecture and save gas

In Uniswap v3, we deploy a new contract for each liquidity pool, which makes it more expensive to create liquidity pools and perform multi-pool swaps.

In v4, we will keep all liquidity pools in a "singleton" contract, which will save a lot of gas because token transactions will no longer require transferring tokens between liquidity pools held in different contracts.

Preliminary estimates show that v4 reduces the gas cost of creating liquidity pools by 99%. Hooks introduce a world of endless choices, and singletons allow users to efficiently route to all options.

This “singleton” architecture is complemented by a new “flash accounting” system that, in v3, instead of transferring assets in and out of the liquidity pool at the end of each swap, only transfers are made on the net balance — meaning a more efficient system that can provide additional gas savings in Uniswap v4.

We believe that the best "fast accounting" design is to use "transient storage", a feature that will be enabled by EIP-1153. This EIP is considered as part of the Ethereum Cancun hard fork and will bring large-scale Gas improvements and simpler contract design in various applications.

With "singleton" and "fast accounting", there is no need to limit fee tiers. Liquidity pool creators can set them to the most competitive level or customize them with dynamic fee "hooks". v4 also restores support for native ETH, which saves additional gas.

Licensing 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 govern the v4 protocol just as they have governed previous versions.

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

The protocol fee mechanism will also be modeled after v3, and governance will be able to vote to add protocol fees to any liquidity pool, up to a cap amount. For more details on the fee mechanism, please refer to the whitepaper.

In addition, according to an interview with Bankless, the release of Uniswap v4 is not imminent. Uniswap founder Hayden Adams said on a podcast that the v4 code has not yet been finalized and audited, so it should take some time before the protocol is publicly released.

 

What does this mean for DeFi?

 

v4 may have a wide-ranging impact on Uniswap itself and DeFi as a whole.

For starters, 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 asset pairs, while maintaining its dominance in high-volume pairs like 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 tailwinds of trading activity moving on-chain following the FTX debacle and the recent regulatory pressure on CEXs like Binance and Coinbase, could help Uniswap more effectively challenge these competitors.

The DEX/CEX volume ratio hit an all-time high in May before falling back, and it seems likely that Uniswap v4 will push this ratio to new heights once it matures.

Finally, v4 should help make Uniswap a more composable protocol, as Uniswap v3 was notoriously difficult to build on due to its lack of expressiveness and challenges managing concentrated liquidity positions. It appears to be easier for users to build and leverage liquidity on v4 than on v3 in both the “hooks” and “singleton” models, which could lead to a ton of new and interesting applications and spark a wave of innovation in DeFi at a time when the industry desperately needs it.

All in all, Uniswap v4 should help move the industry forward, and while it won’t be live right away, DeFi will still become interesting again.

参考:《What You Need to Know About Uniswap V4》