Uniswap is caught in a cross-chain dispute, still, remember this crypto unicorn? (Forerunner)
Cryptobricks Reports
2023-02-20 16:42
订阅此专栏
收藏此文章

Foreword

On April 1, 2023, Uniswap’s commercial source code license will expire. In order to compete for the DeFi market on BNB-Chain, Uniswap needs to seize market share before other competing products go online. However, the community had governance differences in the selection of cross-chain tools, which also exposed the various stakeholders behind Uniswap to the public view, which aroused people’s thinking about its decentralization. As a forerunner, this article will review the historical changes of Uniswap, and help readers further understand this decentralized trading agreement, so as to facilitate the development of subsequent discussions…

The History of Uniswap

Uniswap is the leading decentralized trading protocol on Ethereum. Before that, most of the DEXs were in the traditional order book mode, and there was a bid-ask spread (the difference between the buying price and the selling price) that was often higher than 10%, and because of the gas fee required for placing and canceling orders, market making becomes expensive1. Uniswap was inspired by Vitalik Buterin’s article Let’s run on-chain decentralized exchanges the way we run prediction markets, using x * y = k curve to realize the Automated Market Maker (AMM). Today in 2023, traders have witnessed the credit endorsement of the world’s second-largest cryptocurrency exchange collapse overnight. Looking back at the exploration of decentralization by the Crypto OGs a few years ago, it is still shining brightly.

In November 2018, after receiving funding from the Ethereum Foundation, Uniswap V1 was released at Devcon IV (a global conference for Ethereum builders, creators, and thinkers). Today, it completed the B-round financing of US$165 million at a valuation of US$1.66 billion. As of February 15, 2023, Uniswap accounted for 70.3% of the DEX market within seven days in terms of the trading volume. Uniswap, which has a history of nearly five years, has gone through several forks and challenges of competitors and is still one of the leaders of DeFi.

Protocol Upgrades

Efficiency is economical. — Benjamin

Uniswap V1

The revolution of the Uniswap V1 protocol lies in the introduction of the AMM mechanism. With the decentralized operation on the chain, while canceling the restrictions on user transactions and token listings, it saves the time and resource costs of order matching and provides more possibilities for the capital efficiency increasing for the crypto market.

Uniswap V1 uses x * y = k constant product curve to automatically make the market. The so-called constant product means that under the condition of constant liquidity when only transaction behavior occurs in the liquidity pool, the k value remains unchanged, where x and y represent the quantities of the two tokens in the pool respectively. At this time, there are three types of participants in Uniswap V1 according to the purpose of participation: Liquidity Providers (hereinafter referred to as LP) who pledge tokens to earn transaction fees, Traders who exchange tokens in the pool, and Speculators who carry out arbitrage between fund pools or exchanges.

To understand the agreement abstractly, if Alice’s ETH-USDT pool in Uniswap trades USDT into ETH. Then Alice will inject USDT into the pool and withdraw ETH. According to xy=k, when Alice injects USDT, the amount of ETH in the pool decreases and the price increases. At this time, the ETH price of this fund pool will be higher than that of other fund pools or exchanges, and arbitrageurs will buy ETH from other fund pools or exchanges, and sell ETH in this fund pool until its price is equal to the market price. Each of the three parties takes what they need, and provides capital depth, fee income and market price anchoring for the capital pool respectively.6*

The design of this generation of Uniswap tends to be simple and lightweight in terms of curve design and LP income, but this is also the drawback of this version of the protocol. The lightweight protocol lacks solutions to extreme situations, so MEV attacks on miners And problems such as slippage when dealing with large transactions have not been resolved here. At the same time, this version of the protocol only supports token pairs with $ETH, so it is not only sensitive to price fluctuations of $ETH but also costs two gas fees.

Uniswap V2

Therefore, in May 2020, Uniswap V2 was officially launched to improve the protocol and optimize the user experience in response to the problems of the previous version. Among them, Uniswap introduced the TWAP (Time-Weighted Average Price) oracle machine, which captures Uniswap’s on-chain transactions to calculate the cumulative price, priceCumulative, which is only calculated on the first transaction in each block, so theoretically the highest change frequency of TWAP can only be one block time. If an attacker tries to make a profit in the price fluctuation range, he needs to dig out at least two consecutive blocks, that is, in the previous block smashing/pulling is completed during the last transaction, and arbitrage transactions are carried out in the next block, which greatly increases the attack cost of price manipulation 2. On the other hand, since the price calculation method of TWAP is to capture and weigh the price over a period of time, the price change is smoother, which also reduces the impact of violent price fluctuations to a certain extent.

In addition, the innovation of Uniswap V2 lies in the introduction of wETH to support trading pairs between any ERC-20 tokens, the design of Flash Swaps to allow users to arbitrage at zero cost, and the addition of Protocol Fee to provide the protocol with the impetus for user growth and sustainable development…

Uniswap V3

