Evolution of Uniswap: Opportunities and Impacts of V4

Uniswap V4: Evolution, Opportunities, and Impacts

Author: LD Capital

Uniswap V0

Uniswap V1 was launched in November 2018. However, in the year before that, the embryo of Uniswap had already formed. In 2017, founder Hayden left Siemens and friend Karl, who was working at the Ethereum Foundation, comforted him, “Mechanical engineering is a sunset industry, Ethereum is the future.” Under Karl’s guidance, Hayden learned about Ethereum and Solidity, and in November 2017 he created his Proof-of-something (Proof of concept AMM as they named it), which is Uniswap V0. This picture shows what Uniswap looked like at the beginning.

Before the official launch of V1, Hayden was working on V0 in the offices of Balancer and MakerDao. At the end of July 2018, Uniswap officially received a grant from the Ethereum Foundation.

Uniswap V1

On November 2, 2018, the last day of Devcon 4, Uniswap’s smart contract was deployed on the Ethereum mainnet. Only $30,000 of liquidity was deposited as the basic liquidity of the three tokens that day, which could only guarantee a trading depth of $100. Next, uniswap.io and app.uniswap.org/# were deployed online.

In September 2019, Uniswap V1 launched the first liquidity mining project based on ERC-20 tokens. During the V1 period, the trading volume and user base were relatively small. As the first version of the Uniswap protocol, V1 used a mechanism based on automated market makers (AMMs) that allowed users to trade tokens on the Ethereum blockchain without an order book. It adopted a constant product model, that is, x*y=k, where x and y are the balances of the two tokens in the trading pair.

The innovative mechanism of Uniswap V1 allowed users to quickly and conveniently trade tokens without relying on traditional centralized exchanges, laying the foundation for subsequent versions of Uniswap and becoming an inspiration for other AMM protocols. However, in fact, the Uniswap V1 version at that time did not attract many users.

Uniswap V2

Uniswap V2 was released in May 2020. At the same time, in September 2020, SushiSwap began to appear on the stage of the crypto community, attracting a lot of attention and users, which actually made Uniswap truly begin to attract user market attention.

Uniswap V2’s most significant change from Uniswap V1 was the introduction of multiple token pairs to increase trading flexibility, upgrading from ERC-20 only being exchangeable with ETH to supporting ERC-20 to ERC-20 exchanges. Uniswap V2 also introduced significant improvements to the time-weighted average price (TWAP) oracle.

The release of Uniswap V2 solidified Uniswap’s position in the decentralized trading space. It offered more features and flexibility, allowing users to better manage liquidity and engage in more types of trades. Uniswap V2 also contributed to the rapid development of decentralized finance (DeFi) by providing users with an important source of liquidity.

Uniswap V3

Uniswap V3, launched in May 2021, introduced the concept of “Concentrated Liquidity.” It allows liquidity providers to define specific price ranges within a trading pair to achieve more precise price control. This provides liquidity providers with greater trading fee revenue and reduces opportunities for arbitrageurs to take advantage of price differences.

Uniswap V3 also expanded on Uniswap V2’s oracle, optimizing the TWAP oracle’s calculation method and gas efficiency. The V3 oracle can extend data availability for up to 9 days or longer with one on-chain call, while achieving around 50% reduction in gas consumption compared to V2 through TWAP optimization. Simple trades will be about 30% cheaper than V2’s equivalent functionality.

In addition, Uniswap V2 uses a standard 0.3% trading fee, while V3 provides three independent fee tiers: 0.05%, 0.3%, and 1%. This allows liquidity providers to choose the funding pool based on the risk they are willing to take. V3 also introduced the use of NFTs as LP tokens to track liquidity provision, meaning that the provided liquidity is tracked by non-fungible ERC721 tokens.

The release of Uniswap V3 had a significant impact on the DeFi ecosystem. It provided liquidity providers with more choices and better income opportunities, while also increasing transaction efficiency. Uniswap V3 also drove innovation in decentralized trading and led other exchanges and protocols in their efforts to improve user experience and reduce transaction costs. However, passive liquidity providers have been criticized for being squeezed out of fee income by JIT and professional market makers.

