The name Uniswap is quite familiar to readers and is the project that has always been at the top of the AMM segment from its inception to the present. That success is not due to previous history but mainly thanks to the human factor behind it. They have always followed the market and introduced new technology models to keep up with trends and always listened to users to offer the most optimal products.
Most recently, on June 13, 2023 Uniswap Labs announced the Whitepaper about Uniswap version V4. The version promises to be very friendly to developers so that there are really good new products coming from them.
So what is Uniswap V4? In this version, will Uniswap have any additional advantages to continue growing in the market?
To understand more about Uniswap, you can read the following articles:
- What is Uniswap (UNI)? Uniswap Cryptocurrency Overview
- What is Uniswap V3? Is Centralized Liquidity Changing the Crypto Market
- Uniswap Ecosystem: When Providing Liquidity Becomes a Protocol Strategy
- Series 3: Real Builder in Winter | Uniswap – The True Unicorn Cryptocurrency Ever Produced
- Uniswap V4: Creativity Is Unlimited
What is Uniswap V4?
Uniswap V4 is an AMM that offers scalable and customizable pools. Uniswap V4 introduces two new core technologies, hooks and singleton, to create many useful products that are friendly to developers and end users.
New technologies included in Uniswap V4:
- Hook: Enables anyone to deploy a new centralized liquidity pool with customizable functionality.
- Singleton: Uniswap V4 implements a single contract containing all pools. The singleton model helps reduce the cost of pool creation and multi-hop transactions.
- Flash accounting: Helps calculate so that no tokens are owed to the pool or to the caller at the end of the lock (end of command).
- Native ETH: Native ETH support for pairs with native tokens inside the V4 pool. ETH swappers and liquidity providers benefit from reduced gas costs from cheaper transfers and the elimination of additional bundling costs.
Version V4 of Uniswap, developers can create liquidity-related strategies on Uniswap through hooks. It allows developers to enhance the centralized liquidity model introduced in Uniswap V3 with new functionality. In addition, Uniswap also uses a singleton-style architecture, meaning all pool state is managed in one contract.
No version or technology is perfect, Uniswap V4 is the same, it also has its own advantages and disadvantages. So sometimes it solves this problem but introduces another error or flaw.
Just like the V3 version, the Uniswap Labs team has registered the copyright for the V4 version until 2027. This is quite a long time, so there will be no place for projects that want to Fork Uniswap V4 technology.
Technology Core
Hooks
Hooks are an extension function that Smart Contract developers can deploy to create customizations for the Pool. These hooks enable integrations that create a centralized liquidity pool with flexible and customizable execution.
Hooks can modify group parameters or add new features and functionality. Example functions that can be implemented with hooks include: TWAP, TWAMM, variable fees, MEV internalization mechanism for liquidity providers, etc.
Singleton
Singleton is an architectural style in that all group status is managed in one hcontract. That is, with version V4, liquidity pools are contained in a Smart Contract to solve the problem of liquidity fragmentation and is the basis for applying Flash accounting to simplify transactions through multiple pools.
By bundling all pools in a single contract, this will result in significant gas savings as swaps will eliminate the need to transfer tokens between pools held in different contracts. That means tor because of transferring assets in and out of the pool at the end of each swap in V3, the system only transfers on the net balance.
For example: Swap ETH to DAI as shown above, with version V4, ETH is sent to the first Pool and receives DAI to the last Pool, this process is still done in one call and there is no additional call fee. multiple pools on multiple contracts like version V3.
Flash accounting
Flash accounting is the latest feature in the Uniswap V4 protocol, helping to calculate total profits and updated assets of Pools continuously instead of having to wait until new swap orders are executed. Or you can understand Flash accounting as a calculation function. This feature speeds up profit calculations and improves the reliability of profit data displayed on the Uniswap website.
Flash accounting simplifies complex group operations, such as swapping and adding. When combined with the singleton model, multi-hop transactions will be performed simply. It can be understood that Singleton puts Pools into a Smart Contract, but to calculate input assets and receive them in the final Pool, Flash accounting is needed.
In the current execution environment, the flash accounting architecture is expensive because it requires memory updates at each balance change. That is, in a Swap command, Flash performs calculations through many Pools, there will be many updates, so users have to pay a lot of fees. However, at the end of the transaction these calculated data will no longer be needed, so the calculation of these balances can be performed by temporary storage, as specified by EIP-1153, after a period of time. it will be deleted.
Native ETH
Uniswap V4 is bringing back native ETH in trading pairs. While Uniswap V1 was all ETH paired with ERC-20 tokens, native ETH pairs were removed in Uniswap v2 due to implementation complexity and concerns about liquidity fragmentation between WETH pairs and ETH. Singleton and Flash accounting mitigate these issues, so Uniswap V4 allows for both WETH and ETH pairs. Native ETH transfers are about half the gas cost of ERC-20 transfers (21k gas for ETH and about 40k gas for ERC-20).
Some applications
- TWAMM: is a Time-Weighted Average Market Maker, which splits a large order into many small orders and executes them over a period of time to reduce the impact on the market. price.
- TWAP: Onchain limit orders.
- Dynamic fees are based on volatility or other inputs.
- Custom onchain oracles.
- LP fees are automatically pooled back into the LP position.
- Internal MEV profits are redistributed to LPs.
Pros and Cons of Uniswap V4
Advantage
- Putting Pools into a Smart Contract helps centralize liquidity, reduce price slippage and cheap fees.
- Flash accounting simplifies multi-hop transactions.
- It is possible to develop many new strategies with Hook and take full advantage of liquidity sources.
Defect
- Hooks can also be abused for bad purposes such as appropriating assets in the Pool.
- Complicated technology comes with security risks of Smart Contract.
- Hooks are also only useful with simple strategies.
- When all pools are in a Smart Contract, if a hacker attacks, all assets are at risk of being lost.
Personal Projection
Uniswap has been a monument in the AMM Dex industry, this monument was not built once or with just a single model to achieve, but it is a non-stop development process, always updating new technology. Keeping up with trends and coming up with new ideas helps the entire Defi market develop to this day.
Not stopping there, the introduced V4 version will be a strong improvement in both technology and operation. Especially Uniswap V4 solves the major problems of high fees, liquidity fragmentation and is friendly to developers and end users.
With this version and registration until 2027, it is difficult for other AMM Dexes to compete with Uniswap. On the contrary, other Dexes that focus on solving small problems on Uniswap will be at risk of being swallowed up like Maverick, Mangrove,…
On the other hand, as Uniswap continues to be the largest liquidity pool in Defi, linking protocols that take advantage of it are also motivated to develop. Thereby creating a large ecosystem around Uniswap.
Summary
Uniswap V4 is a quite interesting update with many useful technologies and features. It is both developer-friendly and brings many benefits to users. Uniswap V4 once again affirms that Uniswap is a monument in Defi, very difficult to overthrow.
So I have clarified what Uniswap V4 is? Hopefully this article provides the most comprehensive perspective of Uniswap V4 for readers!