In the past year, the Ethereum DeFi ecosystem has exploded. The amount of locked-up funds has exceeded 14 billion U.S. dollars, which is more than 20 times more than last year. At the same time, the hidden risks are also exploding at an accelerated rate.
In this article, it analyzes the current basic structure of the DeFi industry and provides readers with a framework to think about how to manage the three major risks in DeFi, including collateral risk, oracle risk, liquidation risk, and 8 of these risks The solution idea is of considerable reference value in the DeFi industry where security accidents frequently occur.
The development of DeFi has benefited from the catalysis of liquidity mining. Now users only need to provide liquidity to AMM (Bancor, Curve, Uniswap), lend assets on loan market agreements (Compound, Aave, Super Trister and Cream), or through Profitability optimization agreements (Yearn Finance, Harvest Finance, etc.) deposit tokens, and you can get attractive benefits.
To a certain extent, this is determined by the combinability between the protocols. Composability is defined as: "If the existing resources of a platform can be used as components and programmed into higher-level applications, then the platform is composable. The reason why composability is important is that it allows developers Do more with fewer resources, which in turn can lead to faster and more complex innovation."
In fact, now DeFi users can use ETH as collateral, and then create DAI, circulate through Tornado.Cash, exchange USDC on Curve, and bet on election contracts on Polymarket. This is an amazing scenario. The network effect of the DeFi ecosystem is very powerful, but this compound innovation is not without risks.
Specifically for DeFi, the risk will also increase with the compounding of innovation. In this article, we will explore the dependencies of the entire DeFi ecosystem and how several key levels support the entire ecosystem. If there is a problem at any one of these levels, DeFi as a whole will collapse.
To clarify the risks that investors bear through "income farming", the only effective way is to understand the dependencies hidden in the DeFi stack and derive potential risks from them. To do this, you must understand the layers in the DeFi stack.
In order to better understand these risks and dependencies, we divide the DeFi stack into six different levels:
Disassemble the DeFi stack
Level 1: Atomic Value Unit
The first layer in the DeFi stack starts with atomic value units.
DAI, ETH, lending market tokens (cTokens and aTokens), centralized custodial ERC-20 tokens, linked assets and stablecoins (USDT, USDC, WBTC), and the LP share of the AMM pool, which are mainly used as derivatives and loans Mortgage with leverage is used in the DeFi protocol and represents the beginning and end of a complete transaction life cycle.
The risks of DAI and Tether are different. The main risk of DAI is that the Maker system crashes and DAI loses its linked assets. The main risk of Tether is the adverse situation in the bank account where the U.S. dollar backing USDT is stored. All centralized custody assets such as WBTC and USDT face binary risk, because if BTC is hacked or the market finds that Tether's U.S. dollars do not actually exist in bank accounts, their value may plummet.
Both parties will introduce key risks at the bottom of the inverted pyramid of DeFi stacking. Whether it is a bug or a smart contract failure, if any atomic value unit is shaken, any system that uses them will be affected, no matter how good its code is.
Layer 2: Transaction layer
It is not enough to be able to cast atomic value units. Whether it is a human or a robot, DeFi users must be able to conduct on-chain transactions, which is the second layer of the DeFi stack.
With the popularity of DeFi protocols, they become part of increasingly complex DeFi systems. The DeFi protocol relies on external transactions to run smoothly, including tracking and storing collateral balances, measuring mortgage fund ratios, processing oracle prices, performing liquidation, allocating rewards for contributors, issuing deposits, etc. These services consume a lot of gas fees, and therefore require sufficient Layer 1 or Layer 2 capabilities. Therefore, we have identified "transaction processing capability" as the core element of the DeFi stack.
Although this seems to be an inevitable result, it is not. The high gas fee of Ethereum illustrates the cost of transactions. Assuming that users and robots cannot trade on the chain, clearing, margin call operations, etc. cannot be processed, which creates a systemic bankruptcy risk in the entire DeFi ecosystem.
Trading capabilities have been improved in many ways. Projects like Solana are innovating at the Layer 1 level to optimize the cost of throughput, latency, and gas fees to achieve better performance than the current state (50,000 TPS, sub-second latency, and close to $0 transaction fees). Projects such as SKALE, StarkWare, and Optimism are building layer 2 solutions to expand on Ethereum.
Level 3: Price prediction
On the basis of the transaction layer, the oracle quotation is the basis of the next infrastructure. The input of secure and verifiable market data is essential to the operation of the DeFi protocol. The isolated design of smart contracts based on off-chain data means that a centralized oracle may introduce a single point of failure for the entire system.
The oracle can trigger high-level functional modules, such as liquidation. Coinbase, MakerDAO neutralizer, Chainlink, Band, Tellor, UMA, API3, Compound Open Oracle and Nes are currently the nine most popular oracles.
If Chainlink’s price quotation fails or is misreported, loans on Aave or synthetic assets on Synthetix may be inadvertently liquidated, the DEX median price on Bancor may go off track, and a series of DeFi systems may become solvency within a few seconds Transform into insolvency.
Layers 1, 2, and 3 constitute the core infrastructure of DeFi. On top of this, DeFi entrepreneurs are building a more complex and interoperable financial infrastructure.
Layer 4: DeFi bottom layer products
When most people think of "revenue farming" or pure-use DeFi applications, they think of DeFi underlying products. DeFi underlying products include:
1) Loan agreement: Compound, Aave, Cream, bZx, Yield, Notional, Mainframe, Super Trister
2) AMM trading platform: Curve, Uniswap, Balancer, Bancor, mStable, BlackHoleSwap, DODO, Serum Swap
3) Order book trading platform: 0x, IDEX, Loopring, DeversiFi, Serum
4) Derivatives trading platform: MCDEX, Perpetual Protocol, DerivaDEX, Potion, Opyn, Synthetix, dYdX, Pods, Primitive, BarnBridge
5) Asset management platform: Set, Melon, dHEDGE
These underlying products are considered to be a network, not a stack, because these products are not necessarily superimposed on each other in a specific order. Each product can be used independently or together with other products, whether it is on this layer of the DeFi stack or on a lower layer. To give a few examples:
1) cToken (layer 1) is used as collateral in Curve (layer 4).
2) The user can borrow from Aave and deposit the asset in Uniswap. Or users can deposit assets in Uniswap, and then use Uniswap LP shares as collateral for Aave.
Here are some examples of how DeFi bottom-layer products use 1-3 layers of development:
1) DAI supports all open rights and interests on Augur, and is the collateralized token of many stablecoin pools on Curve.
2) Aave relies on Chainlink’s oracles to accurately issue and clear crypto-backed loans.
3) Lending agreements and non-custodial derivatives agreements (Compound, Aave, etc.) require Keepers to be able to send transactions to clear positions. When the Ethereum network is blocked, positions with low mortgage rates will be liquidated quickly, as MakerDAO proved in the 312 crash.
Layer 5: Aggregator
The aggregator is active on top of DeFi's underlying products. This layer consists of supply-side and demand-side aggregators, including:
1) Supply-side aggregator: Yearn Finance, RAY, Idle Finance, APY.Finance, Harvest Finance, Rari Capital
2) Demand-side aggregator: 1inch, DEX.ag, Matcha, Paraswap
3) Aggregator of the aggregator: yAxis
4) New aggregators: Swivel Finance, Benchmark
The layer 5 protocol aggregator does not custody mortgage assets. These products usually provide smart contract construction to enable users to interact with other Ethereum DeFi protocols. Aggregators have surged in popularity because they are good at one thing: making money.
However, investors must consider the risks of this layer of the protocol stack. If any underlying product agreement fails, the user may lose part or all of the funds. This is because many aggregators such as YFI utilize multiple underlying protocols, so the user is responsible for all the underlying protocols used in turn by the project vault. risk.
On the positive side, the demand-side DEX aggregator is the safest, and there is no such risk, because they do not hold funds, but only perform atomic transactions within the block.
Layer 6: Wallet and front end
The wallet and front end are on top of all DeFi, here are some examples:
1) Repeaters: Tokenlon, Dharma, PoolTogether, Guesser
2) Wallets: MetaMask, Math, imToken, Bitpie, Exodus, Trust Wallet
3) DeFi local front end: DeFi Saver, Zerion, Zapper, Argent, Instadapp
The role of wallets, repeaters, and front-ends is to enhance the user experience of DeFi. They do not compete in financial or technical structures, but in design, customer support, ease of use, and localization. Their main business is to acquire users.
We subdivide these projects by function. For example, repeaters provide a front-end for a specific protocol (for example, Guesser is the front-end of Augur, and Tokenlon is a 0x-based decentralized exchange). Front-ends like Instadapp and Zapper simplify the process of writing smart contract calls across different DeFi underlying products.
DeFi risk management
Today the DeFi market is increasingly risky. Paradigm partner Arjun Balaji described this phenomenon incisively in a tweet: "The risks of DeFi are increasing exponentially, including contract errors, poor protocol parameterization, congestion on the chain, oracle errors, administrator robots/ LP fails, and the combinability and leverage ratio of the contract further amplify the risk."
Curve's sUSD pool is one of the most popular "revenue planting" opportunities in the near future. Users deposit one or more stablecoins in the pool and pledge their LP tokens to Synthetix's Mintr platform to obtain SNX rewards.
Each stablecoin in the Curve pool has specific risk characteristics (the peg of DAI is composed of Maker's governance, oracle and liquidator, and the value of USDT depends on the collective trust in Tether's reserves). The construction of the stablecoin pool reduces the impact of any stablecoin value collapse on the coin holders, and also supports the pegged value of each stablecoin.
However, the collapse of any stablecoin will still have an adverse effect on other stablecoins in the pool, which will have an adverse effect on all agreements that rely on this pool (such as the instability of the Synthetix debt pool). This is the double-edged sword of Ethereum's composability. Its easy integration promotes breakthrough innovation, but the risk has multiplied in lock-in.
Let's take a look at some huge potential risks in the DeFi market. At present, the value of 11.4 billion US dollars is locked in the head DeFi agreement (Uniswap, Compound, Aave, Balancer, Curve, Super Trister, MakerDAO, etc.). Of the 11.4 billion US dollars, DAI accounted for 9% (US$1 billion) of the locked value, USDC accounted for 24% (US$2.8 billion), renBTC accounted for 3% (US$308 million), and WBTC accounted for 17% (US$2 billion). If any stablecoin prices deviate from their pegged value, a series of liquidations, bankruptcies and price fluctuations are likely to occur.
Among the five major synthetic asset platforms sorted by locked asset value, Chainlink provides key functions for three of them. Among them, Synthetix's debt pool has 126 million US dollars, which is based on the price of SNX and all generated synthetic assets (fully guaranteed by Chainlink).
Synthetix suffered an oracle attack on June 25, 2020, in which the sKRW (synthetic Korean won) feed price returned an incorrect value, creating an opportunity for arbitrage robots and withdrawing about 37 million sETH from the system at a low price (Although in the end the attacker returned the funds after negotiation).
The price information of the oracle can also be directly manipulated by the user for personal gain. On February 18 this year, an attacker used flash loans to raise the price of Uniswap's sUSD to about $2, providing bZx with sUSD collateral at such an inflated valuation in order to borrow about 2,400 ETH and effectively exit bZx position, and no loss of collateral-all of this is done in one transaction. Since then, oracle attacks have increased, including recent attacks on Harvest, Value DeFi and other projects.
Only between Synthetix, Aave and Nexus Mutual, Chainli