Uniswap V4 — Hooks Change Everything

The Uniswap V4 whitepaper was released to the market with full interpretation. The main optimization of V4 includes Hook, Singleton, Flash Accounting, and native ETH. Among them, Hook is the most important innovation of V4. Uniswap V4’s Hook may become the most powerful tool for constructing liquidity, and in the future, the cost of building a DeFi platform and combining liquidity will be greatly reduced.

Hooks

Simply put, the Hooks contract is a contract that calls other smart contracts and executes logic during the transaction lifecycle. These logics can be implemented by user-defined contracts and called at critical moments.

Specifically, the Hooks contract can be called at the following key points:

· onSwap: called when the exchange occurs, can be used to implement custom logic, such as recording transaction information, performing specific operations, or modifying transaction fees.

· onMint: called when liquidity providers add liquidity to the pool, can be used for custom logic, such as recording relevant information of liquidity providers or performing specific operations.

· onBurn: called when liquidity providers withdraw liquidity from the pool, can be used for custom logic, such as recording relevant information of liquidity providers or performing specific operations.

The earlier versions of liquidity pools only allowed developers to customize LP and LP fees, while V4 Hooks allow developers to innovate on the basis of Uniswap’s liquidity and security, allowing developers to set more customized behaviors. Uniswap Labs demonstrated a series of possibilities, revealing the unique features of the product, including:

· TWAMM (Time-Weighted Average Market Maker)

· Dynamic handling fees based on volatility or other values

· On-chain limit orders

· Liquidity deposited in lending protocols outside the range

· Custom on-chain Oracle, such as geomean oracles

· Automatically reinvest LP fees into LP positions

· Built-in MEV (Miner Extractable Value) profit distribution to LP

The relationship between Uniswap V4’s optimization and impermanent loss (IL)

In fact, these optimizations further strengthen the capital efficiency while strengthening the position of Uniswap’s liquidity infrastructure, but the problem of impermanent loss (IL) with concentrated liquidity is still prominent.

Impermanent loss (IL) is an inherent problem in AMM. As long as there is a deviation in the prices of two assets compared to their initial prices, IL will occur. For concentrated liquidity mechanisms like Uni V3 and V4 (as well as other similar liquidity management protocols), the IL problem is more serious due to high Gamma in narrow ranges, and it may be more significant in some scenarios, such as in high volatility markets or when there is low correlation between the assets providing liquidity.

Currently, there are the following ways to solve the IL problem, but they only indirectly alleviate the issue:

· For example, subsidizing using protocol tokens. Liquidity providers can collateralize these tokens together with their liquidity. By collateralizing these tokens, liquidity providers can obtain additional rewards or compensation to offset potential temporary losses. These rewards can be provided in the form of additional tokens or as a portion of the protocol trading fees.

· Implement dynamic fee structure, adjust fees based on market conditions and the level of temporary losses experienced by liquidity providers. Charge higher fees during periods of significant temporary losses and distribute these extra fees as compensation to liquidity providers.

· The platform can establish an insurance fund to compensate liquidity providers for any losses suffered due to temporary losses. These funds are usually raised through various revenue sources within the protocol or contributions from the platform itself.

· Hedging mechanisms (options, etc.), liquidity providers can participate in derivatives or use other financial instruments to hedge their exposure to price fluctuations and mitigate the impact of temporary losses.

· Dynamic asset rebalancing, continuously adjust asset allocation based on price fluctuations and market conditions, aiming to optimize the exposure of liquidity providers and reduce potential losses.

· Price oracle and Time-Weighted Average Price (TWAP): Price oracles and TWAP-based pricing mechanisms can be used to reduce the impact of price slippage on liquidity providers. By relying on more stable and reliable price data, liquidity providers can better understand market conditions and adjust their positions accordingly.

It can be seen that Uni V4’s dynamic transaction fees, more optimized oracle prices, and more LP subsidies (MEV subsidies, automatic reinvestment of fees, etc.) all indirectly compensate LPs for their IL losses to some extent.

