Home

Awesome

<p align="center"> <img src="./extras/defi-playground-logo.png" /> </p> <h1 align="center">DeFi Playground 📈😱🚀</h1>

🙋‍♂️ 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