Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
eboadom committed Apr 8, 2024
0 parents commit 7790961
Show file tree
Hide file tree
Showing 521 changed files with 92,318 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[{Makefile,**.mk}]
# Use tabs for indentation (Makefiles require tabs)
indent_style = tab
42 changes: 42 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Broadcast user address
SENDER=

# Deployment via ledger
MNEMONIC_INDEX=
LEDGER_SENDER=

# Deployment via private key
PRIVATE_KEY=

# Test rpc_endpoints
RPC_MAINNET=https://eth.llamarpc.com
RPC_AVALANCHE=https://api.avax.network/ext/bc/C/rpc
RPC_OPTIMISM=https://optimism.llamarpc.com
RPC_POLYGON=https://polygon.llamarpc.com
RPC_ARBITRUM=https://arbitrum.llamarpc.com
RPC_FANTOM=https://rpc.ftm.tools
RPC_HARMONY=https://api.harmony.one
RPC_METIS=https://andromeda.metis.io/?owner=1088
RPC_BASE=https://base.llamarpc.com
RPC_ZKEVM=https://zkevm-rpc.com
RPC_GNOSIS=https://rpc.ankr.com/gnosis
RPC_BNB=https://binance.llamarpc.com
RPC_SCROLL=https://rpc.scroll.io

# Etherscan api keys for verification & download utils
ETHERSCAN_API_KEY_MAINNET=
ETHERSCAN_API_KEY_POLYGON=
ETHERSCAN_API_KEY_AVALANCHE=
ETHERSCAN_API_KEY_FANTOM=
ETHERSCAN_API_KEY_OPTIMISM=
ETHERSCAN_API_KEY_ARBITRUM=
ETHERSCAN_API_KEY_BASE=
ETHERSCAN_API_KEY_ZKEVM=
ETHERSCAN_API_KEY_GNOSIS=
ETHERSCAN_API_KEY_BNB=
ETHERSCAN_API_KEY_SCROLL=

# Simulation/fork creation
TENDERLY_ACCESS_TOKEN=
TENDERLY_ACCOUNT=
TENDERLY_PROJECT=
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# build and cache
cache/
out/

# general
.env
.env.bk
reports/
diffs/
downloads/

# editors
.idea
.vscode
lcov*

# well, looks strange to ignore package-lock, but we have only pretter and it's temproray
package-lock.json
node_modules

# ignore foundry deploy artifacts
broadcast/

.DS_Store

report/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "lib/solidity-utils"]
path = lib/solidity-utils
url = https://github.com/bgd-labs/solidity-utils
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
out
lib
cache
node_modules
24 changes: 24 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false
}
},
{
"files": "*.ts",
"options": {
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false
}
}
]
}
10 changes: 10 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.0"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"compiler-fixed": false,
"quotes": ["error", "single"],
"indent": [2]
}
}
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
117 changes: 117 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
Business Source License 1.1

License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
“Business Source License” is a trademark of MariaDB Corporation Ab.

-----------------------------------------------------------------------------

Parameters

Licensor: Aave DAO, represented by its governance smart contracts


Licensed Work: Aave v3.1
The Licensed Work is (c) 2024 Aave DAO, represented by its governance smart contracts

Additional Use Grant: You are permitted to use, copy, and modify the Licensed Work, subject to
the following conditions:
- Your use of the Licensed Work shall not, directly or indirectly, enable, facilitate,
or assist in any way with the migration of users and/or funds from the Aave ecosystem.
The "Aave ecosystem" is defined in the context of this License as the collection of
software protocols and applications approved by the Aave governance, including all
those produced within compensated service provider engagements with the Aave DAO.
The Aave DAO is able to waive this requirement for one or more third-parties, if and
only if explicitly indicating it on a record 'authorizations' on govv3.aavelicense.eth.
- You are neither an individual nor a direct or indirect participant in any incorporated
organization, DAO, or identifiable group, that has deployed in production any original
or derived software ("fork") of the Aave ecosystem for purposes competitive to Aave,
within the preceding four years.
The Aave DAO is able to waive this requirement for one or more third-parties, if and
only if explicitly indicating it on a record 'authorizations' on v31.aavelicense.eth.
- You must ensure that the usage of the Licensed Work does not result in any direct or
indirect harm to the Aave ecosystem or the Aave brand. This encompasses, but is not limited to,
reputational damage, omission of proper credit/attribution, or utilization for any malicious
intent.

Change Date: The earlier of:
- 2027-03-06
- If specified, the date in the 'change-date' record on v31.aavelicense.eth

Change License: MIT

-----------------------------------------------------------------------------

Notice

The Business Source License (this document, or the “License”) is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.

-----------------------------------------------------------------------------

Terms

The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.

Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.

If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.

All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.

You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.

Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.

This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).

TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.

MariaDB hereby grants you permission to use this License’s text to license
your works, and to refer to it using the trademark “Business Source License”,
as long as you comply with the Covenants of Licensor below.

Covenants of Licensor

In consideration of the right to use this License’s text and the “Business
Source License” name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:

1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where “compatible” means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.

2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text “None”.

3. To specify a Change Date.

4. Not to modify this License in any other way.
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# include .env file and export its env vars
# (-include to ignore error if it does not exist)
-include .env

