Uniswap V1/V2/V3 AMM market making comprehensive analysis

As the leading decentralized exchange in the DeFi field, Uniswap has taken the lead, stably occupying the top 1 seat in the Dex (decentralized exchange) market.

Before Uniswap, there were still multiple challengers in DEX. Only Uniswap’s original AMM market maker subverted the industry and gained 61% of the overall DEX market share.

Why is Uniswap so successful? The editor analyzes the three versions of Uniswap from the aspects of functions, features, operating mechanism, etc., and analyzes what is AMM automatic market maker?

Uniswap V1 proves the possibility of automatic market maker (AMM)

Uniswap is an Ethereum-based protocol designed to facilitate automatic exchange transactions between ETH and ERC20 token digital assets, and automatically provide liquidity on Ethereum. It has the most eye-catching features of decentralization, permissionless, and unstoppable among the current DeFi projects.

Problems with Uniswap V1

In the actual operation process, Uniswap has also encountered price manipulation due to the throughput and speed of Ethereum.

At the beginning stage, the scale of transactions is still very small in the entire crypto world, and the depth of liquidity is insufficient, which is prone to severe price fluctuations.

Uniswap V2 optimized automatic market maker (AMM)

Uniswap V2 solves the limitations of V1

Due to the limitations of Uniswap V1’s constant product market-making mechanism, there are throughput, transaction depth, and attackers’ stitches. The market is prone to instantaneous extremes such as violent fluctuations. Uniswap V2 decided to change this.

Under the premise of continuing to maintain its decentralized model, V2 aims to increase the cost and difficulty of price manipulation, mainly to improve the following two aspects:

Determine market price balance

The token exchange price is determined before the next block, that is, the last transaction of the previous block is subject to the token market price. Based on this principle, unless an attacker can mine two blocks continuously, it is difficult to guarantee arbitrage in the latter block. The attacker needs to operate the last transaction in the previous block, which greatly guarantees the difficulty of the attacker’s price manipulation.

Uniswap V1/V2/V3 AMM market making comprehensive analysis

External contracts can use this variable to track the time-weighted average price in any time interval

Time Weighted Average Price (TWAP)

Uniswap V2 also proposed the concept of time-weighted average price. By reading the ERC20 token pair from the beginning to the end of the time interval, the cumulative price difference is divided by the duration of the time interval to create the time-weighted average price of the time period.

Uniswap V1/V2/V3 AMM market making comprehensive analysis

For example, some blocks are 17 seconds, and some are 15 seconds. This is its existence time. The weighted average price of the time period is calculated by the principle of time weighting.

What are the new features of Uniswap V2:

Added functions such as ERC20/ERC20 liquidity pool and flash exchange.

On the basis of the ERC20-ETH pool existing in V1, the ERC20/ERC20 liquidity pool is added.

Uniswap V2’s flash swap allows users to withdraw any ERC20 tokens they want on Uniswap. After the users get these tokens, they can perform any operations.

According to the latest official data from Uniswap, the asset liquidity of DEX Uniswap V2 based on the Ethereum blockchain exceeds 4.6 billion U.S. dollars, with nearly 10,000 24-hour trading users. This is an amazing number, comparable to top centralized cryptocurrency exchanges.

New features of Uniswap V3

Compared with V2, Uniswap V3 focuses on maximizing capital efficiency. Uniswap V3’s new automatic market maker (AMM) solution, in addition to the core aggregate liquidity, also brings multi-level rate control, range orders, and historical predictions Machine and other functions.

1. Centralized liquidity optimizes capital efficiency

As we all know, when LP provides liquidity to the V2 pool in the V2 version, the liquidity will be evenly distributed along the price curve. Liquidity will be distributed in all price ranges between 0 and infinity. If most assets are traded within a certain price range, this means that 99.5% of the remaining capital is almost never used, which makes the efficiency of capital quite low .

Uniswap V1/V2/V3 AMM market making comprehensive analysis

