Skip to content

Commit

Permalink
Merge pull request #701 from aave/feat/3.0.1
Browse files Browse the repository at this point in the history
3.0.1 Upgrade
  • Loading branch information
miguelmtzinf authored Dec 28, 2022
2 parents f3e037b + ee7d556 commit e0bfed1
Show file tree
Hide file tree
Showing 130 changed files with 18,544 additions and 35,378 deletions.
4 changes: 2 additions & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@aave:registry=https://npm.pkg.github.com
engine-strict=true
engine-strict=true
save-exact=true
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"singleQuote": true,
"tabWidth": 2,
"overrides": [
{
"files": "*.ts",
"options": {
"bracketSpacing": true
}
},
{
"files": "*.sol",
"options": {
Expand Down
4 changes: 2 additions & 2 deletions .solcover.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const accounts = require(`./test-wallets.js`).accounts;
const cp = require('child_process');

module.exports = {
client: require('ganache-cli'),
configureYulOptimizer: true,
skipFiles: ['./mocks', './interfaces', './dependencies'],
mocha: {
enableTimeouts: false,
Expand All @@ -12,6 +12,6 @@ module.exports = {
},
onCompileComplete: function () {
console.log('onCompileComplete hook');
cp.execSync('. ./setup-test-env.sh', { stdio: 'inherit' });
cp.execSync('. ./setup-test-env.sh', {stdio: 'inherit'});
},
};
4 changes: 2 additions & 2 deletions Certora/certora/harness/ATokenHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract ATokenHarness is AToken {
/**
* @dev Calls burn with index == 1 RAY
* @param amount the amount being burned
**/
*/
function burn(
address user,
address receiverOfUnderlying,
Expand All @@ -37,7 +37,7 @@ contract ATokenHarness is AToken {
/**
* @dev Calls mint with index == 1 RAY
* @param amount the amount of tokens to mint
**/
*/
function mint(
address user,
address onBehalfOf,
Expand Down
4 changes: 2 additions & 2 deletions Certora/certora/harness/GenericLogicHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract GenericLogic {
* @return The average liquidation threshold of the user
* @return The health factor of the user
* @return True if the ltv is zero, false otherwise
**/
*/
function calculateUserAccountData()
public
returns (
Expand Down Expand Up @@ -226,7 +226,7 @@ contract GenericLogic {
* @param totalDebtInBaseCurrency The total borrow balance in the base currency used by the price feed
* @param ltv The average loan to value
* @return The amount available to borrow in the base currency of the used by the price feed
**/
*/
function calculateAvailableBorrows(
uint256 totalCollateralInBaseCurrency,
uint256 totalDebtInBaseCurrency,
Expand Down
2 changes: 1 addition & 1 deletion Certora/certora/harness/PoolConfiguratorHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {IPoolDataProvider} from '../../contracts/interfaces/IPoolDataProvider.so
* @title PoolConfigurator
* @author Aave
* @dev Implements the configuration methods for the Aave protocol
**/
*/
contract PoolConfiguratorHarness is VersionedInitializable, IPoolConfigurator {
using PercentageMath for uint256;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
Expand Down
4 changes: 2 additions & 2 deletions Certora/certora/harness/PoolHarnessForConfigurator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {Helpers} from '../../contracts/protocol/libraries/helpers/Helpers.sol';
* @dev To be covered by a proxy contract, owned by the PoolAddressesProvider of the specific market
* @dev All admin functions are callable by the PoolConfigurator contract defined also in the
* PoolAddressesProvider
**/
*/
contract PoolHarnessForConfigurator is VersionedInitializable, IPool, PoolStorage {
using WadRayMath for uint256;
using ReserveLogic for DataTypes.ReserveData;
Expand Down Expand Up @@ -88,7 +88,7 @@ contract PoolHarnessForConfigurator is VersionedInitializable, IPool, PoolStorag
* PoolAddressesProvider of the market.
* @dev Caching the address of the PoolAddressesProvider in order to reduce gas consumption on subsequent operations
* @param provider The address of the PoolAddressesProvider
**/
*/
function initialize(IPoolAddressesProvider provider) external initializer {
require(provider == _addressesProvider, Errors.PC_INVALID_CONFIGURATION);
_maxStableRateBorrowSizePercent = 2500;
Expand Down
2 changes: 1 addition & 1 deletion Certora/certora/harness/StableDebtTokenHarness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract StableDebtTokenHarness is StableDebtToken {

/**
Simplification: The user accumulates no interest (the balance increase is always 0).
**/
*/
function balanceOf(address account) public view override returns (uint256) {
return IncentivizedERC20.balanceOf(account);
}
Expand Down
2 changes: 1 addition & 1 deletion Certora/certora/specs/pool.spec
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ methods {
mintToTreasury(uint256 amount, uint256 index) => DISPATCHER(true)
transferOnLiquidation(address from, address to, uint256 value) => DISPATCHER(true)
transferUnderlyingTo(address user, uint256 amount) => DISPATCHER(true)
handleRepayment(address user, uint256 amount) => DISPATCHER(true)
handleRepayment(address user, address onBehalfOf, uint256 amount) => DISPATCHER(true)
permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) => DISPATCHER(true)

//Debt Tokens
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Formal Verification

## Connect with the community

You can join at the [Discord](http://aave.com/discord) channel or at the [Governance Forum](https://governance.aave.com/) for asking questions about the protocol or talk about Aave with other peers.
You can join the [Discord](http://aave.com/discord) channel or the [Governance Forum](https://governance.aave.com/) to ask questions about the protocol or talk about Aave with other peers.

## Getting Started

Expand All @@ -67,7 +67,7 @@ contract Misc {
}
```

The JSON artifacts with the ABI and Bytecode are also included into the bundled NPM package at `artifacts/` directory.
The JSON artifacts with the ABI and Bytecode are also included in the bundled NPM package at `artifacts/` directory.

Import JSON file via Node JS `require`:

Expand All @@ -80,12 +80,12 @@ console.log(PoolV3Artifact.abi)

## 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`.
The repository uses Docker Compose to manage sensitive keys and load the configuration. Prior to 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
- Create an environment file named `.env` and fill the next environment variables

```
# Add Alchemy or Infura provider keys, alchemy takes preference at the config level
Expand Down
Binary file added audits/09-12-2022_PeckShield_AaveV3-0-1.pdf
Binary file not shown.
Binary file added audits/23-12-2022_SigmaPrime_AaveV3-0-1.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/dependencies/openzeppelin/contracts/Address.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/dependencies/openzeppelin/contracts/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {IERC20} from './IERC20.sol';
Expand Down
2 changes: 1 addition & 1 deletion contracts/dependencies/openzeppelin/contracts/SafeMath.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/// @title Optimized overflow and underflow safe math operations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './BaseAdminUpgradeabilityProxy.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './UpgradeabilityProxy.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './Proxy.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './BaseAdminUpgradeabilityProxy.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './BaseUpgradeabilityProxy.sol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: agpl-3.0
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import './BaseUpgradeabilityProxy.sol';
Expand Down
2 changes: 2 additions & 0 deletions contracts/deployments/ReservesSetupHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ contract ReservesSetupHelper is Ownable {
uint256 supplyCap;
bool stableBorrowingEnabled;
bool borrowingEnabled;
bool flashLoanEnabled;
}

/**
Expand Down Expand Up @@ -50,6 +51,7 @@ contract ReservesSetupHelper is Ownable {
inputParams[i].stableBorrowingEnabled
);
}
configurator.setReserveFlashLoaning(inputParams[i].asset, inputParams[i].flashLoanEnabled);
configurator.setSupplyCap(inputParams[i].asset, inputParams[i].supplyCap);
configurator.setReserveFactor(inputParams[i].asset, inputParams[i].reserveFactor);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/flashloan/interfaces/IFlashLoanReceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IPool} from '../../interfaces/IPool.sol';
* @author Aave
* @notice Defines the basic interface of a flashloan-receiver contract.
* @dev Implement this interface to develop a flashloan-compatible flashLoanReceiver contract
**/
*/
interface IFlashLoanReceiver {
/**
* @notice Executes an operation after receiving the flash-borrowed assets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {IPool} from '../../interfaces/IPool.sol';
* @author Aave
* @notice Defines the basic interface of a flashloan-receiver contract.
* @dev Implement this interface to develop a flashloan-compatible flashLoanReceiver contract
**/
*/
interface IFlashLoanSimpleReceiver {
/**
* @notice Executes an operation after receiving the flash-borrowed asset
Expand Down
4 changes: 2 additions & 2 deletions contracts/interfaces/IACLManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {IPoolAddressesProvider} from './IPoolAddressesProvider.sol';
* @title IACLManager
* @author Aave
* @notice Defines the basic interface for the ACL Manager
**/
*/
interface IACLManager {
/**
* @notice Returns the contract address of the PoolAddressesProvider
Expand Down Expand Up @@ -123,7 +123,7 @@ interface IACLManager {
function addFlashBorrower(address borrower) external;

/**
* @notice Removes an admin as FlashBorrower
* @notice Removes an address as FlashBorrower
* @param borrower The address of the FlashBorrower to remove
*/
function removeFlashBorrower(address borrower) external;
Expand Down
31 changes: 18 additions & 13 deletions contracts/interfaces/IAToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {IInitializableAToken} from './IInitializableAToken.sol';
* @title IAToken
* @author Aave
* @notice Defines the basic interface for an AToken.
**/
*/
interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @dev Emitted during the transfer action
* @param from The user whose tokens are being transferred
* @param to The recipient
* @param value The amount being transferred
* @param value The scaled amount being transferred
* @param index The next liquidity index of the reserve
**/
*/
event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);

/**
Expand All @@ -43,7 +43,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param receiverOfUnderlying The address that will receive the underlying
* @param amount The amount being burned
* @param index The next liquidity index of the reserve
**/
*/
function burn(
address from,
address receiverOfUnderlying,
Expand All @@ -63,7 +63,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param from The address getting liquidated, current owner of the aTokens
* @param to The recipient
* @param value The amount of tokens getting transferred
**/
*/
function transferOnLiquidation(
address from,
address to,
Expand All @@ -73,20 +73,25 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @notice Transfers the underlying asset to `target`.
* @dev Used by the Pool to transfer assets in borrow(), withdraw() and flashLoan()
* @param user The recipient of the underlying
* @param target The recipient of the underlying
* @param amount The amount getting transferred
**/
function transferUnderlyingTo(address user, uint256 amount) external;
*/
function transferUnderlyingTo(address target, uint256 amount) external;

/**
* @notice Handles the underlying received by the aToken after the transfer has been completed.
* @dev The default implementation is empty as with standard ERC20 tokens, nothing needs to be done after the
* transfer is concluded. However in the future there may be aTokens that allow for example to stake the underlying
* to receive LM rewards. In that case, `handleRepayment()` would perform the staking of the underlying asset.
* @param user The user executing the repayment
* @param onBehalfOf The address of the user who will get his debt reduced/removed
* @param amount The amount getting repaid
**/
function handleRepayment(address user, uint256 amount) external;
*/
function handleRepayment(
address user,
address onBehalfOf,
uint256 amount
) external;

/**
* @notice Allow passing a signed message to approve spending
Expand All @@ -113,13 +118,13 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
/**
* @notice Returns the address of the underlying asset of this aToken (E.g. WETH for aWETH)
* @return The address of the underlying asset
**/
*/
function UNDERLYING_ASSET_ADDRESS() external view returns (address);

/**
* @notice Returns the address of the Aave treasury, receiving the fees on this aToken.
* @return Address of the Aave treasury
**/
*/
function RESERVE_TREASURY_ADDRESS() external view returns (address);

/**
Expand All @@ -133,7 +138,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @notice Returns the nonce for owner.
* @param owner The address of the owner
* @return The nonce of the owner
**/
*/
function nonces(address owner) external view returns (uint256);

/**
Expand Down
Loading

0 comments on commit e0bfed1

Please sign in to comment.