In May 2021, this crypto unicorn in the DEX field innovated again and started Uniswap V3. The core upgrade of this version of the protocol is to further develop capital efficiency by using concentrated liquidity. The constant product curve of Uniswap allows LPs to invest in Token pairs. In theory, LPs can provide liquidity for the pair of assets in the price range of (0, ∞). However, taking the following figure as an example, when the x - y liquidity pool is at point c, for a price change between [a, b], it is actually only necessary to reserve x_real amount of x and y_real amount of y, and x - x_real and y - y_real are idle assets. If it is a stablecoin pair, most of its transaction prices are basically concentrated in the (0.99, 1.01) range, then if the curve of Uniswap V2 is still applied, most of the capital of LPs will be idle. Therefore, Uniswap V3 introduces the concept of Virtual Reserves, which eliminates the redundant capital of Uniswap V2 while satisfying the constant product curve.

At this time, the constant product curve has actually shifted, and if you want to continue to satisfy the x * y = k curve, you need to use virtual funds to make up for the offset. Set the liquidity as L, P as the price of x in terms of y, k = L², then it follows that:

If L and \sqrt{P} are known, the capital demand x and y is:

Substitute them into point a and point b to calculate the number of virtual funds, and combine with the original constant product curve to obtain the moved curve:

So far, LP can customize the price range [P_a, P_b] to inject liquidity into the protocol, and when a approaches 0 and b approaches ∞, it approaches the original constant product curve. Uniswap V3 transfers the liquidity adjustment of the fund pool to the LP to actively adjust. Through LP’s proactive prediction of the price trend of the token, the funds converge in the market price fluctuation range of the token, which not only improves the capital efficiency of LP but also makes traders able to trade within a field with lower slippage.

However, this version update still brings doubts:

1/ The encryption market is still in the early stage of the industry life cycle, and the overall market is still very fragile. Even stable coins are facing the risk of zeroing. Therefore, concentrated liquidity has greatly reduced the depth of liquidity outside the price range. It is easy to cause liquidity to dry up during violent fluctuations.

2/ Uniswap V3 requires LPs to be sensitive to price changes, and then conduct market-making by correcting the price range, which increases the market-making cost of LPs.

3/ In the Uniswap V2 version, impermanent loss means that when asset prices change, LP-pledged assets will obtain smaller returns and higher risks than directly holding assets. Once the price returns to the initial price at the time of pledge, the loss then drops to 0. However, in Uniswap V3, if the asset price is out of the price range of LP, once LP readjusts the price range, the impermanent loss will be transformed into an actual loss. The loss comes from the fact that when LP adjusts the price range, it buys another rising token with the falling token in its hand to continue pledging with the trading pairs.

In essence, Uniswap V3 redistributes LP income, making LP more specialized in the competition, concentrating capital in the shock range of market prices, optimizing the trading experience of traders, that is, users, and further realizing user retention.

The War to Preempt Users

As an open-source protocol, Uniswap has made such achievements in the DeFi field, but it will inevitably attract the coveted attention of attackers…

Due to the insufficient depth of funds in the newly-built fund pool, this has resulted in higher transaction slippage, which has reduced the willingness of traders to trade in the fund pool. Therefore, the LP income of this fund pool is not considerable enough. Facing more frequent impermanent losses, other LPs are unwilling to continue to inject funds into the project either, which seriously hinders the development of token capital pools for small projects.

Therefore, a new system was born. Compound’s liquidity mining model enables LPs to earn income other than tx fees and obtain governance rights over the project, encouraging LPs to inject liquidity into the fund pool, which ignited the “DeFi Summer “. However, at this time, Uniswap did not respond to this emerging incentive system. Instead, SushiSwap forked Uniswap on Ethereum based on Uniswap’s source code and launched a “Vampire Attack”

In September 2020, the TVL of a forked protocol surpassed Uniswap itself. How did SushiSwap manage to overtake the DeFi Summer, and what kind of butterfly effect does this have with today’s Uniswap governance turmoil?

Follow @CryptoBricks for more on this crypto unicorn in the next post…

CryptoBricks Analyst: Orson, Skyi

Contact us: https://forms.gle/qtb4zRsXanxGUJ62A

References

[1]: https://www.reddit.com/r/ethereum/comments/55m04x/lets_run_onchain_decentralized_exchanges_the_way/

[2]: https://github.com/Uniswap/v2-periphery/blob/master/contracts/examples/ExampleOracleSimple.sol

[3]: https://dune.com/hagaetc/dex-metrics

[4]: https://docs.uniswap.org/concepts/overview

[5]: https://ethresear.ch/t/improving-front-running-resistance-of-x-y-k-market-makers/1281

【免责声明】市场有风险,投资需谨慎。本文不构成投资建议,用户应考虑本文中的任何意见、观点或结论是否符合其特定状况。据此投资,责任自负。

Cryptobricks Reports
数据请求中
查看更多

推荐专栏

数据请求中
在 App 打开