Aave Protocol V2
Go to file
2021-01-07 13:45:18 +01:00
audits - Added Certora report 2020-12-03 18:23:26 +01:00
contracts - Added credit delegation interface to debt tokens. 2020-11-30 18:16:25 +01:00
helpers Prevent to hang if missing address at db json 2020-12-02 10:58:44 +01:00
markets/aave Minor changes to deploy scripts. Fix token verify errors. Added new task for print providers config. 2020-11-30 19:25:06 +01:00
modules/tenderly Added permit domain check test. Update typechain and typescript to support new ethers 5 generated typings. Updated ethers to support _TypedDataEncoder for domain hash. 2020-11-18 19:18:02 +01:00
specs Fixed compilation errors 2020-12-03 17:33:23 +02:00
tasks Prevent to hang if missing address at db json 2020-12-02 10:58:44 +01:00
test Merge branch '181-check-configuration-and-scripts' into 'master' 2020-11-30 20:42:50 +00:00
.editorconfig
.giatattributes Added gitattributes 2020-11-11 11:19:59 +01:00
.gitignore - Unexcluded types/ on contracts libraries 2020-11-24 15:11:02 +01:00
.gitlab-ci.yml Update .gitlab-ci.yml 2020-12-03 15:46:05 +00:00
.prettierignore
.prettierrc Merged master 2020-09-04 10:27:32 +02:00
.solcover.js Fixed coverage random failing tests. Added coverage network and minimal config. 2020-09-09 21:24:20 +02:00
aave-v2-whitepaper.pdf - Added v2 whitepaper 2020-12-03 14:27:12 +01:00
buidler.config.ts Updated solidity version 2020-11-20 11:41:58 +01:00
coverage.json Renamed ChainlinkProxyPriceProvider to AaveOracle 2020-11-17 10:24:24 +01:00
docker-compose.test.yml Test envs 2020-11-20 16:01:00 +01:00
docker-compose.yml Initial implementation of Tenderly plugin 2020-11-12 14:12:26 +01:00
Dockerfile Updated solidity version 2020-11-20 11:41:58 +01:00
Dockerfile_test add test step to CI 2020-08-21 15:11:01 +03:00
hardhat.config.ts Fix README.md steps for mainnet fork. Added console fork mode. Fix infura subdomain in mainnet fork mode. 2021-01-07 13:45:18 +01:00
LICENSE.md
package-lock.json Fix README.md steps for mainnet fork. Added console fork mode. Fix infura subdomain in mainnet fork mode. 2021-01-07 13:45:18 +01:00
package.json Fix README.md steps for mainnet fork. Added console fork mode. Fix infura subdomain in mainnet fork mode. 2021-01-07 13:45:18 +01:00
README.md Fix README.md steps for mainnet fork. Added console fork mode. Fix infura subdomain in mainnet fork mode. 2021-01-07 13:45:18 +01:00
runStableTokenCLI.sh Updated runners 2020-12-03 18:17:31 +02:00
runUserConfigCLI.sh Updated runners 2020-12-03 18:13:22 +02:00
runVariableTokenCLI.sh Updated runners 2020-12-03 18:17:31 +02:00
test-wallets.js
test.log Rolled back PVE002, added further optimization 2020-10-22 18:59:15 +02:00
tsconfig.json Added permit domain check test. Update typechain and typescript to support new ethers 5 generated typings. Updated ethers to support _TypedDataEncoder for domain hash. 2020-11-18 19:18:02 +01:00
tslint.json

        .///.                .///.     //.            .//  `/////////////-
       `++:++`              .++:++`    :++`          `++:  `++:......---.`
      `/+: -+/`            `++- :+/`    /+/         `/+/   `++.
      /+/   :+/            /+:   /+/    `/+/        /+/`   `++.
  -::/++::`  /+:       -::/++::` `/+:    `++:      :++`    `++/:::::::::.
  -:+++::-`  `/+:      --++/---`  `++-    .++-    -++.     `++/:::::::::.
   -++.       .++-      -++`       .++.    .++.  .++-      `++.
  .++-         -++.    .++.         -++.    -++``++-       `++.
 `++:           :++`  .++-           :++`    :+//+:        `++:----------`
 -/:             :/-  -/:             :/.     ://:         `/////////////-

