Version 4 will allow new features such as custom 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 maker (TWAMM).
Original text: “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 trades, serving not only as public infrastructure, but also as an important component of the crypto ecosystem.
- LayerZero OFT: A Solution for “Unified Interoperability” Among Public Chains
- Osmosis welcomes a major update, what is Supercharged Liquidity?
- Unexpected turn of events in Binance lawsuit: Judge rejects asset freeze, could a settlement with SEC be possible?
As technology and the market evolve, so must the Uniswap protocol, 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 code draft so that v4 can be publicly built and receive open feedback and meaningful community contributions. We expect this to be a process lasting 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 powerful and innovative liquidity method that balances 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, but at the cost 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 operation 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 decentralizing large orders over time through time-weighted average market maker (TWAMM).
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 are located in a single smart contract. We believe that the combination of hooks and singleton architecture creates a very powerful platform – with 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 Customizable 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 create space for customizable liquidity in Uniswap v4, we want to create a way for liquidity pool deployers to introduce code that executes specified operations at key points throughout the lifecycle of a liquidity pool—such as before or after trading tokens, or before or after LP positions change.
Enter “hooks,” plugins that can customize the interaction between liquidity pools, swaps, fees, and LP positions. 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 experiments we’re interested in include:
Time-weighted average market maker (TWAMM);
Dynamic fees based on volatility or other inputs;
On-chain limit orders;
Storing liquidity beyond the range in lending protocols;
Customized on-chain oracles, such as geometric mean oracles;
Automatically compounding LP fees to LP positions;
Internalizing MEV profits to LPs;
But in reality, imagination is the limit. As each liquidity pool is now defined not just by tokens and fee tiers, we will see liquidity pools of all colors, shapes, and sizes. The core logic of Uniswap v4 is immutable, just like v3. While each liquidity pool can use its own “hooks” smart contract, hooks are restricted to specific permissions determined at the time of liquidity pool creation.
We have created an example “hook” contract to start exploring the current framework. We hope developers can come up with new and interesting ways to build features we haven’t even considered yet.
Improved Architecture and Gas Savings
In Uniswap v3, we deployed a new contract for each liquidity pool, which made it more expensive to create liquidity pools and execute multi-pool exchanges.
In v4, we store all liquidity pools in a “singleton” contract, which will save a lot of gas because token trades will no longer need to transfer tokens between liquidity pools held in different contracts.
Initial estimates suggest 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. In v3, the system did not transfer assets into and out of liquidity pools at the end of each exchange, but instead only transferred them on a net balance basis – 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 KanKun hard fork and will bring massive gas improvements and more concise contract designs to various applications.
With “singletons” 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, which provides additional gas savings.
License and Governance
As usual, we believe 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 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 before it transitions to a permanent GPL license. As with v3, Uniswap Governance and Uniswap Labs can 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 protocol fees to any liquidity pool, but not exceeding the upper limit. For more detailed information on the fee mechanism, please refer to the whitepaper.
In addition, according to Bankless interviews, the release of Uniswap v4 is not imminent, and 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 decentralized exchange with the highest trading volume, as the “hooks” can 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 trading pairs, while maintaining its dominance in trading pairs with high trading volume 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 compete more effectively with centralized exchanges by attracting more sophisticated traders to the DEX. This, combined with the wider structural tailwind trend of trading activity moving to the chain after the FTX crash, and the recent regulatory pressure on CEXs such as Binance and Coinbase, may help Uniswap more effectively challenge these competitors.
The DEX/CEX trading volume ratio reached a new all-time high in May before retreating, and when mature, Uniswap v4 seems likely to push this ratio to new heights.
Finally, v4 should help make Uniswap a more composable protocol, as 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 able to build and leverage v4 liquidity more easily than v3, which could bring a plethora of new and interesting applications and spark a wave of DeFi innovation when industry needs it most.
All in all, Uniswap v4 should help drive the industry forward, and while it won’t be launched immediately, DeFi will once again become interesting.
Reference: “What You Need to Know About Uniswap V4”