BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Uniswap V2: What will Uniswap look like in the future

蓝狐笔记
特邀专栏作者
This article is about 3219 words, reading the full article takes about 5 minutes
New changes to Uniswap.
AI Summary
Expand
New changes to Uniswap.

Editor's Note: This article comes fromBlue Fox Notes (ID: lanhubiji), reprinted by Odaily with authorization.

Blue Fox Notes (ID: lanhubiji)

Blue Fox Notes (ID: lanhubiji)

, reprinted by Odaily with authorization.

A few days ago, Uniswap announced its V2 plan, but Blue Fox Notes never had time to pay attention. I took a look today, and this plan has brought a lot of optimizations. It can be seen that Uniswap has learned a lot from the practice of V1 and has developed rapidly. This is also the epitome of leading DeFi projects, moving forward in constant iteration.

secondary title

Uniswap V1 Proves the Possibility of Automated Market Maker Markets

  • Uniswap v2 has several points worthy of attention:

  • profit model

time weighted average price

Time-weighted average price flash swap

profit model

  • secondary title

time weighted average price

  • Judging from a series of attacks that occurred some time ago, Uniswap v1 cannot be used as a safe price oracle machine, because its price can change greatly in a short period of time according to its Constant Product Market Maker mechanism. . This is also where Uniswap was manipulated before.

Uniswap v2 decided to change this, one is to continue to maintain its decentralized model, and the other is to greatly increase the cost and difficulty of price manipulation. There are two main improvements:

Standards for Determining Market Prices

The market price of token pair exchange is determined before each block transaction, that is, the market price is based on the last transaction of the previous block. This makes it more difficult for the attacker to manipulate the price. The attacker needs to operate the last transaction in the previous block. In this case, it is difficult to guarantee arbitrage in the next block. Unless the attacker can achieve "selfish mining" and dig out two blocks in a row, there is basically no guarantee of profit.

Add time weighting

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

Flash

It does this by reading the accumulated price of the ERC20 token pair from the beginning to the end of the time interval. This cumulative price difference can be divided by the length of the time interval to create a time-weighted average price for that period.In this way, the cost of the attacker's manipulation will increase with the increase in liquidity and the average length of time.》《secondary titleFlash

Some time ago, due to the bZx incident, flash loans came into people's field of vision. For flash swap, you can refer to the previous article of Blue Fox Notes "

Flash Loans: Why Are Flash Loan Attacks the New Normal?

Crypto Flash Loans: The Magical New Invention of Internet Money

". The Uniswap flash swap mentioned today is different from the flash loan, but it can also smell similar.

The flash swap of Uniswap V2 allows users to withdraw any ERC20 tokens they want on Uniswap, the key is that there is no upfront cost. After the user gets these tokens, they can perform any operation and execute any code on them. There is only one prerequisite, that is, the tokens must be returned at the end of the transaction execution. If not returned, all tokens will be withdrawn. In this process, a 0.3% fee is charged.

  • Why is Flash Exchange in demand?

The demand for flash conversion mainly comes from arbitrage scenarios with no upfront costs. Due to the scattered trading venues in the encryption market, there is room for arbitrage in different trading venues. If there is not enough early capital, many arbitrage cannot be realized, and many users can only sigh.

For users who want to arbitrage, the value of flash exchange is that it does not require upfront capital requirements, and at the same time can save various unnecessary transaction steps, and complete arbitrage activities more efficiently.

  • Hayden Adams, the founder of Uniswap, gave two examples: one is about DAI arbitrage; the other is about improving transaction efficiency.

There is no upfront capital to complete the arbitrage.

Suppose a user can exchange 200 USD for 1 ETH on Uniswap, and then exchange 1 ETH for 220 DAI on Oasis, then the user can obtain a profit of 20 DAI. However, if the user's wallet does not have DAI, what should he do if he wants to arbitrage at this time?

The Uniswap V2 flash swap allows users to withdraw 1 ETH from Uniswap, then sell 220 DAI on Oasis, and use 200 DAI to buy and return 1ETH on Uniswap. In this process, the user does not have a single DAI in his wallet, but through the pre-withdrawal of ETH on Uniswap, arbitrage is realized.

The second example is about improving the efficiency of transactions.

It can improve the efficiency of various lending and exchange operations from DeFi projects. For example, when a user borrows money from Maker and buys ETH again with the borrowed DAI to increase its leverage ratio, the current transaction steps are relatively numerous:

1) User deposits ETH into Maker

2) Lend DAI from Maker

3) Exchange DAI to ETH on Uniswap

In order to achieve the leverage ratio desired by the user, the user needs to repeat the above steps. This is very inefficient. If the user uses instant exchange, the steps can be simplified:

1) Withdraw the desired amount of ETH from Uniswap

4) Return DAI to Uniswap, that is, return the originally extracted ETH

profit model

In this way, the leverage ratio required by users can be realized in one step, helping users to obtain more ETH through Maker.If the Uniswap pool does not receive enough DAI to exchange back the ETH that was originally withdrawn by the user, then the entire transaction will be restored. That is, similar to flash loans, at the end of the transaction, all withdrawn tokens need to be paid or returned, otherwise the transaction will be restored.secondary title

profit model

Previously, Blue Fox Notes mentioned the profit model of DeFi projects, that is, how DeFi can achieve sustainability. For details, please refer to the previous article of Blue Fox Notes "

The business model of DeFi projects: the way to survive

". As mentioned in this article, the Uniswap team did not issue tokens nor charge fees. But for a project to survive, there must be a source of expenses.

The distribution ratio of this fee is hard-coded into the core contract and cannot be tampered with. After the release of Uniswap V2, a decentralized governance process can be deployed to enable the charging mechanism.

epilogue

According to the current transaction volume, Uniswap can probably generate an annual fee of about 5 million US dollars, then, the contributors to the protocol and ecology including the project team can capture about 830,000 US dollars in fees. If a certain growth rate is followed, it is also very possible to capture more than US$1 million in fees this year. This fee can be used to support the development of the protocol and the construction of the ecology.

secondary title

epilogue

Uniswap
ETH
Welcome to Join Odaily Official Community