Aave Protocol v2

This repository contains the smart contracts source code and markets configuration for Aave Protocol V2. The repository uses Docker Compose and Hardhat as development enviroment for compilation, testing and deployment tasks.

What is Aave?

Aave is a decentralized non-custodial liquidity markets protocol where users can participate as depositors or borrowers. Depositors provide liquidity to the market to earn a passive income, while borrowers are able to borrow in an overcollateralized (perpetually) or undercollateralized (one-block liquidity) fashion.

Documentation

The documentation of Aave V2 is in the following Aave V2 documentation link. At the documentation you can learn more about the protocol, see the contract interfaces, integration guides and audits.

For getting the latest contracts addresses, please check the Deployed contracts page at the documentation to stay up to date.

A more detailed and technical description of the protocol can be found in this repository, here

Audits

  • MixBytes (16/09/2020 - 03/12/2020): report
  • PeckShield (29/09/2020 - 03/12/2020) : report (Also available in Chinese in the same folder)
  • CertiK (28/09/2020 - 02/12/2020): report
  • Consensys Diligence (09/09/2020 - 09/10/2020): report
  • Certora, formal verification (02/08/2020 - 29/10/2020): report

Connect with the community

You can join at the Discord channel or at the Governance Forum for asking questions about the protocol or talk about Aave with other peers.

Setup

The repository uses Docker Compose to manage sensitive keys and load the configuration. Prior any action like test or deploy, you must run docker-compose up to start the contracts-env container, and then connect to the container console via docker-compose exec contracts-env bash.

Follow the next steps to setup the repository:

  • Install docker and docker-compose
  • Create an enviroment file named .env and fill the next enviroment variables
# Mnemonic, only first address will be used
MNEMONIC=""

# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
ALCHEMY_KEY=""
INFURA_KEY=""


# Optional Etherscan key, for automatize the verification of the contracts at Etherscan
ETHERSCAN_KEY=""

# Optional, if you plan to use Tenderly scripts
TENDERLY_PROJECT=""
TENDERLY_USERNAME=""

Markets configuration

The configurations related with the Aave Markets are located at markets directory. You can follow the IAaveConfiguration interface to create new Markets configuration or extend the current Aave configuration.

Each market should have his own Market configuration file, and their own set of deployment tasks, using the Aave market config and tasks as a reference.

Test

You can run the full test suite with the following commands:

# In one terminal
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run test

Deployments

For deploying Aave Protocol V2, you can use the available scripts located at package.json. For a complete list, run npm run to see all the tasks.

Kovan deployment

# In one terminal
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run aave:kovan:full:migration

Mainnet fork deployment

You can deploy Aave Protocol v2 in a forked Mainnet chain using Hardhat built-in fork feature:

docker-compose run contracts-env npm run aave:fork:main

Mainnet fork - Interact with Aave via Hardhat console

You can also deploy Aave into the Hardhat console in fork mode, to interact with the protocol inside the fork or for testing purposes.

# Run the console in fork mode
docker-compose run contracts-env npm run console:fork

# Deploy the Aave protocol in fork mode
await run('aave:mainnet')

# Or your custom Hardhat task
await run('your-custom-task');

# After you initialize the Signers via 'set-DRE' task, you can import any TS/JS file
await run('set-DRE'); // Initialize signers

# Import contract getters to retrieve an Ethers.js Contract instance
const contractGetters = require('./helpers/contracts-getters'); // Import a TS/JS file

# Lending pool instance
const lendingPool = await contractGetters.getLendingPool("LendingPool address from 'aave:mainnet' task");

Mainnet fork - Run the check list

For testing the deployment scripts for Mainnet release, you can run the check-list tests in a Mainnet fork using Hardhat built-in feature:

# In another terminal, run docker-compose
docker-compose up

# Open another tab or terminal
docker-compose exec contracts-env bash

# A new Bash terminal is prompted, connected to the container
npm run test:main:check-list