Regarding security and contract complexity, Uniswap V4 has the same core logic as V3 and is not upgradable. Although each pool can use its own Hooks smart contract, the Hooks check whether this part of the functionality needs to be called by an external contract. The ability to call external contracts enriches the functionality of Uniswap V4 and allows for more possible combinations, but only within specific permissions determined when the pool is created. If there are too many external contracts that the contract needs to call, it will also incur additional gas fees (so a simple swap may not be cheaper in V4 than in V3/V2), which is the tradeoff of complexity and combination.

Singleton

In Uniswap V3, deploying a separate contract for each liquidity pool increased the cost of creating liquidity pools and executing exchanges across multiple pools. In Uniswap V4, a “Singleton” contract is used to store all liquidity pools, which greatly saves on gas fees, as token trades no longer need to be transferred between different contracts. Preliminary estimates suggest that V4 reduces the gas cost of creating liquidity pools by up to 99%.

Flash accounting

The fast accounting system serves as a supplement to the Singleton. In V4, the system no longer transfers assets into and out of liquidity pools at the end of each exchange, but only on the net balance. This design makes the system more efficient and provides additional gas savings in Uniswap V4.

Native ETH

In previous versions, users actually traded with WETH, and ETH was not a token contract while WETH was a token contract. For Uniswap, ERC20 contracts are easier to integrate, so every time a user swaps, they need to wrap ETH into WETH, which incurs gas waste. V4 has restored support for native ETH, further reducing gas costs.

Uniswap V4’s Potential Impact and Opportunities on Other Tracks

1) Aggregator track

From the perspective of the aggregator market, Uniswap V4 offers better rates, higher capital efficiency and a huge liquidity pool integrated by Singleton, which will attract more trading volume from the aggregator market (1inch, Cowswap).

2) Custom DEX and similar liquidity customization function protocols

It seems predictable that Onchain Limit Orders, customized liquidity distribution, dynamic fees, and other similar function Dexs will be affected, including the LP yield enhanced vault product protocol on Uni V3. These protocols may all face the situation of joining if they can’t beat them and eventually become part of the Uniswap V4 ecosystem. For future DEXs or other DeFi protocols, it may fundamentally change their liquidity construction mode, and Uniswap V4’s Hooks may become the most powerful tool for liquidity construction, greatly reducing the cost of building and combining liquidity for DeFi platforms.

3) CEX

For centralized exchanges, Uniswap V4 may gain more market share from the impacted CEX due to its limit order functionality and decentralized legitimacy. However, in fact, the biggest problem that hinders users from entering DEX instead of CEX is that the speed and efficiency are not as good as CEX. And many times, the early threshold for using DEX and the contract security and other risks sacrificed for decentralization make users bear relatively high costs. In short, low efficiency and poor usability need to be improved and solved by DEFI infrastructure, which V4 cannot effectively solve at present. After solving these two problems, the road for DEX to replace CEX will be smoother.

4)MEV track

When unable to bring benefits to the platform’s core Stake holder (LP&Swapper), MEV and the protocol are opposed.

In the previous several versions, Uniswap V1 did not have any built-in mechanisms specifically designed to prevent or mitigate MEV (Miner Extractable Value), which caused miners or validators to manipulate the transaction order in the blockchain network to obtain additional profits at the expense of user interests.

Uniswap V2 introduced the “price oracle” function to help mitigate MEV. The price oracle is an external price source that provides reliable and tamper-proof asset price information. By relying on the price oracle, Uniswap V2 aims to prevent front-running attacks, where traders manipulate prices to profit from the time delay of block confirmation.

Uniswap V3 introduces several features to mitigate MEV, including the concepts of concentrated liquidity and non-fungible liquidity (NFT LP positions). Concentrated liquidity allows liquidity providers to specify a price range for their liquidity, reducing the risk of price manipulation. NFT LP positions give liquidity providers fine-grained control over their liquidity, reducing the risk of being squeezed out or exploited by arbitrageurs.

