A few days ago, Uniswap released its V2 plan, but Blue Fox Notes haven’t had time to follow it. After taking a look at it today, we can see that this plan has brought a lot of optimization. It can be seen that Uniswap has learned a lot from the practice of V1 and has developed rapidly, which is also a microcosm of leading DeFi projects, moving forward in constant iterations.
Uniswap V1 proves the possibility of automatic market maker market.
Uniswap provides decentralized token exchange service for people based on Taifang block chain. Uniswap provides a liquidity pool for ETH and ERC20 token exchange, which has the most eye-catching characteristics of decentralization, no license, unstoppable and so on in the current DeFi project.
Of course, in the actual operation process, it is also subject to the problems of throughput and speed of Ethernet Fang, and it has also encountered price manipulation, and its transaction scale is still very small in the whole encryption world. He looks like a small man, but he is still not flexible and fast enough. Even so, Uniswap’s automated liquidity pool model shows its potential.
At present, the overall liquidity of Uniswap has reached more than $34 million, with a peak of more than $91 million; the current daily trading volume has exceeded $2 million, with a peak of more than $39 million. Although there is a long way to go with the centralized exchange, it is a very good achievement as a DEX.
Uniswap v2 has several points of concern:
Time-weighted average price.
Time-weighted average price.
Judging from a series of attacks that occurred some time ago, Uniswap v1 cannot be used as a secure price prediction machine, because its price can change greatly in a short period of time according to its constant product market-making mechanism (Constant Product Market Maker),. This is also where Uniswap has been manipulated and exploited before.
Uniswap v2 decided to change this, first, to maintain its decentralized model, and second, to greatly increase the cost and difficulty of price manipulation. There are mainly two aspects of improvement:
Standard for determining market price.
The market price of token exchange is determined before each block is traded, that is, the last transaction of the previous block shall prevail. This makes it more difficult for the attacker to manipulate the price, and the attacker needs to operate the last transaction in the previous block. in this case, it is difficult to guarantee arbitrage in the latter block. Unless the attacker can achieve “selfish mining” and dig out two blocks in succession, there is almost no guarantee of profit.
Add time weighting.
In addition, Uniswap V2 puts forward the concept of time-weighted average price, which further makes it more difficult for attackers. What is the time-weighted average price?
Uniswap 2 adds the last transaction price of the block to a single cumulative price variable in the core contract, weighted by the duration of the price, such as 17 seconds for some blocks and 15 seconds for others. This variable represents the sum of Uniswap prices per second throughout the contract history.
External contracts can use this variable to track time-weighted average prices at any time interval.
It is achieved by reading the cumulative price of the ERC20 token pair from the beginning to the end of the interval. You can divide this cumulative price difference by the length of the interval to create a time-weighted average price for that period.
In this way, the cost of attacker manipulation will increase with the increase of liquidity and with the increase of the average length of time.
Some time ago, due to the bZx incident, flash loan (flash loan) entered people’s field of vision. The flash exchange of Uniswap mentioned today is different from the flash loan, but it can also smell a similar smell.
The flash of Uniswap V2 allows users to withdraw any ERC20 tokens they want on Uniswap. The key is that there is no upfront cost. After getting these tokens, the user can perform any operation and execute any code on them, only on the premise that the tokens must be returned at the end of the transaction. If it cannot be returned, all tokens will be withdrawn. In this process, a fee of 0.3% is required.
Why is there a demand for flash exchange?
The demand for flash exchange mainly comes from arbitrage scenarios with no upfront costs. Because the trading places of the encryption market are scattered, there is arbitrage space in different trading places. If there are not enough upfront funds, many arbitrage cannot be realized, and many users can only look at the ocean and sigh.
For users who want arbitrage, the value of flash is that it does not need the previous capital requirements, at the same time, it can save a variety of unnecessary transaction steps and complete arbitrage activities more efficiently.
Hayden Adams, founder of Uniswap, gives two examples: one is about DAI arbitrage and the other is about improving trading efficiency.
There are no upfront funds to complete arbitrage.
Suppose the user can exchange $200USD for 1ETH on Uniswap, and then convert 1ETH into 220DAI, on Oasis, then the user can get a profit of 20 DAI. But what should you do if you want to arbitrage if you don’t have DAI, in your wallet?
The flash of Uniswap V2 allows users to extract 1ETH from Uniswap, sell 220 DAI, on Oasis and buy and return 1ETH at Uniswap with 200 DAI. In this process, there is no DAI, in the user’s wallet, but arbitrage is realized by pre-extracting the ETH, on the Uniswap.
The second example is about improving the efficiency of transactions.
It can improve the efficiency of various loan and exchange operations from DeFi projects. For example, when you borrow money from a user from Maker and buy ETH, again from the borrowed DAI, to increase their leverage, the current trading steps are numerous:
1) users save ETH into Maker.
2) Lending DAI from Maker.
3) convert DAI to ETH on Uniswap.
In order to achieve the leverage ratio that the user wants, the user needs to repeat the above steps. It is inefficient to do so. If the user uses flash, you can simplify the steps:
1) extract the number of ETH users want from Uniswap.
2) save the user’s ETH and the ETH extracted from the Uniswap into Maker.
3) lend the desired amount of DAI from Maker.
4) return the DAI to Uniswap, that is, the original extracted ETH.
In this way, the leverage ratio that users need can be achieved in one step, which helps users to get more ETH through Maker.
If the Uniswap pool does not receive enough DAI to redeem the ETH, originally withdrawn by the user, the whole transaction will be restored. That is, similar to flash loans, at the end of the transaction, all withheld tokens need to be paid or returned, otherwise the transaction will be restored.
The Blue Fox Note mentioned the profit model of the DeFi project, that is, how DeFi is sustainable. For more information, please refer to the previous article “Business Model of the DeFi Project: the way to survive” written by Blue Fox. In this article, it is mentioned that the Uniswap team does not issue tokens and does not charge a fee. But for the project to survive, there must be a source of cost.
Uniswap disclosed its charging plan this time. The mechanism of agreement fee is included in Uniswap V2. When the agreement starts, the default fee is 0, and the liquidity provider captures 0.30% of the fee. Once the agreement fee mechanism is turned on, it will charge a fee of 0.05%, while the fee captured by the liquidity provider will become 0.25%.
In other words, Uniswap’s charging plan is no different from what it used to be for ordinary users, while for liquidity providers, the fees it captures have been reduced by 16.67%. This part of the cost is captured by the contributors to the maintenance agreement, including the Uniswap development team, and so on.
The proportion of this fee is hard-coded into the core contract and cannot be tampered with. After the release of Uniswap V2, the decentralized governance process can be deployed to open the charging mechanism.
Based on current transaction volume, Uniswap can generate about $5 million in annual fees, so agreement and ecological contributors, including the project team, can capture about $830000 in costs. If we follow a certain growth rate, it is also possible to capture more than $1 million in fees this year. This cost can be used to support the development of agreements and ecological construction.
In addition to the above, Uniswap V2 also supports ERC20 tokens to form a direct liquidity pool with any other ERC20 tokens. Current liquidity providers provide pools of ETH and other ERC20 tokens when providing liquidity pools. When users exchange between ERC 20 tokens, they do so by routing ETH. Two ERC 20 tokens directly form a liquidity pool, eliminating the need for users to have ETH exposure. For example, DAI/USDC trading pairs can be formed so that users do not have to worry about large price fluctuations. In this way, the transaction friction can be greatly reduced and the efficiency of capital utilization can be improved.
The overall transaction volume of DEX in the encryption market reached US $668 million in March, reaching an all-time high during the trough of the encryption market and an increase of 53% over February. The decentralized trading market has become an important force that can not be ignored in the encryption market.
With the continuous iterative progress of Uniswap and Kyber, there is a high probability that breakthroughs will continue in the future.