Skip to content

Commit

Permalink
chore: Enforce prettier and add CI checks (#810)
Browse files Browse the repository at this point in the history
* fix: enforce prettier linter check at CI and pre-commit

* chore: run prettier write to fix unformatted contracts and js files

* chore: Bump version of prettier dependencies

* ci: Fix package json typo

* ci: Fix format

---------

Co-authored-by: miguelmtzinf <[email protected]>
Co-authored-by: miguelmtz <[email protected]>
  • Loading branch information
3 people authored Mar 13, 2023
1 parent fa6b741 commit 2437c56
Show file tree
Hide file tree
Showing 70 changed files with 1,648 additions and 2,461 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/certora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ jobs:
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}
run: echo "key length" ${#CERTORAKEY}

- name: Install python
uses: actions/setup-python@v2
with: { python-version: 3.9 }

- name: Install java
uses: actions/setup-java@v1
with: { java-version: "11", java-package: jre }
with: { java-version: '11', java-package: jre }

- name: Install certora cli
run: pip install certora-cli

- name: Install solc
run: |
wget https://github.com/ethereum/solidity/releases/download/v0.8.10/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc8.10
- name: Verify rule ${{ matrix.rule }}
run: |
cd certora
Expand All @@ -49,7 +49,7 @@ jobs:
sh certora/scripts/${{ matrix.rule }}
env:
CERTORAKEY: ${{ secrets.CERTORAKEY }}

strategy:
fail-fast: false
max-parallel: 16
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
scope: '@aave'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run prettier:check
- name: Test
run: npm run ci:test
- name: Coverage
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
artifacts
cache
node_modules
types
deployments
temp-artifacts
dist
Certora
*.json
CHANGELOG.md
.prettierignore
.solcover.js
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,35 @@ This repository contains the smart contracts source code and markets configurati
Aave is a decentralized non-custodial liquidity markets protocol where users can participate as suppliers or borrowers. Suppliers 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

See the link to the technical paper or visit the Aave Developer docs

- [Technical Paper](./techpaper/Aave_V3_Technical_Paper.pdf)

- [Developer Documentation](https://docs.aave.com/developers/)

## Audits and Formal Verification

You can find all audit reports under the audits folder

V3.0.1 - December 2022

- [PeckShield](./audits/09-12-2022_PeckShield_AaveV3-0-1.pdf)
- [SigmaPrime](./audits/23-12-2022_SigmaPrime_AaveV3-0-1.pdf)

V3 Round 1 - October 2021

- [ABDK](./audits/27-01-2022_ABDK_AaveV3.pdf)
- [OpenZeppelin](./audits/01-11-2021_OpenZeppelin_AaveV3.pdf)
- [Trail of Bits](./audits/07-01-2022_TrailOfBits_AaveV3.pdf)
- [Peckshield](./audits/14-01-2022_PeckShield_AaveV3.pdf)

V3 Round 2 - December 2021

- [SigmaPrime](./audits/27-01-2022_SigmaPrime_AaveV3.pdf)

Formal Verification - November 2021-January 2022

- [Certora](./certora/Aave_V3_Formal_Verification_Report_Jan2022.pdf)

## Connect with the community
Expand Down
13 changes: 2 additions & 11 deletions contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import {IERC20} from '../../openzeppelin/contracts/IERC20.sol';
library GPv2SafeERC20 {
/// @dev Wrapper around a call to the ERC20 function `transfer` that reverts
/// also when the token returns `false`.
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
function safeTransfer(IERC20 token, address to, uint256 value) internal {
bytes4 selector_ = token.transfer.selector;

// solhint-disable-next-line no-inline-assembly
Expand All @@ -34,12 +30,7 @@ library GPv2SafeERC20 {

/// @dev Wrapper around a call to the ERC20 function `transferFrom` that
/// reverts also when the token returns `false`.
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
bytes4 selector_ = token.transferFrom.selector;

// solhint-disable-next-line no-inline-assembly
Expand Down
20 changes: 8 additions & 12 deletions contracts/dependencies/openzeppelin/contracts/AccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account)
public
virtual
override
onlyRole(getRoleAdmin(role))
{
function grantRole(
bytes32 role,
address account
) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}

Expand All @@ -144,12 +142,10 @@ abstract contract AccessControl is Context, IAccessControl, ERC165 {
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account)
public
virtual
override
onlyRole(getRoleAdmin(role))
{
function revokeRole(
bytes32 role,
address account
) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}

Expand Down
38 changes: 11 additions & 27 deletions contracts/dependencies/openzeppelin/contracts/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,10 @@ contract ERC20 is Context, IERC20 {
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender)
public
view
virtual
override
returns (uint256)
{
function allowance(
address owner,
address spender
) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}

Expand Down Expand Up @@ -201,11 +198,10 @@ contract ERC20 is Context, IERC20 {
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue)
public
virtual
returns (bool)
{
function decreaseAllowance(
address spender,
uint256 subtractedValue
) public virtual returns (bool) {
_approve(
_msgSender(),
spender,
Expand All @@ -231,11 +227,7 @@ contract ERC20 is Context, IERC20 {
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), 'ERC20: transfer from the zero address');
require(recipient != address(0), 'ERC20: transfer to the zero address');

Expand Down Expand Up @@ -299,11 +291,7 @@ contract ERC20 is Context, IERC20 {
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), 'ERC20: approve from the zero address');
require(spender != address(0), 'ERC20: approve to the zero address');

Expand Down Expand Up @@ -336,9 +324,5 @@ contract ERC20 is Context, IERC20 {
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
6 changes: 1 addition & 5 deletions contracts/dependencies/openzeppelin/contracts/IERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ interface IERC20 {
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);

/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
Expand Down
6 changes: 1 addition & 5 deletions contracts/dependencies/openzeppelin/contracts/SafeMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ library SafeMath {
/// @param y The subtrahend
/// @param message The error msg
/// @return z The difference of x and y
function sub(
uint256 x,
uint256 y,
string memory message
) internal pure returns (uint256 z) {
function sub(uint256 x, uint256 y, string memory message) internal pure returns (uint256 z) {
unchecked {
require((z = x - y) <= x, message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ contract BaseAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
ifAdmin
{
function upgradeToAndCall(
address newImplementation,
bytes calldata data
) external payable ifAdmin {
_upgradeTo(newImplementation);
(bool success, ) = newImplementation.delegatecall(data);
require(success);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ contract InitializableAdminUpgradeabilityProxy is
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
function initialize(
address logic,
address admin,
bytes memory data
) public payable {
function initialize(address logic, address admin, bytes memory data) public payable {
require(_implementation() == address(0));
InitializableUpgradeabilityProxy.initialize(logic, data);
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
Expand Down
6 changes: 1 addition & 5 deletions contracts/dependencies/weth/WETH9.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ contract WETH9 {
return transferFrom(msg.sender, dst, wad);
}

function transferFrom(
address src,
address dst,
uint256 wad
) public returns (bool) {
function transferFrom(address src, address dst, uint256 wad) public returns (bool) {
require(balanceOf[src] >= wad);

if (src != msg.sender && allowance[src][msg.sender] != type(uint256).max) {
Expand Down
25 changes: 4 additions & 21 deletions contracts/interfaces/IAToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param amount The amount being burned
* @param index The next liquidity index of the reserve
*/
function burn(
address from,
address receiverOfUnderlying,
uint256 amount,
uint256 index
) external;
function burn(address from, address receiverOfUnderlying, uint256 amount, uint256 index) external;

/**
* @notice Mints aTokens to the reserve treasury
Expand All @@ -64,11 +59,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param to The recipient
* @param value The amount of tokens getting transferred
*/
function transferOnLiquidation(
address from,
address to,
uint256 value
) external;
function transferOnLiquidation(address from, address to, uint256 value) external;

/**
* @notice Transfers the underlying asset to `target`.
Expand All @@ -87,11 +78,7 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param onBehalfOf The address of the user who will get his debt reduced/removed
* @param amount The amount getting repaid
*/
function handleRepayment(
address user,
address onBehalfOf,
uint256 amount
) external;
function handleRepayment(address user, address onBehalfOf, uint256 amount) external;

/**
* @notice Allow passing a signed message to approve spending
Expand Down Expand Up @@ -147,9 +134,5 @@ interface IAToken is IERC20, IScaledBalanceToken, IInitializableAToken {
* @param to The address of the recipient
* @param amount The amount of token to transfer
*/
function rescueTokens(
address token,
address to,
uint256 amount
) external;
function rescueTokens(address token, address to, uint256 amount) external;
}
6 changes: 1 addition & 5 deletions contracts/interfaces/IAaveIncentivesController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ interface IAaveIncentivesController {
* @param totalSupply The total supply of the asset prior to user balance change
* @param userBalance The previous user balance prior to balance change
*/
function handleAction(
address user,
uint256 totalSupply,
uint256 userBalance
) external;
function handleAction(address user, uint256 totalSupply, uint256 userBalance) external;
}
12 changes: 2 additions & 10 deletions contracts/interfaces/IL2Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ interface IL2Pool {
* @param r The R parameter of ERC712 permit sig
* @param s The S parameter of ERC712 permit sig
*/
function supplyWithPermit(
bytes32 args,
bytes32 r,
bytes32 s
) external;
function supplyWithPermit(bytes32 args, bytes32 r, bytes32 s) external;

/**
* @notice Calldata efficient wrapper of the withdraw function, withdrawing to the caller
Expand Down Expand Up @@ -81,11 +77,7 @@ interface IL2Pool {
* @param s The S parameter of ERC712 permit sig
* @return The final amount repaid
*/
function repayWithPermit(
bytes32 args,
bytes32 r,
bytes32 s
) external returns (uint256);
function repayWithPermit(bytes32 args, bytes32 r, bytes32 s) external returns (uint256);

/**
* @notice Calldata efficient wrapper of the repayWithATokens function
Expand Down
Loading

0 comments on commit 2437c56

Please sign in to comment.