README.md

June 5, 2021 ยท View on GitHub

DeFi Playground ๐Ÿ“ˆ๐Ÿ˜ฑ๐Ÿš€

๐Ÿ™‹โ€โ™‚๏ธ I made this repo to teach myself, "how to do x with y" where "y" is a DeFi protocol.

Requirements

  1. Node.js v14+
  2. Alchemy - Make an alchemy account and set the ALCHEMY_API_KEY environment variable in the .env file
  3. Run yarn to install dependencies
  4. Run yarn test to test the implementations

Compound Finance

Helpful Reading

๐Ÿค” How tos?

  1. ๐Ÿ’ฐ How to deposit a token and get back a interest bearing cTokens?
  2. ๐Ÿ’ธ How to withdraw / cash out your tokens by returning cTokens?
  3. ๐Ÿค” How to earn interest on your token deposits? (Demonstration)
  4. ๐Ÿฆ How to take a loan and borrow tokens after setting a collateral?
  5. โš–๏ธ How to check the balance you borrowed?
  6. ๐Ÿฅณ How to repay the loan?
  7. ๐Ÿ“ˆ How to calculate the exchange rate of cTokens?
  8. ๐Ÿ“ฆ How many underlying tokens does the compound contract holds?
  9. ๐Ÿง How to check the total supply and total borrows of a token?
  10. ๐Ÿ™‹โ€โ™‚๏ธ How to calculate the supply APY and borrow APR of a token?

Aave V2

Helpful Reading

๐Ÿค” How tos?

  1. ๐Ÿ’ฐ How to deposit erc20 token and get back interest bearing aTokens?
  2. ๐Ÿ’ธ How to withdraw/cashout erc20 tokens by returning back aTokens?
  3. ๐Ÿค” How to earn interest on your erc20 token deposits?
  4. ๐Ÿฆ How to set a particular erc20 token as collateral for your loan borrows?
  5. ๐Ÿ’ต How to take a stable interest rate loan against your collateral?
  6. ๐Ÿ’ฑ How to convert your stable interest loan to a variable interest loan?
  7. ๐Ÿฅณ How to repay the loan?
  8. ๐Ÿง How to get user data (ie: total collateral, debt, amount borrowable)?
  9. ๐Ÿง How to get user data (ie: total collateral, debt, amount borrowable)?
  10. ๐Ÿ™‹โ€โ™‚๏ธ How to get the supply APY and borrow APR for a erc20 token
  11. โš–๏ธ How to get the price of erc20 token in ETH from aave oracle?
  12. TBD - Flashloans