In Uniswap V4, the internal MEV allocation mechanism presents opportunities for MEV developers who want to occupy advantageous roles in V4 pools.

5) Oracle track

UniswapV2’s TWAP is an on-chain oracle that can be used to obtain the price of any token already on Uniswap. The main drawback is that it requires off-chain programs to trigger price updates at regular intervals, which incurs maintenance costs.

UniswapV3’s TWAP solves this problem and the storage of trigger data no longer requires off-chain programs to trigger it at regular intervals, but is automatically triggered when Uniswap executes a transaction. In terms of calculating TWAP data sources, UniswapV2 only stores the latest price0CumulativeLast, price1CumulativeLast and blockTimestampLast values. UniswapV3 supports multiple price observers (Oracle Observers) that can obtain price data from multiple sources. This design increases system fault tolerance and price reliability. For example, Uniswap v3 selects different fee rate pools for the same currency pair, and the pool with non-empty and highest liquidity becomes the target pool. It then searches for price data in the pool with the best liquidity as the price source for the oracle.

Uniswap V4’s built-in oracle will be more customized, such as Geomean Oracles, for example, using different oracle price calculation methods for pools with large trading volumes and stable depths (ETH-BTC) and for tokens with poor liquidity such as Blockingir.

Regarding the impact on the oracle track, the manipulation cost of Uniswap’s TWAP oracle is to control the average price of the token over a period of time. In contrast, the manipulation cost of Chainlink is to destroy enough nodes and manipulate the price of the exchange. Therefore, Chainlink belongs to the off-chain oracle, and the built-in oracle of Uniswap V4 will not pose a threat to Chainlink for the time being. For Uniswap’s ecological projects (such as lending, stablecoins, synthetic assets, etc.), participation of off-chain oracles similar to Chainlink is still required.

Summary

Overall, Uniswap V4 is moving towards the true infrastructure of DeFi, and imaginative experiments for developers can take place on Uniswap V4.

For LP, adding liquidity will be more customized and convenient. For users, creating transaction pools will be cheaper and there will be more options. For example, using V2, V3, and V4 each has its own advantages. V2 has simple contracts and cheaper transactions for individual pools; V4 is more complex to construct, but can help users save a lot of gas fees when multiple pools need to be called.

The continuous development of DeFi will lead to continuous optimization of liquidity management. For project parties, Uniswap V4’s Donate() function can help project parties bribe liquidity to achieve liquidity management goals. In addition, Uniswap V4’s Hook may become the most powerful tool for building liquidity, and the cost of building DeFi platforms and combining liquidity will be greatly reduced.

The future DeFi landscape will also undergo significant changes with the release of V4. The V4 code has not yet been finalized and audited, so there is still some time before it is formally released, which is a window for many protocols to develop their own liquidity and adjust their development direction.

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

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

The compliance exchange is about to appear in Singapore?

On December 18, 2019, the official website of the Monetary Authority of Singapore (hereinafter referred to as "M...

Market

FTX may be approved to liquidate $3.4 billion worth of tokens this week. What impact will it have on the market?

FTX may obtain court approval for asset liquidation on September 13th. Under the pressure of 3.4 billion sell-off, th...

Blockchain

New gameplay? A rubbish currency exchange where everyone can use the currency

BlockBeats learned that the Shitcoin.market was officially launched on August 14. This is a decentralized trading pla...

Opinion

Amazon's participation and the skyrocketing value of AI company Anthropic become FTX's biggest hope of repaying the debt?

FTX previously invested $500 million as a lead investor in Anthropic's Series B financing round, so the expected appr...

Blockchain

Decentralized exchange Newdex strength to play "fake"

From the earliest decentralized exchanges in the EOS ecosystem, it has grown and steadily occupied the top spot of EO...

Blockchain

ChainNode Live Room | Derivatives track has become an industry consensus. Bitcoin will be up to $ 20,000 in the year?

Since the beginning of this year, the trading platform has frequently acted, causing one after another "destruct...