Schlagwortarchiv für: DAI

Ameen Soleimani – 8 min read

You’ve probably heard of Compound. They built compound.finance on Ethereum which allows you to lend and earn interest on your ETH, DAI, USDC, and several other ERC20s.

Today, the interest rate offered to DAI lenders is 10%, which is high enough to turn EthHeads’ heads (see cover photo).

As the CEO of SpankChain, it’s my job to manage the company reserves, which also includes nearly half a million DAI. At 10% annual interest, that’s ~$4,000 per month that we’re leaving on the table by not moving our DAI into Compound. That’s quite the opportunity cost. But the thing to remember when investing is that there is no free lunch. All investments have their risks and lending on Compound is no exception.

I spent some time over the last month evaluating several categories of risk when lending on Compound:

  1. Contract Security Risks
  2. Centralized Points of Failure
  3. Bank Run Risk

I break my investigation down by category below, but the most important things to know are:

  1. The smart contract security seems legit.
  2. Compound is a CUSTODIAL system, all lending pools can be trivially drained if their admin private key is compromised.
  3. When you lend on Compound, you are NOT guaranteed to be able to withdraw whenever you want. If you try to withdraw your funds and all the money is locked up in outstanding loans, your withdrawal transaction will fail.

I hope these lenders understand the risks… source: https://defipulse.com/compound

Contract Security

Compound has been audited by several reputable smart contract security firms.

  1. OpenZeppelin Audit Report
  2. Trail of Bits Audit Report
  3. Certora Audit Report

In addition, Compound was offering a private bug bounty of up to $250,000 for critical vulnerabilities (defined as 1% of funds stolen or 10% frozen), and to my knowledge no independent security researchers have been able to claim the bounty.

The contracts have also held $20M+ for over 6 months, $50M+ for over 2 months, and currently hold $100M+. For me personally, the most important metric of contract security is total funds held in contract * time held in contract, and Compound has been secure with quite a large public bounty thus far.

Based on the above factors, I presently believe that the Compound smart contracts are secure.

Centralized Points of Failure

I’m not a smart contract security expert myself, so I enlisted the assistance of the one and only samczsun who famously found a critical bug in the 0x contracts (despite multiple audits from top firms) and was paid $100,000 for it. He had the following to report about centralized points of failure in Compound (emphasis mine):

Weiterlesen

Cryptocurrencies were supposed to destroy the traditional monetary system. Ten years on, where are we?
Bitcoin has been wildly successful, but as a financial game–not as a medium of exchange.

DISCLAIMER: This is not an investment advice or strategy; only an introductory material. If interested in using CDP, you should read more detailed materials involving more detailed descriptions of the liquidation process, fees, etc. Also, always do the math yourself and check your results. Do not trust the provided formulas if you have not checked they apply to your situation. Make sure you understand what you are doing. Be cautious and stay safe.

What is a CDP?

CDP is a Collateralized Debt Position, a smart contract where you store your ETH funds as collateral in order to take out a loan. Maker’s CDP allows you to take out a decentralized loan denominated in DAI stable coin.

As an ETH hodler, why should I care?

Suppose, as a true believer in Ethereum, you have invested all your available fiat into ETH already. Suddenly, there is a market situation such that you would like to “buy the dip” or simply increase your stack of ETH but you cannot since you have no fiat left. Nevertheless, thanks to CDP you can lock your already owned ETH as a collateral, take out a loan in DAI (~USD), and buy more ETH with it. This is called leverage and the principle is the same as margin trading.

What is the catch you are not telling me?

Well, the catch is that you have to repay your money otherwise your CDP gets liquidated and/or you lose your collateral. Please, never let your CDP liquidate! It is way more expensive than repaying.

Can you give an example of a bad loan setup?

