This script uses the Aave Protocol to to deposit a set amount of WETH Tokens into the Lending Pool and then uses it as collateral to borrow a centrain percentage of that amount in DAI Tokens.
- The main script can be found at
./scripts/aaveBorrow.ts
- The addresses of the smart contracts used, as well as other config, can be found at
./helper-hardhat-config.ts
- TypeScript
- Solidity
- Yarn
- Node.js (14.0.0)
- Hardhat
- Ethers
- Aave Protocol
- Chainlink Price Feed
- Alchemy account and API key.
-
Clone the repo
git clone https://github.com/benmoussa96/hardhat-defi-aave.git
-
Change into repo root directory
cd hardhat-defi-aave
-
Install dependencies
yarn
-
Create a
.env
file at the root of the project:MAINNET_RPC_URL=... GOERLI_RPC_URL=... PIVATE_KEY=...
-
Run the script:
yarn hardhat run scripts/aaveBorrow.ts ** OR ** yarn borrow