What new features does Uniswap V4 have?

HaydenAdams
2023-06-14 09:22:24
Collection
v4 will allow for new features such as customizing liquidity pools through "hooks," natively supporting dynamic fees, adding on-chain limit orders, or dispersing large orders through time-weighted average market makers (TWAMM).

Original: 《Our Vision for Uniswap v4

Author: Hayden Adams

Compiled by: Frank, Foresight News

Two years ago, we launched Uniswap v3, which marked a watershed moment for on-chain liquidity and DeFi. Today, the Uniswap protocol is the largest decentralized trading protocol, handling over $15 trillion in trades, serving not only as public infrastructure but also as a crucial part of the crypto ecosystem.

As technology and markets evolve, the Uniswap protocol must continuously adapt, which is why we are introducing the vision for Uniswap v4, which we believe will unlock infinite possibilities for creating liquidity and on-chain trading.

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

Uniswap v3 adopted a powerful and innovative approach to liquidity, balancing an extremely complex space, with new features achieved at the cost of higher fees and code complexity. For example, v3 established oracles that allow developers to integrate real-time on-chain pricing data, but at the expense of increased trading 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 in v3, or add entirely new functionalities.

For example, v4 will allow for native support of dynamic fees, the addition of on-chain limit orders, or acting as a Time-Weighted Average Market Maker (TWAMM) to disperse large orders over time.

Beyond this customization, the architecture of Uniswap v4 reduces costs and ensures efficiency. It introduces a new "singleton" contract where all liquidity pools reside in a single 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 rapid, 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 events occur, 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 create space for customizable liquidity in Uniswap v4, we want to create a way for liquidity pool deployers to introduce code that executes specified actions at key points throughout the lifecycle of the liquidity pool—such as before or after trading tokens, or before or after LP position changes.

Enter "hooks," which can customize how liquidity 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 of the experiments we are interested in include:

  • Time-Weighted Average Market Maker (TWAMM);
  • Dynamic fees based on volatility or other inputs;
  • On-chain limit orders;
  • Depositing out-of-range liquidity into lending protocols;
  • Customized on-chain oracles, such as geometric mean oracles;
  • Automatically compounding LP fees into LP positions;
  • Internalized MEV profit distribution to LPs;

But in reality, the imagination knows no bounds. As each liquidity pool is now defined not just by tokens and fee tiers, we will see liquidity pools of various colors, shapes, and sizes. The core logic of Uniswap v4 is, like v3, non-upgradable. While each liquidity pool can use its own "hook" smart contract, the hooks can only be restricted to specific permissions determined at the time of liquidity pool creation.

We have created example "hook" contracts to start understanding the current framework. We hope developers can come up with new and interesting ways to build functionalities we haven't even thought of yet.

Improved Architecture and Gas Savings

In Uniswap v3, we deployed a new contract for each liquidity pool, which increased the cost of creating liquidity pools and executing multi-pool swaps.

In v4, we will keep all liquidity pools in a "singleton" contract, which will significantly save gas, as token trades will no longer need to transfer tokens between liquidity pools held in different contracts.

Preliminary estimates suggest that v4 will reduce the gas cost of creating liquidity pools by 99%, with hooks introducing a world of endless choices, and the singleton allowing users to efficiently route to all options.

This "singleton" architecture is complemented by a new "flash accounting" system. In v3, this system did not transfer assets in and out of liquidity pools at the end of each swap, but rather only transferred based on net balances—meaning a more efficient system that can provide additional gas savings in Uniswap v4.

We believe the best "flash accounting" design is to use "transient storage," a feature that will be enabled by EIP-1153. This EIP is viewed as part of the Ethereum Cancun hard fork and will bring significant gas improvements and more streamlined contract designs across various applications.

With the "singleton" and "flash accounting," there is no longer a need to limit fee tiers. Liquidity pool creators can set them to the most competitive levels or customize them using dynamic fee hooks. v4 also restores support for native ETH, providing additional gas savings.

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 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 v4 source code in commercial or production environments for four years, after which it will convert to a perpetual GPL license. Like v3, Uniswap Governance and Uniswap Labs can grant exceptions to the license.

The protocol fee mechanism will also be based on v3, with the governance body able to vote to add protocol fees to any liquidity pool, but not exceeding a cap amount. For more details on the fee mechanism, see the whitepaper.

Additionally, according to a Bankless interview, the release of Uniswap v4 is not imminent, as Uniswap founder Hayden Adams stated on a podcast that the v4 code has not yet been finalized and audited, so it will take some time before the protocol is publicly released.

What Does This Mean for DeFi?

v4 is likely to have a broad impact on Uniswap itself and the entire DeFi space.

For starters, this upgrade should help Uniswap maintain its position as the largest decentralized exchange by trading volume, as "hooks" can enhance the protocol's capital efficiency relative to v3 while being more customizable and saving gas. The latter two features should help Uniswap capture more order flow from DEX aggregators and long-tail asset trading pairs while maintaining its dominance in high-volume trading pairs like ETH/USDC, ETH/USDT, and ETH/DAI.

Moreover, the ability to create more order types (such as TWAP and limit orders) should help Uniswap become more competitive against centralized exchanges by attracting more sophisticated traders to DEXs. This, combined with the broader structural tailwinds of trading activity shifting on-chain after the FTX collapse and the recent regulatory pressures on CEXs like Binance and Coinbase, could help Uniswap challenge these competitors more robustly.

The DEX/CEX trading volume ratio hit an all-time high in May before pulling back, and once matured, Uniswap v4 seems likely to push this ratio to new heights.

Finally, v4 should help make Uniswap a more composable protocol, as Uniswap v3 was known for being difficult to participate in building due to expressiveness limitations and challenges in managing concentrated liquidity positions. Under the "hooks" and "singleton" model, users seem more likely to establish and leverage liquidity in v4 compared to v3, which could lead to a plethora of new and interesting applications and spark a wave of DeFi innovation at a time when the industry desperately needs it.

In summary, Uniswap v4 should help push the industry forward. Although it won't go live immediately, DeFi will once again become exciting.

Reference: 《What You Need to Know About Uniswap V4

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
ChainCatcher Building the Web3 world with innovators