Quick Overview of Uniswap V4: Introducing Hook Plugin to Improve Capital Efficiency, Enhancing Architecture, and Saving Gas

Uniswap v4 will allow new features such as customizable liquidity pools through “hooks”, native support for dynamic fees, adding on-chain limit orders, or decentralizing large orders over time through time-weighted average market makers (TWAMM).

Original: “Our Vision for Uniswap v4”

Translated by Frank, Foresight News

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 trading protocol, processing over $1.5 trillion in volume, serving as not only 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’re introducing the vision for Uniswap v4. We believe it will unlock infinite possibilities for creating liquidity and on-chain trading.

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

Uniswap v3 adopted a strong and innovative liquidity approach that balanced an extremely complex space, and new features come at the cost of higher fees and code complexity. For example, v3 established an oracle that allows developers to integrate real-time on-chain pricing data, at the cost of increased trading costs for traders.

Our vision for Uniswap v4 is to enable anyone to make these trade-offs by introducing “hooks” that run contracts at various stages of the liquidity pool operation lifecycle. Liquidity pools can make the same trade-offs as v3, as well as add entirely new functionality.

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

In addition to this customization, the architecture of Uniswap v4 reduces costs and ensures efficiency. It introduces a new “singleton” contract where all liquidity pools reside in one smart contract. We believe the combination of hooks and singleton architecture creates a very powerful platform – fast, secure, customizable liquidity pools and efficient routing across multiple pools.

Uniswap v4 brings rapid and expressive AMM innovation to a powerful ecosystem.

What is Uniswap v4? Hooks and Customizable Liquidity Pools

Every Uniswap liquidity pool has a lifecycle. Throughout the lifecycle of a liquidity pool, several things happen, including users creating liquidity pools using 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 room for customizable liquidity in Uniswap v4, we wanted to create a way for liquidity pool deployers to introduce code to execute specified actions at key points throughout the lifecycle of a liquidity pool – such as before or after trading tokens, or before or after LP position changes.

Enter hooks – these plugins can customize the interactions between liquidity pools, swaps, fees, and LP positions. Developers can innovate on top of the Uniswap protocol’s liquidity and security by creating custom AMM pools through hooks integrated with the v4 smart contracts.

Some experiments we’re interested in include:

  • Time-Weighted Average Market Maker (TWAMM);
  • Dynamic fees based on volatility or other inputs;
  • On-chain limit orders;
  • Putting liquidity beyond the range into lending protocols;
  • Custom on-chain oracles, such as geometric mean oracles;
  • Automatically compounding LP fees to LP positions;
  • Internalizing MEV profits to LPs;

But in reality, the imagination has no limits. With each liquidity pool now defined not only by tokens and fee tiers, we will see liquidity pools of all colors, shapes, and sizes. The core logic of Uniswap v4 is just as upgradable as v3. While each liquidity pool can use its own hook smart contract, hooks are restricted to specific permissions determined at the time of liquidity pool creation.

We’ve created example hook contracts to get started with 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 liquidity pool, which made the cost of creating liquidity pools and executing multi-pool swaps higher.

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

Preliminary estimates suggest that v4 reduces the gas cost of creating liquidity pools by 99%, and the “hook” introduces a world of infinite choice, while the “singleton” allows users to efficiently route to all options.

This “singleton” architecture is complemented by a new “flash accounting” system. In v3, the system did not transfer assets in and out of liquidity pools at the end of each swap, but only 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. The EIP is considered part of the Ethereum Cancun hard fork and will bring massive gas improvements and more concise contract designs to a variety of applications.

With “singleton” and “flash accounting,” there is no longer a need to limit fee levels. Liquidity pool creators can set them to the most competitive level or customize them using dynamic fee “hooks.” v4 also restores support for native ETH, further saving gas.

License and Governance

As usual, we believe that core financial infrastructure should be open and transparent. We also believe that the Uniswap community (people and teams who support, use, and build on the protocol) should manage the v4 protocol, just as they manage previous versions.

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

The fee mechanism will also be based on v3, and the governance department will be able to vote to add fees to any liquidity pool, but not exceeding the upper limit amount. For more detailed information on the fee mechanism, please refer to the white paper.

In addition, according to Bankless interviews, 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 will 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 the entire DeFi ecosystem.

For beginners, this upgrade should help Uniswap maintain its position as the largest decentralized exchange by trading volume, as the “hooks” can improve the protocol’s capital efficiency compared to v3, while being more customizable and saving gas. The latter two features should help Uniswap gain more order flow from DEX aggregators and long-tail asset trading pairs, while maintaining its dominant position in trading pairs with large trading volumes such as ETH/USDC, ETH/USDT, and ETH/DAI.

In addition, the ability to create more order types (such as TWAP and limit orders) should help Uniswap become more competitive in attracting more sophisticated traders to DEXs. This, coupled with the wider structural tailwind trend of trading activity moving from centralized exchanges to the chain following FTX’s crash, as well as recent regulatory pressure on CEXs such as Binance and Coinbase, may help Uniswap more effectively challenge these competitors.

The DEX/CEX trading volume ratio hit a historic high in May, and has since fallen back. Once mature, Uniswap v4 seems likely to push this ratio to new heights.

Finally, v4 should help make Uniswap a more composable protocol. Uniswap v3 is known for being difficult to participate in building due to its lack of expressiveness and challenges in managing concentrated liquidity positions. Under the “hooks” and “singletons” model, users seem to be more easily able to build and leverage v4 liquidity compared to v3, which could bring about a large number of new and interesting applications, and spark a wave of DeFi innovation when the industry urgently needs it.

Overall, Uniswap v4 should help drive the industry forward, and while it won’t be launched immediately, DeFi will once again become interesting.

Like what you're reading? Subscribe to our top stories.

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

Follow us on Twitter, Facebook, YouTube, and TikTok.


Was this article helpful?

93 out of 132 found this helpful

Gambling Chain Logo
Digital Asset Investment
Real world, Metaverse and Network.
Build Daos that bring Decentralized finance to more and more persons Who love Web3.
Website and other Media Daos

Products used

GC Wallet

Send targeted currencies to the right people at the right time.