Coder Social home page Coder Social logo

jmariadlcs / aave-defi Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 390 KB

Project for interacting programmatically with Aave (deposit collateral, borrow assets, repay borrowed assets) from Patrick Alpha's ffc.

JavaScript 26.73% Solidity 73.27%
aave borrow defi deposit mainnet-fork solidity chainlink chainlink-price-feeds

aave-defi's Introduction

AAVE - DEFI ๐Ÿ‘ป

This is a project for interacting programmatically with Aave on a Forked Mainnet and using Chainlink Price Feeds from Patrick Alpha's Free Code Camp course.

The workshop followed to complete this repo is this one.

The repo that we are going to implement is like this one.

PROJECT

Some scripts are created in this project to interact programmatically with Aave on a Forked Mainnet with the help of Chainlink Price Feeds.

Objetives:

  1. Deposit collateral: ETH/WETH โœ….
  2. Borrow another asset: DAI โœ….
  3. Repay the borrowed DAI back โœ….
  4. Fork Mainnet to test the scripts โœ….

CREATE SIMILAR PROJECT FROM SCRATCH

  • Install yarn and start hardhat project:
yarn
yarn add --dev hardhat
yarn hardhat
  • Install other hardhat dependencies:
yarn add --dev @nomiclabs/hardhat-waffle@^2.0.0 ethereum-waffle@^3.0.0 chai@^4.2.0 @nomiclabs/hardhat-ethers@^2.0.0 ethers@^5.0.0 @nomiclabs/hardhat-etherscan@^3.0.0 dotenv@^16.0.0 eslint@^7.29.0 eslint-config-prettier@^8.3.0 eslint-config-standard@^16.0.3 eslint-plugin-import@^2.23.4 eslint-plugin-node@^11.1.0 eslint-plugin-prettier@^3.4.0 eslint-plugin-promise@^5.1.0 hardhat-gas-reporter@^1.0.4 prettier@^2.3.2 prettier-plugin-solidity@^1.0.0-beta.13 solhint@^3.3.6 solidity-coverage@^0.7.16
  • Install ethers dependencies:
yarn add --dev @nomiclabs/hardhat-ethers@npm:hardhat-deploy-ethers ethers
require("hardhat-deploy");
  • Install Aave dependencies
yarn add --dev @aave/protocol-v2
import {ILendingPoolAddressesProvider} from "@aave/protocol-v2/contracts/interfaces/ILendingPoolAddressesProvider.sol";
import {DataTypes} from "@aave/protocol-v2/contracts/protocol/libraries/types/DataTypes.sol";

HOW TO FORK MAINNET

hardhat: {
          chainId: 31337,
          forking: {
              url: MAINNET_RPC_URL,
          },
      },
  • Execute scripts on forked chain:
yarn hardhat run scripts/aaveBorrow.js

REMINDERS

  • If you want to execute solhint to search for potential Solidity errors Execute:
yarn solhint contracts/*.sol
yarn add --dev @nomiclabs/hardhat-etherscan

Then, include inside hardhat.config.js:

require("@nomiclabs/hardhat-etherscan");

Add ETHERSCAN_API_KEY inside .env file.

  • Use Hardhat Gas Reporter:
yarn add --dev hardhat-gas-reporter

Then, include inside hardhat.config.js:

require("hardhat-gas-reporter");
  • Use Solidity Coverage:
yarn add --dev solidity-coverage

Then, include inside hardhat.config.js:

require("solidity-coverage");

In order to execute it:

yarn hardhat coverage
  • Use Hardhat Waffle:
yarn add @nomiclabs/hardhat-waffle

Then, include inside hardhat.config.js:

require("@nomiclabs/hardhat-waffle");

Resources

aave-defi's People

Contributors

jmariadlcs avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.