{"id":13729441,"url":"https://github.com/0xDaksh/defi-playground","last_synced_at":"2025-05-08T01:32:40.318Z","repository":{"id":143883876,"uuid":"371508340","full_name":"0xDaksh/defi-playground","owner":"0xDaksh","description":"⚡️Playground for DeFi protocols like Compound, Aave, Maker \u0026 Uniswap.","archived":false,"fork":false,"pushed_at":"2021-06-05T14:50:53.000Z","size":1036,"stargazers_count":27,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-24T01:44:14.230Z","etag":null,"topics":["aave","compound-contracts","defi","lending-protocol"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xDaksh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-27T21:27:59.000Z","updated_at":"2024-12-04T18:05:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"30e46019-de45-4c07-adb5-89f98f4b0d5a","html_url":"https://github.com/0xDaksh/defi-playground","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"0xDaksh/solidity-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xDaksh%2Fdefi-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xDaksh%2Fdefi-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xDaksh%2Fdefi-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xDaksh%2Fdefi-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xDaksh","download_url":"https://codeload.github.com/0xDaksh/defi-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252981688,"owners_count":21835467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aave","compound-contracts","defi","lending-protocol"],"created_at":"2024-08-03T02:01:00.282Z","updated_at":"2025-05-08T01:32:39.887Z","avatar_url":"https://github.com/0xDaksh.png","language":"Solidity","funding_links":[],"categories":["DeFi"],"sub_categories":["Cairo"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./extras/defi-playground-logo.png\" /\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eDeFi Playground 📈😱🚀\u003c/h1\u003e\n\n🙋‍♂️ I made this repo to teach myself, \"how to do x with y\" where \"y\" is a DeFi protocol.\n\n## Requirements\n\n1. Node.js v14+\n2. [Alchemy](http://alchemyapi.io/) - Make an alchemy account and set the `ALCHEMY_API_KEY` environment variable in the .env file\n3. Run `yarn` to install dependencies\n4. Run `yarn test` to test the implementations\n\n## [Compound Finance](https://compound.finance/)\n\n### Helpful Reading\n\n- 💽 [Interfaces](./contracts/compound) we use to interact with Compound's contracts\n- ＃ [Addresses](./test/compound/utils/consts.ts#L1) we use to connect to the mainnet deployed contracts\n- ⚡️ Check [Fixtures](./test/compound/utils/fixtures.ts#L25), we use these to setup our tests\n- 📜 Compound Docs for [cTokens](https://compound.finance/docs/ctokens), [Comptroller, ie: controller](https://compound.finance/docs/comptroller)\n\n### 🤔 How tos?\n\n1. 💰 [How to `deposit` a token and get back a interest bearing cTokens?](./test/compound/01_deposits.test.ts#L19)\n2. 💸 [How to `withdraw` / `cash out` your tokens by returning cTokens?](./test/compound/01_deposits.test.ts#L36)\n3. 🤔 [How to `earn interest` on your token deposits? (Demonstration)](./test/compound/01_deposits.test.ts#L65)\n4. 🏦 [How to take a `loan` and borrow tokens after setting a collateral?](./test/compound/02_borrow.test.ts#L22)\n5. ⚖️ [How to check the balance you `borrowed`?](./test/compound/02_borrow.test.ts#L40)\n6. 🥳 [How to `repay` the loan?](./test/compound/02_borrow.test.ts#L45)\n7. 📈 [How to calculate the `exchange rate` of cTokens?](./test/compound/03_prices.test.ts#L20)\n8. 📦 [How many `underlying tokens` does the compound contract holds?](./test/compound/03_prices.test.ts#L39)\n9. 🧐 [How to check the `total supply` and `total borrows` of a token?](./test/compound/03_prices.test.ts#L44)\n10. 🙋‍♂️ [How to calculate the `supply APY` and `borrow APR` of a token?](./test/compound/03_prices.test.ts#L51)\n\n## [Aave V2](https://app.aave.com/markets)\n\n### Helpful Reading\n\n- 💽 [Interfaces](./contracts/aave_v2/) we use to interact with Aave V2 contracts\n- ＃ [Addresses](./test/aave_v2/utils/consts.ts#L1) we use to connect to the mainnet deployed contracts\n- ⚡️ Check [Fixtures](./test/aave_v2/utils/fixtures.ts#L25), we use these to setup our tests\n- 📜 Aave V2 Docs for [Lending Pool](https://docs.aave.com/developers/the-core-protocol/lendingpool), [Price Oracle](https://docs.aave.com/developers/the-core-protocol/price-oracle), [aTokens](https://docs.aave.com/developers/the-core-protocol/atokens) and [FAQs](https://docs.aave.com/developers/glossary)\n\n### 🤔 How tos?\n\n1. 💰 [How to `deposit erc20 token` and get back interest bearing `aTokens`?](./test/aave_v2/01_deposits.test.ts#L20)\n2. 💸 [How to `withdraw/cashout erc20 tokens` by returning back `aTokens`?](./test/aave_v2/01_deposits.test.ts#L45)\n3. 🤔 [How to `earn interest` on your `erc20 token` deposits?](./test/aave_v2/01_deposits.test.ts#L74)\n4. 🏦 [How to set a particular `erc20 token` as collateral for your loan borrows?](./test/aave_v2/02_borrow.test.ts#L26)\n5. 💵 [How to take a `stable interest rate loan` against your collateral?](./test/aave_v2/02_borrow.test.ts#L37)\n6. 💱 [How to convert your `stable interest loan` to a `variable interest loan`?](./test/aave_v2/02_borrow.test.ts#L63)\n7. 🥳 [How to `repay` the loan?](./test/aave_v2/02_borrow.test.ts#L72)\n8. 🧐 [How to get `user data` (ie: total collateral, debt, amount borrowable)?](./test/aave_v2/03_stats.test.ts#L28)\n9. 🧐 [How to get `user data` (ie: total collateral, debt, amount borrowable)?](./test/aave_v2/03_stats.test.ts#L28)\n10. 🙋‍♂️ [How to get the `supply APY` and `borrow APR` for a `erc20 token`](./test/aave_v2/03_stats.test.ts#L38)\n11. ⚖️ [How to get the `price of erc20 token` in `ETH` from aave oracle?](./test/aave_v2/03_stats.test.ts#L51)\n12. TBD - Flashloans\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xDaksh%2Fdefi-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xDaksh%2Fdefi-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xDaksh%2Fdefi-playground/lists"}