Take the stable currency as an example. In the DAI/USDC pool in V2, most of the trading volume is concentrated between 0.99 US dollars and 1.01 US dollars. Then only about 0.5% of the assets in the liquid pool are used, and the remaining 99.5% of the assets are idle. state.

V3 creates a personalized price curve for each liquidity provider. LP can choose a custom price range when providing liquidity. Users need to trade for a combination of liquidity at a certain price, so as to achieve it with the least liquidity. Funds earn transaction fees within a specified range to maximize the utilization of funds.

2. Granularity control, aggregation and liquidity, active position management

Uniswap V3 “XY=K” curve adds “granularity control”, and users can concentrate the capital efficiency in the most frequent trading interval to obtain the maximum benefit.

Providing liquidity within a single price range of 0.1%, V3 can achieve a capital efficiency of up to 4000 times compared with V2. In addition, the V3 pool factory will be able to support a granularity range of 0.02%. Compared with V2, V3 can achieve a capital efficiency of up to 20,000 times.

At the same time, when market conditions fall below or exceed the “granularity control” interval set by the LP provider, LP must provide a single currency for market making. At this time, the liquid assets provided by LP will be sold out of modern currency. Profit, will not earn liquidity transaction fees. In order to ensure the maximum return, active position management and strategy modification are the best choice for LP liquidity providers.

Uniswap V1/V2/V3 AMM market making comprehensive analysis

 Taking the stable currency as an example, suppose LP sets the order “granularity control” within the range of 1.001~1.002. Once the DAI/USDC transaction price is higher than 1.002, the liquidity of the entire LP will be converted into USDC. At this time, LPs must withdraw their liquid funds to avoid automatic conversion back to DAI once DAI/USDC returns below 1.002.

3. Flexible and flexible transaction fee rate non-homogeneous token tracking

The standard 0.3% transaction fee in Uniswap V2, while V3 provides 3 independent fee levels: 0.05%, 0.3% and 1%.

This allows liquidity providers to choose a pool of funds based on the risks they are willing to take, which makes liquidity providers more selective and more demanding on strategies.

Uniswap V1/V2/V3 AMM market making comprehensive analysis

Uniswap V3 will no longer issue homogenized ERC-20 tokens to represent the positions of liquidity providers. Instead, it will provide non-homogeneous tokens (NFT) to represent the positions of liquidity providers, and the liquidity provided will be tracked by non-homogeneous ERC721 tokens.

4. Oracle function to reduce gas consumption

Uniswap V1/V2/V3 AMM market making comprehensive analysis

The time-weighted average price (TWAP) oracle machine introduced by Uniswap V2 is a major improvement. The V3 oracle machine can be called on the chain to extend the data availability period to 9 days or more. At the same time, the overall optimization of TWAP is lower than that of V2. With a gas consumption of about 50%, a simple transaction will be about 30% cheaper than its V2 equivalent function.

Currently, one of the challenges facing V3 is that it may become a little difficult to provide liquidity, especially for less mature users. Choosing a wrong price range may magnify the impact of impermanence. There may be third-party services on the market. With just one-click hosting, it can help users choose the best strategy for allocating liquidity.

Summarize

Uniswap V1 proves the possibility of automatic market maker (AMM). Uniswap v2 optimizes the early shortcomings of automatic market maker (AMM). Uniswap V3 combines the benefits of standard AMM and stable asset AMM, greatly improving capital efficiency.

Every version upgrade will produce new features and give more possibilities for liquidity strategies. More specialized and refined strategies can enable LPs to enjoy greater dividends in the era of decentralized finance.

In the decentralized world of Uniswap, the barbaric growth has just begun. Will it become the end of the DEX competition or a new starting point, we will wait and see!

 

Posted by:CoinYuppie,Reprinted with attribution to:https://coinyuppie.com/uniswap-v1-v2-v3-amm-market-making-comprehensive-analysis/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Leave a Reply