Author: Daniel Li, CoinVoice
On June 13th, Uniswap released the Uniswap V 4 code draft, which caused a strong shock in the industry and became a hot topic in the past few weeks. As the largest decentralized exchange platform, Uniswap has long occupied over 50% of the on-chain trading share and its trading volume is more than three times that of its second-largest competitor. The launch of Uniswap V 4 will further consolidate its position as the largest DeFi DEX.
In "Our Vision for Uniswap V 4" and "Uniswap V 4 Core Whitepaper" released by Uniswap, Uniswap Labs provides a detailed introduction to customized AMM with Hooks, the Singleton that changes the account framework and order logic, as well as Flash accounting and Native ETH that can greatly reduce gas fees. These innovative features will bring greater freedom, better liquidity, lower fees, and more choices to DEX. At the same time, it injects a catalyst to DEX, which has long been at a disadvantage in the competition with CEX, accelerating the pace of DEX catching up with CEX. This will have a profound impact on the future development of DeFi.
Uniswap leads the development of the entire DeFi industry through innovation
One of the reasons why the upgrade of Uniswap V 4 has attracted the attention of many institutions is the legal dispute between the U.S. Securities and Exchange Commission (SEC) and the largest centralized exchange (CEX), Binance. This has caused concerns among industry institutions about the future development of CEX, while decentralized and censorship-resistant DEX has undoubtedly gained more favor. Furthermore, the most important point is that as the industry leader, Uniswap has set the direction for DEX development with each version it releases, leading to imitation by successors and driving the overall prosperity and development of DeFi. Now, let's take a look back at each historical version of Uniswap.
Uniswap V 1 was the first official version, released in November 2018. It provided trading between ERC-20 tokens and ETH and introduced the automated market maker model for the first time. This model automatically adjusts token prices and liquidity, making token trading faster, simpler, and more cost-effective. This approach has also provided inspiration for many subsequent decentralized exchanges and laid the foundation for the development of the entire DeFi ecosystem. During the same period, SushiSwap, Curve Finance, and Bancor also drew on the practices of Uniswap V 1.
Uniswap V 2 was launched in May 2020, further supporting trading between ERC-20 tokens and introducing liquidity mining mechanisms. It incentivizes liquidity providers to enhance the liquidity of trading pairs. With the liquidity empowerment of V2, projects such as Yearn.finance, AAVE, Compound, and Chainlink also emerged during the same period.
Uniswap V3 was launched in May 2021, introducing the feature of Concentrated Liquidity and Price Limit Orders (PLC). Concentrated Liquidity enables market makers to manage their funds more efficiently, thus increasing their profits and efficiency. PLC allows users to set upper and lower limits for transaction prices according to their needs, enabling finer control over transactions. During the same period, Concentrated Liquidity and BarnBridge both achieved higher efficiency and returns by using Uniswap V3's Concentrated Liquidity and PLC features.
Uniswap V4 is the upcoming new version. Although the specific launch time has not been announced, according to the information released by the project party, Uniswap V4 will be different from the previous V1-V3 versions. It will no longer be a technical innovation from 0 to 1, but a comprehensive subversion of the infrastructure of DeFi. For example, V4 will provide token pools that can be created and managed autonomously, an AMM that can add new features through "hooks," and a contract framework replacing the previous Factory/Pool model, among others. These innovations will further strengthen Uniswap's characteristics as a decentralized trading platform and bring new changes and opportunities to the entire DeFi ecosystem.
Uniswap V4: Four Innovative Mechanisms to Create True DeFi Infrastructure
As an important participant and leader in the DeFi industry, Uniswap has played a crucial role in promoting industry progress and improvement. Uniswap V4 will create an efficient, flexible, and low-cost infrastructure that truly suits DeFi by introducing innovative mechanisms such as Hooks, Singleton, and Flash accounting, providing users with a better trading experience and more opportunities. Now let's take a detailed look at these new features of Uniswap V4.
Hooks
One of the key innovations of Uniswap v4 is the introduction of "hooks", which are essentially external contracts created and defined by developers to handle transaction logic. Through hooks, developers can call external contracts to perform specific operations at specific points in the lifecycle of a liquidity pool, such as creating limit orders before a trade, or adjusting transaction fees after changes in the pool's position.
By adding the functionality of plugins through hooks, Uniswap v4 becomes a customizable liquidity pool platform. This level of customization is not achievable by centralized exchanges. Developers are free to develop various new features, catering to different trading scenarios, and aligning liquidity with the project's own development. Furthermore, this level of customization sparks the imagination and creativity of developers and the community, further increasing the network effect of Uniswap v4 and making it the underlying infrastructure of the entire DeFi ecosystem.
Currently, Uniswap v4 showcases the following hook samples:
Time-Weighted Average Market Maker (TWAMM)
In traditional AMMs, large trades suffer from significant slippage due to price changes during the execution. TWAMM addresses this by splitting large trades into multiple smaller trades, each completed within a specific timeframe. This reduces price fluctuations, decreases slippage, and improves the smoothness of the trading experience, providing users with a better trading experience.
Dynamic Fees
Dynamic fees are calculated based on factors such as asset amounts, trading volume, and volatility in the liquidity pool. When market volatility is low, transaction fees decrease, creating a more competitive trading environment. Conversely, when market volatility is high, transaction fees increase to protect the stability and security of the liquidity pool.
On-chain Limit Orders
Limit orders are implemented through the introduction of a new contract type called the Limit Order Contract, which allows users to automatically execute preset trading orders under specific price conditions. With on-chain limit orders, users can trade more flexibly to meet specific trading needs.
Idle Liquidity Lending
In traditional AMM exchanges, liquidity providers can only deposit assets into liquidity pools to earn trading fees and mining rewards. However, if the liquidity exceeds a certain range, these excess funds may not generate maximum returns and become idle assets. In Uniswap V4, the Idle Liquidity Transfer Contract is introduced to allow excess liquidity to be deposited into lending protocols, improving capital utilization efficiency and increasing sources of income.
Customizable On-Chain Oracle
The customizable on-chain oracle is implemented through the introduction of a new contract type called the Aggregator Contract. The aggregator contract allows users to customize oracle services by selecting different oracle service providers, data sources, and calculation formulas, among other parameters.
Internalized MEV Profit Distribution to LPs
In traditional AMM exchanges, MEV (Miner Extractable Value) profits are usually obtained by miners or other participants, while liquidity providers can only earn income from trading fees and mining rewards. However, by internalizing MEV profit distribution to LPs, liquidity providers can directly benefit from MEV profits, thereby increasing their sources of income and income levels.
Singleton
Singleton is a new contract architecture for Uniswap V4. In previous versions, each liquidity pool corresponds to a separate contract, requiring deployment of a new contract when adding a new liquidity pool. This not only increases deployment costs for developers but also results in transactions spanning multiple contracts, leading to increased gas fees and transaction times. In the Singleton architecture, all liquidity pools are stored in a single contract, significantly reducing the cost and gas fees associated with creating liquidity pools, and improving transaction efficiency.
The advantages of the Singleton architecture are as follows:
Cost reduction: Since all liquidity pools are stored in the same contract, developers do not need to deploy separate contracts for each liquidity pool, thereby reducing development and maintenance costs.
Improved efficiency: The Singleton architecture allows for multi-hop transactions, where users can complete all exchanges with just one contract call, greatly improving transaction efficiency and reducing gas fees.
Scalability: The Singleton architecture makes it easier to add new features and capabilities, allowing for future innovation and providing higher scalability and flexibility for Uniswap V4.
Simplified liquidity position management: In the Singleton architecture, liquidity positions are no longer tokenized but managed by addresses, allowing for simpler and more efficient management of liquidity position data.
Flash Accounting
Flash Accounting is a new accounting method introduced on top of the Singleton contract architecture. In previous versions, each transaction required calculating the balances of all relevant positions, consuming a significant amount of gas and resulting in high transaction costs. The Flash Accounting system calculates transaction fees based solely on the net balance (i.e., the change in balance), reducing gas consumption.
Specifically, the Flash Accounting system leverages the advantage that all liquidity pools in Uniswap V4 are managed by a single contract. When users make transactions, the Flash Accounting system queries the net balance of the current pool (i.e., the difference between buy and sell volumes) and calculates transaction fees based on the user's net balance in the transaction. By only considering the net balance, the Flash Accounting system can avoid calculating the balances of all relevant positions, thereby reducing the gas required for computation.
In addition to reducing gas consumption, the Flash Accounting system can improve cross-pool routing efficiency and further reduce the cost of traversing multiple pools. This feature, combined with hooked contracts, becomes very useful in supporting more complex integrations and innovations, which can greatly increase the number of pools.
Native ETH
The Native ETH in Uniswap V4 refers to the direct trading between Ethereum's native token (ETH) and other tokens during the transaction process. In previous versions, if you wanted to trade ETH for other tokens, you had to first convert ETH to WETH tokens, which required multiple transactions and gas fees, resulting in high transaction costs and low efficiency.
In Uniswap V4, the concept of Native ETH is introduced, allowing direct trading between ETH and other tokens without the need to convert to WETH. This significantly reduces transaction costs and time. At the same time, Native ETH can also enhance liquidity, attracting more liquidity providers to the Uniswap V4 ecosystem and providing traders with better liquidity and prices.
Specifically, Uniswap V 4 adds an ETH pool to its core contract, which is used exclusively for direct trading between ETH and other tokens. When users trade between ETH and other tokens, the system automatically compares the trading volume with the amount of ETH in the pool and calculates the corresponding amount of other tokens based on the ratio. This allows users to directly trade between ETH and other tokens on Uniswap V 4 without the need for cumbersome conversion processes. Therefore, the introduction of Native ETH makes Uniswap V 4 more convenient and efficient, providing users with a better trading experience and further enhancing Uniswap's liquidity and competitiveness.
Uniswap V 4 Could be the Opportunity to Solve the DEX Dilemma
In the digital asset trading market, CEX and DEX are the two main exchange models. Due to long-standing issues such as lack of liquidity, poor user experience, high transaction fees and costs, DEX has been struggling, while CEX has dominated the majority of the digital asset trading market. With the rapid development of DeFi, the challenges faced by DEX have attracted more and more attention. In this context, the release of Uniswap V 4 could be an opportunity to solve the DEX dilemma. Through innovative solutions, Uniswap V 4 plans to improve the situation of DEX in four aspects, and once successful, it will lead to more institutions joining in and collectively promote the complete resolution of the DEX dilemma.
Improving liquidity: Liquidity is one of the core issues of DEX. Uniswap V 4 improves the customizability and liquidity of DEX by introducing features such as Hooks and internalization of MEV profit distribution back to LP. The Hooks feature allows anyone to deploy liquidity pools using custom contracts, making Uniswap's liquidity more composable and scalable, while the internalization of MEV profit distribution back to LP can incentivize more LP to participate in Uniswap liquidity provision, thereby improving liquidity.
Improved User Experience: Uniswap V 4 introduces the TWAMM algorithm and limit order trading feature, which enhances price discovery efficiency and user trading experience. The TWAMM algorithm calculates prices based on time-weighted average, reflecting a more accurate market price. The limit order trading feature allows users to set upper and lower price limits, better controlling trading risks. These features improve user experience and attract more users to participate in DEX trading. Additionally, deploying liquidity pools through custom contracts using Hooks caters to different user needs and greatly enhances user experience.
Reduced Transaction Fees: Transaction fees are one of the most important factors for users when choosing an exchange. Uniswap V 4 reduces transaction fees through mechanisms such as internalized MEV profit distribution to LPs using hooks and flash swaps. Internalized MEV profit distribution increases LP income, thereby reducing user transaction fees. Flash swaps lower the cost of frequent trading, providing users with lower transaction costs and higher efficiency.
Improved Cost Efficiency: Uniswap V 4's Singleton architecture sets all LP contracts as a single contract. This not only reduces gas fees for creating LPs and multi-hop trades but also significantly improves contract deployment efficiency. Coupled with flash swaps to reduce the cost of frequent trading, Uniswap V 4 helps users achieve maximum benefits or value at minimal cost while providing a better foundation for the sustainable development of DEX.
Summary
Uniswap is one of the key pioneers in the DeFi industry, continuously introducing innovative mechanisms to drive the overall industry's development. Uniswap V 4, as the culmination of these innovations, is undoubtedly a significant innovation for the DeFi industry and the entire crypto industry. Uniswap V 4 empowers users with greater freedom, higher liquidity, lower fees, and more comprehensive and convenient services. These advantages make Uniswap V 4 a more competitive trading platform while driving progress and improvement in the entire DEX industry.
Although there is currently a significant gap between DEX and CEX in terms of user experience, cost, and security, this gap is gradually narrowing with the continuous updates and improvements of the Uniswap version. It is believed that in the near future, Uniswap V4 will play a more important role in the competition between DEX and CEX, becoming a liquidity growth engine for the DeFi industry and leading the direction of the entire industry's development.