DeFi week election 丨 MakerDAO crisis is not eliminated, Uniswap V2 rekindled DeFi hope

After the disaster, the DeFi ecosystem suffered last week, and after entering the new week, hope is also rekindled.

According to the data of Dapp Total, the total value of 36 DeFi application lockups has been calculated at USD 835.59 billion, an increase of 22.65% from the previous week. Of which, the amount of ETH lockups was 3.491 million, a decrease of 189,000 from last week; EOS lockups It was 81.73 million, an increase of 11.213 million from last week. The three items with the highest proportion of locked-up value distribution are: Maker, EOS REX, and Edgeware, accounting for 34.13%, 21.61%, and 11.35%, respectively.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

MakerDAO completes debt auction, but community still faces tough decision

During the blood disasters on March 12 and March 13, MakerDAO suffered an unprecedented blow. More than $ 8 million of Ethereum collateral was photographed by the 0 Dai liquidation order. Since then, the Maker Foundation launched a series of " The "self-rescue" operation includes the first debt auction in history to fill millions of Dai debt holes.

In the debt auctions held last Friday and yesterday, 30 independent bidders totaled 17,630 MKR, and the average auction price was about 246.05 Dai, involving a total of about 4.3 million Dai funds.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

(Data from: duneanalytics)

This also marks the end of the MakerDAO debt auction. It is reported that the auction started at about 10.30 am Eastern Time on March 19, some observers predicted that the auction will end soon, but the actual process is not the case Twenty minutes before the auction started, only two bids appeared. Obviously, there was a big threshold for bidding.

A few days before the auction, the DeFi community also set up a "backup consortium" (composed of members of the Ethereum community, DeFi community, and venture capital base) that attempted to act as the final buyer when the bid price was below 100 DAI.

But apparently, there was no chance of picking up.

Although the auction has been successfully completed, this is only a capital reorganization of the MakerDAO system, and those victims who have been liquidated by 0 DAI have still not been compensated. On this issue, the Maker Foundation is still discussing.

MakerDAO Black Swan claim form rejected by Nexus Mutual

Some MakerDAO investors who have suffered financial losses due to liquidation have put their hopes on the insurance application, but the reality is still cruel. The insurance application Nexus Mutual recently disclosed that after receiving a large number of claims, its members finally decided to reject these claims. The reason is that the incident is not related to smart contracts.

According to the voting data, 16 MakerDAO claims were rejected, and a total of 99.96% of the votes rejected the claims. It can be seen that DeFi insurance does not cover all risks. Regarding this issue, the author in the " Lightning Attack or New Normal" Should I buy insurance for DeFi? "This article has discussed related issues. The current DeFi insurance products are still very basic, so they are not suitable for large insurance policies.

Uniswap V2 update preview: new price predictor, lightning swap, etc.

In addition to the bad news, there is something new to share.

Uniswap V1, as a proof of concept of a new type of decentralized market, has been recognized by the market and is now the hope of the Ethereum DEX Village.

Last year, the Uniswap team initiated a round of seed projects and formed a team to work with the Ethereum community to develop Uniswap.

Today, Uniswap V2, the second iteration of Uniswap, has finally surfaced. It includes many new features and improvements, including:

1. ERC20 / ERC20 token trading pair

In Uniswap V2, any ERC20 token can directly interact with any other ERC20 token, and in the core contract, the encapsulated ether (WETH) will replace the native ETH, although users can still use the helper contract ETH.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

The introduction of the ERC20 / ERC20 token pool in Uniswap V2 is useful for liquidity providers. One of the best examples is the DAI / USDC trading pair.

2.New price prediction machine

We say that on-chain price information is a key component of many decentralized financial applications (including derivatives, borrowing, margin trading, forecasting markets, etc.), however, Uniswap V1 cannot be safely used as a price predictor because prices may be Will fluctuate significantly within a short period of time.

And Uniswap V2 has realized new functions, which can realize highly decentralized and anti-manipulation on-chain price feed. This is achieved by measuring prices when price manipulation is expensive and cleverly accumulating historical data, which enables external smart contracts to create gas-saving Uniswap price time weighted averages at any time interval.

It is reported that Uniswap V2 has made many improvements to the price prediction machine based on V1. First, before any transaction is made, each pair measures (but does not store) the market price at the beginning of each block. Manipulating the price is expensive because it is set by the last transaction in the previous block.

In order to set the measured price to a price that is not synchronized with the global market price, the attacker must make a bad transaction at the end of the previous block, which usually cannot guarantee that they will arbitrage it in the next block. Attackers are likely to lose money unless they can "selfishly" mine two blocks in a row, and this type of attack presents many challenges that have not yet been discovered.

This alone is not enough. If considerable value is generated based on this mechanism, the profit of the attack may still exceed the loss.