# deps
update:; forge update

# Build & test
test :; forge test -vvv --no-match-contract DeploymentsGasLimits
test-watch :; forge test --watch -vvv --no-match-contract DeploymentsGasLimits
coverage :; forge coverage --report lcov && \
lcov --remove ./lcov.info -o ./lcov.info.p \
'scripts/*' \
'tests/*' \
'src/deployments/*' \
'src/periphery/contracts/v3-config-engine/*' \
'src/periphery/contracts/treasury/*' \
'src/periphery/contracts/dependencies/openzeppelin/ReentrancyGuard.sol' \
'src/periphery/contracts/misc/UiIncentiveDataProviderV3.sol' \
'src/periphery/contracts/misc/UiPoolDataProviderV3.sol' \
'src/periphery/contracts/misc/WalletBalanceProvider.sol' \
'src/periphery/contracts/mocks/*' \
'src/core/contracts/mocks/*' \
'src/core/contracts/dependencies/*' \
'src/core/contracts/misc/AaveProtocolDataProvider.sol' \
'src/core/contracts/protocol/libraries/configuration/*' \
'src/core/contracts/protocol/libraries/logic/GenericLogic.sol' \
'src/core/contracts/protocol/libraries/logic/ReserveLogic.sol' \
&& genhtml ./lcov.info.p -o report --branch-coverage

# Utilities
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
git-diff :
@mkdir -p diffs
@printf '%s\n%s\n%s\n' "\`\`\`diff" "$$(git diff --no-index --diff-algorithm=patience --ignore-space-at-eol ${before} ${after})" "\`\`\`" > diffs/${out}.md
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Aave V3.1 Origin

![Aave v3.1 Origin_banner](./v3-1-banner.jpeg)

Aave v3.1 complete codebase, Foundry-based.

<br>

## Dependencies

- Foundry, [how-to install](https://book.getfoundry.sh/getting-started/installation) (we recommend also update to the last version with `foundryup`)
- Lcov
- Optional, only needed for coverage testing
- For Ubuntu, you can install via `apt install lcov`
- For Mac, you can install via `brew install lcov`

<br>

## Setup

```sh
cp .env.example .env

forge install

# optional, to install prettier
npm i
```

<br>

## Tests

- To run the full test suite: `make test`
- To re-generate the coverage report: `make coverage`

<br>

## Documentation

- [Aave v3 technical Paper](./techpaper/Aave_V3_Technical_Paper.pdf)
- [v3 to v3.0.2 production upgrade](https://github.com/bgd-labs/proposal-3.0.2-upgrade/blob/main/README.md)
- [Aave v3.1 features](./docs/Aave-v3.1-features.md)

<br>

## Security

Aave v3.1 is an upgraded version of Aave v3, more precisely on top of the initial Aave v3 release and a follow-up 3.0.2 later update.

The following are the security procedures historically applied to Aave v3.X versions.

<br>

**-> Aave v3**

- [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)
- [SigmaPrime](./audits/27-01-2022_SigmaPrime_AaveV3.pdf)
- [Certora](./certora/Aave_V3_Formal_Verification_Report_Jan2022.pdf)

<br>

**-> Aave 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)

<br>

**-> Aave v3.0.2 - April 2023**

- [SigmaPrime](./audits/19-04-2023_SigmaPrime_AaveV3-0-2.pdf)
- [Certora](./audits/03-2023_2023_Certora_AaveV3-0-2.pdf)

<br>

**-> Aave v3.1 - April 2024**

- [Certora](./) TBA
- [MixBytes](./) TBA
- An internal review by [SterMi](https://twitter.com/stermi) on the virtual accounting feature was conducted on an initial phase of the codebase.
- Additionally, Certora properties have been improved over time since the Aave v3 release. More details [HERE](./certora/README.md).

<br>

## License

Copyright © 2024, Aave DAO, represented by its governance smart contracts.

The [BUSL1.1](./LICENSE) license of this repository allows for any usage of the software, if respecting the Additional Use Grant limitations, forbidding any use case damaging anyhow the Aave DAO's interests.
Interfaces and other components required for integrations are explicitly MIT licensed.

Binary file added audits/01-11-2021_OpenZeppelin_AaveV3.pdf
Binary file not shown.
Binary file added audits/03-2023_2023_Certora_AaveV3-0-2.pdf
Binary file not shown.
Binary file added audits/07-01-2022_TrailOfBits_AaveV3.pdf
Binary file not shown.
Binary file added audits/09-12-2022_PeckShield_AaveV3-0-1.pdf
Binary file not shown.
Binary file added audits/14-01-2022_PeckShield_AaveV3.pdf
Binary file not shown.
Binary file added audits/19-04-2023_SigmaPrime_AaveV3-0-2.pdf
Binary file not shown.
Binary file added audits/23-12-2022_SigmaPrime_AaveV3-0-1.pdf
Binary file not shown.
Binary file added audits/27-01-2022_ABDK_AaveV3.pdf
Binary file not shown.
Binary file added audits/27-01-2022_SigmaPrime_AaveV3.pdf
Binary file not shown.
Loading

0 comments on commit 7790961

Please sign in to comment.