Suppose you lock 150 ETH in CDP, Ether price is currently 900 USD. The max collateral/loan ratio of Maker CDP is currently set to 150%. Therefore, you can take out 90 000 DAI (100ETH*price) as a loan. Remember the loan is always in DAI. However, since you borrowed the maximum amount allowed (two-thirds of collateral), your liquidation price is exactly 900. If the price drops to 899.9, your CDP will be liquidated because its collateral is insufficient. Always make sure the liquidation price is sufficiently low.

OK, I see I shouldn’t go too much into debt here. Is that all?

No, there is another case that may arise. Suppose the previous situation, however, you take out only 30k Dai instead of 90k. Since your collateral/loan ratio is now higher, you are protected from liquidation as long as the price of ETH is above the liquidation price of around 300 USD (sounds sufficient). Remember again that the loan is denominated in DAI. If the ETH price goes to 500 USD, nothing changes and you still owe 30k DAI. This may cause issues when investing the borrowed funds. Suppose you invested the whole loan in ETH at the initial price of 900 but now one is worth 500 and you have no other money available. The CDP does not go into liquidation this time. However, you cannot repay the debt and free your collateral (you can partially but it’s still quite bad).

What do you suggest to avoid this?

If you plan to invest the borrowed DAI, never collateralize your entire bag of ETH. Always save an appropriate amount of money (form irrelevant) to be able to pay off the CDP at liquidation prices.

How do I find out how much is “appropriate”?

You need to do the math. I derived some formulas that may be helpful. They apply to the case of leveraging ETH only, i.e. using your bag of ETH to get a loan and invest in ETH again. As have been mentioned, you should have enough ETH left elsewhere to be prepared to repay the debt if the price begins to approach the liquidation price. I assume the purchase of ETH is at the same price as at the time the CDP is opened.

Notation: S = all ETH holdings you have prior to CDP, P = the current price of ETH in USD, LP = your desired liquidation price (yes, this is a parameter you must choose – please be cautious and set it at a safe low level that you consider unlikely to be reached)

Calculating the amount of ETH to deposit as collateral (deposit): D = S/[1-(2LP-2P)/3P]

Calculating the amount of DAI to “draw” from the CDP (loan): L = (2/3) *D *LP

Remember, you must always have S-D amount of ETH available to step in and avoid liquidation of your CDP. That should guarantee you are safe from the liquidation or the need to use additional funds. Nevertheless, it is still possible your investments will not be profitable and you end up losing money.

I am only waiting for the next paycheck and need the funds only temporarily to buy the dip right now. Can I collateralize my whole stack of ETH?

Yes, you can since you know you will get additional funds to repay the debt. However, remember not to go too much into debt to avoid liquidation.

I used the loan to buy ETH. Can I collateralize these funds as well?

Yes, you can but be VERY careful. You’d better do the math right! I would not recommend this since things may get messy and you may lose track of your debt easily.

I want to learn more and maybe get a CDP. What should I do next?

You should check the Maker CDP dashboard (https://dai.makerdao.com/) out and watch their introductory video and terminology guide. There is a couple of advanced things that I omitted and you should look into them (e.g. WETH, PETH). Further, visit the maker subreddit r/makerdao (please read the sad stories of liquidated CDPs) or other of their communities. Make sure you understand what you are doing before creating a CDP. It may be worth it to test the process on the Kovan testnet.

Why did you write this tutorial?

There was no complex material for beginners around that would highlight CDP’s possibilities as well as risks. I hope I introduced the instrument properly and it will get more traction eventually. Also, I am a big fan of the DAI stable coin.

I think there is something wrong in this text or something important is missing.

That is, of course, possible. In such a case, please, comment or pm me. I will be updating this text continuously.

DISCLAIMER: This is not an investment advice or strategy; only an introductory material. If interested in using CDP, you should read more detailed materials involving more detailed descriptions of the liquidation process, fees, etc. Also, always do the math yourself and check your results. Do not trust the provided formulas if you have not checked they apply to your situation. Make sure you understand what you are doing. Be cautious and stay safe.

Source: https://reddit.com