To address this concern, Uniswap V2 adds the end-of-block price to a single cumulative price variable in the core contract, which is weighted by the amount of time that price exists. This variable represents the sum of Uniswap prices per second in the entire contract history.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

External contracts can use this variable to track accurate time-weighted average prices (TWAP) at any time interval.

This is done by reading the cumulative price from the ERC20 token pair at the beginning and end of the interval. You can then divide this cumulative price difference by the length of the time interval to create a TWAP for that period.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

TWAP can be used directly or as a basis for moving averages (EMA and SMA) as needed.

Some notes:

  1. For 10-minute TWAP, samples were taken every 10 minutes. For a week of TWAP, take samples every week;
  2. For simple TWAP, the manipulation cost increases with liquidity on Uniswap (approximately linear), and also increases with the average time (approximately linear);
  3. The cost of the attack is relatively easy to estimate. Moving 5% of the price in TWAP for 1 hour is approximately equal to the amount of arbitrage loss and the cost of moving 5% of the price of each block within 1 hour;
  4. When using Uniswap V2 as a price oracle, there are some nuances worth noting, especially when it comes to manipulation resistance. The white paper details some of these issues.

3. Flash Swaps

The recent lightning attack has made us realize the magic of flash loans, and Uniswap V2's new Flash Swaps feature allows you to withdraw any ERC20 tokens you want on Uniswap. Without paying upfront fees, and performing whatever you want (execute arbitrary code) on them, at the end of the transaction execution, you can:

  1. Pay for all withdrawn ERC20 tokens;
  2. Pay a certain percentage of ERC20 tokens and return the remaining assets;
  3. Return all withdrawn ERC20 tokens;

The liquidity provider's fee is enforced by subtracting 0.3% from all input amounts, even if the input ERC20 tokens are returned as part of a lightning swap.

DeFi周选丨MakerDAO危机未除,Uniswap V2重燃DeFi希望

The flash swap feature is very useful because it eliminates the up-front capital requirements and unnecessary operation order constraints of using Uniswap multi-step transactions.

An application example is arbitrage without upfront capital. Imagine a scenario: you can exchange 1 ETH for 200 DAI on Uniswap, and then sell 1 ETH for 220 DAI on Oasis to make a profit of 20 DAI, but Unfortunately, there is no DAI in your wallet.

And through lightning swap, you can withdraw 1 ETH from Uniswap synchronously, sell it on Oasis for 220 DAI, and then use the 200 DAI you just got to pay ETH on Uniswap.

Another use case is to improve the efficiency of borrowing from a loan agreement. In the current environment, this is done through the following process:

  1. Add user ETH to Maker;
  2. Borrow DAI from Maker;
  3. Exchange DAI for ETH on Uniswap;
  4. Repeat steps 1-3 until the required leverage is reached;

With the lightning swap function, this process is simplified to:

  1. Extract the ETH you want from Uniswap;
  2. Add users and Uniswap's ETH to Maker;
  3. Borrow the DAI you need from Maker;
  4. Return DAI to Uniswap protocol;

And if the Uniswap pool does not receive enough DAI to pay the extracted ETH, the entire transaction will fail, so all ERC20 tokens will be returned or paid at the end of the transaction.

4. Agreement charging mechanism

According to the Uniswap official blog content, the code of Uniswap V2 also includes a small protocol fee mechanism. At startup, the protocol fee will default to 0 and the liquidity provider fee will be 0.30%. If the protocol fee is turned on, then The agreement fee will become 0.05% and the liquidity provider fee will become 0.25%.

This feature, including the exact percentage amount, is hard-coded into the core contract of Uniswap V2.

5.Testnet and official launch time

Although the core smart contract of Uniswap V2 has been completed, it is currently in the formal verification and security review stages, so it is still a while before it is officially launched. According to official statements, Uniswap V2 is expected to be officially launched in the second quarter of this year.

Currently, Uniswap V2 has been deployed in several testnets of Ethereum's Ropsten, Rinkeby, Kovan, and Görli.

Read more here: https://uniswap.org/blog/uniswap-v2/

DeFi good article of the week:

In addition to the above new news and products, last week there were some in-depth thoughts on DeFi worthy of recommendation:

  1. From "Lego Toys" to "Open Finance", DeFi lacks a systematic risk control solution ;
  2. Popular science | Defi in the end-overview, development and future of decentralized lending ;
  3. Ethereum Defi's "Nine Dead and One Life": What exactly did Defi go through last week?
  4. Smart contract risks in defi: what are the risks and how can they be reduced?
  5. What are the lessons from the crisis after the defi frenzy? This prosperous word of life is worth revisiting ;
  6. Multiple risks of distributed financial defi ;