Skip to content

Commit 1a84946

Browse files
authored
docs: update README (aave#981)
1 parent bbe7341 commit 1a84946

11 files changed

Lines changed: 158 additions & 276 deletions

File tree

.env.example

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# Deployment via ledger
2-
MNEMONIC_INDEX=
3-
LEDGER_SENDER=
4-
5-
# Deployment via private key
6-
PRIVATE_KEY=
7-
81
# Test rpc_endpoints
92
RPC_MAINNET=https://eth.llamarpc.com
103
RPC_AVALANCHE=https://api.avax.network/ext/bc/C/rpc

README.md

Lines changed: 139 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,151 @@
11
# Aave V4
22

3+
[![codecov](https://codecov.io/gh/aave/aave-v4/graph/badge.svg?token=afC1P2GrDM)](https://codecov.io/gh/aave/aave-v4)
4+
5+
A unified liquidity layer and modular architecture that enhances capital efficiency, scalability, and risk management.
6+
7+
## Table of Contents
8+
9+
- [Documentation](#documentation)
10+
- [Architecture](#architecture)
11+
- [Repository Structure](#repository-structure)
12+
- [Dependencies](#dependencies)
13+
- [Development](#development)
14+
- [Security](#security)
15+
16+
## Documentation
17+
18+
- [Aave V4 Overview](./docs/overview.md)
19+
20+
## Architecture
21+
22+
The Aave V4 architecture follows a modular **hub-and-spoke design** that separates liquidity management from user-facing operations and collateralization.
23+
24+
## Repository Structure
25+
26+
```
27+
aave-v4/
28+
├── src/ # Main source code
29+
│ ├── hub/ # Hub contracts and interfaces
30+
│ ├── spoke/ # Spoke contracts and interfaces
31+
│ ├── position-manager/ # Position Managers, including gateway contracts
32+
│ ├── libraries/ # Shared libraries (math, types)
33+
│ ├── utils/ # Utility contracts (Multicall, etc.)
34+
│ └── dependencies/ # Dependencies (Chainlink, OpenZeppelin, etc.)
35+
├── tests/ # Test suite
36+
│ ├── unit/ # Unit tests
37+
│ ├── gas/ # Gas snapshot tests
38+
│ ├── invariant/ # Invariant tests
39+
│ ├── misc/ # Symbolic tests, prototype development
40+
│ └── Base.t.sol # Base test setup
41+
├── scripts/ # Deployment scripts
42+
├── snapshots/ # Gas snapshots
43+
└── lib/ # Foundry dependencies
44+
```
45+
346
## Dependencies
447

5-
- Foundry, [how-to install](https://book.getfoundry.sh/getting-started/installation) (we recommend also update to the last version with `foundryup`)
6-
- Node, [how-to install](https://nodejs.org/en/download)
7-
- Lcov
8-
- Optional, only needed for coverage testing
9-
- For Ubuntu, you can install via `apt install lcov`
10-
- For Mac, you can install via `brew install lcov`
48+
### Required
49+
50+
- **[Foundry](https://book.getfoundry.sh/getting-started/installation)** - Development framework
51+
```bash
52+
curl -L https://foundry.paradigm.xyz | bash
53+
foundryup # Update to latest version
54+
```
55+
- **[Node.js](https://nodejs.org/en/download)** - For linting and tooling
56+
57+
```bash
58+
# Verify installation
59+
node --version
60+
yarn --version
61+
# Install dependencies
62+
yarn install
63+
```
64+
65+
### Optional
66+
67+
- **Lcov** - For coverage reports
68+
69+
```bash
70+
# Ubuntu
71+
sudo apt install lcov
72+
73+
# macOS
74+
brew install lcov
75+
```
76+
77+
### Dependency Strategy
78+
79+
Dependencies are located in the `src/dependencies` subfolder rather than managed through external package managers. This approach:
80+
81+
- Mitigates supply chain attack vectors
82+
- Ensures dependency immutability
83+
- Minimizes installation overhead
84+
- Provides simplified version control and auditability
1185

12-
## Setup
86+
## Quickstart
1387

14-
```sh
88+
### 1. Clone the Repository
89+
90+
```bash
91+
git clone https://github.com/aave/aave-v4.git
92+
cd aave-v4
93+
```
94+
95+
### 2. Install Dependencies
96+
97+
```bash
98+
# Copy environment template and populate
1599
cp .env.example .env
100+
101+
# Install Foundry dependencies
16102
forge install
17-
# required for linting
103+
104+
# Install Node.js dependencies (required for linting)
18105
yarn install
19106
```
20107

21-
## Tests
108+
### 3. Build Contracts
109+
110+
```bash
111+
forge build
112+
```
113+
114+
## Development
115+
116+
### Testing
117+
118+
- **Run full test suite**: `make test` or `forge test -vvv`
119+
- **Run specific test file**: `forge test --match-contract ...`
120+
- **Run with gas reporting**: `make gas-report`
121+
- **Generate coverage report**: `make coverage`
122+
123+
### Code Quality
124+
125+
- **Check contract sizes**: `forge build --sizes`
126+
- **Check linting**: `yarn lint`
127+
- **Fix linting issues**: `yarn lint:fix`
128+
- **Generate Rust bindings**: `yarn rs:generate`
129+
130+
### Gas Snapshots
131+
132+
Gas snapshots are automatically generated and stored in the `snapshots/` directory. To update snapshots:
133+
134+
```bash
135+
make gas-report
136+
```
137+
138+
Snapshot files generated:
139+
140+
- `Hub.Operations.json`: Gas for Hub actions or treasury operations invoked by Spokes.
141+
- `Spoke.Operations.json`: Gas for user-facing Spoke operations.
142+
- `Spoke.Operations.ZeroRiskPremium.json`: Same scenarios as `Spoke.Operations.json` but with Collateral Risk set to 0, to show baseline gas excluding risk-premium computation.
143+
- `Spoke.Getters.json`: Gas for getters across different combinations of supplies/borrows.
144+
- `NativeTokenGateway.Operations.json`: Gas for native-asset (ETH) gateway flows.
145+
- `SignatureGateway.Operations.json`: Gas for EIP-712 meta-transactions.
146+
147+
## Security
22148

23-
- To run the full test suite: `make test`
24-
- To re-generate the coverage report: `make coverage`
149+
- **Audit Reports**: [TBD]
150+
- **Security Policy**: [TBD]
151+
- **Bug Bounty**: [TBD]

deploy.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

foundry.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[profile.default]
22
src = 'src'
33
test = 'tests'
4-
script = 'scripts'
54
out = 'out'
65
libs = ['lib']
76
fs_permissions = [{ access = "read", path = "tests/mocks/JsonBindings.sol" }]

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aave-v4",
3-
"version": "1.0.0",
3+
"version": "0.5.3",
44
"scripts": {
55
"lint": "prettier . --check",
66
"lint:fix": "prettier . --write",
@@ -11,6 +11,11 @@
1111
},
1212
"keywords": [],
1313
"author": "Aave Labs",
14+
"license": "UNLICENSED",
15+
"bugs": {
16+
"url": "https://github.com/aave/aave-v4/issues"
17+
},
18+
"homepage": "https://github.com/aave/aave-v4#readme",
1419
"devDependencies": {
1520
"husky": "9.1.7",
1621
"lint-staged": "16.2.3",

scripts/Script.s.sol

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/Base.t.sol

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ import {console2 as console} from 'forge-std/console2.sol';
1111

1212
// dependencies
1313
import {AggregatorV3Interface} from 'src/dependencies/chainlink/AggregatorV3Interface.sol';
14-
import {TransparentUpgradeableProxy, ITransparentUpgradeableProxy} from 'src/dependencies/openzeppelin/TransparentUpgradeableProxy.sol';
14+
import {
15+
TransparentUpgradeableProxy,
16+
ITransparentUpgradeableProxy
17+
} from 'src/dependencies/openzeppelin/TransparentUpgradeableProxy.sol';
1518
import {IERC20Metadata} from 'src/dependencies/openzeppelin/IERC20Metadata.sol';
1619
import {SafeCast} from 'src/dependencies/openzeppelin/SafeCast.sol';
1720
import {IERC20Errors} from 'src/dependencies/openzeppelin/IERC20Errors.sol';
@@ -44,7 +47,11 @@ import {UnitPriceFeed} from 'src/misc/UnitPriceFeed.sol';
4447
import {HubConfigurator, IHubConfigurator} from 'src/hub/HubConfigurator.sol';
4548
import {Hub, IHub, IHubBase} from 'src/hub/Hub.sol';
4649
import {SharesMath} from 'src/hub/libraries/SharesMath.sol';
47-
import {AssetInterestRateStrategy, IAssetInterestRateStrategy, IBasicInterestRateStrategy} from 'src/hub/AssetInterestRateStrategy.sol';
50+
import {
51+
AssetInterestRateStrategy,
52+
IAssetInterestRateStrategy,
53+
IBasicInterestRateStrategy
54+
} from 'src/hub/AssetInterestRateStrategy.sol';
4855

4956
// spoke
5057
import {Spoke, ISpoke, ISpokeBase} from 'src/spoke/Spoke.sol';
@@ -74,7 +81,7 @@ import {MockPriceFeed} from 'tests/mocks/MockPriceFeed.sol';
7481
import {PositionStatusMapWrapper} from 'tests/mocks/PositionStatusMapWrapper.sol';
7582
import {RescuableWrapper} from 'tests/mocks/RescuableWrapper.sol';
7683
import {GatewayBaseWrapper} from 'tests/mocks/GatewayBaseWrapper.sol';
77-
import {NoncesKeyedMock} from 'tests/mocks/NoncesKeyedMock.sol';
84+
import {MockNoncesKeyed} from 'tests/mocks/MockNoncesKeyed.sol';
7885
import {MockSpoke} from 'tests/mocks/MockSpoke.sol';
7986
import {MockERC1271Wallet} from 'tests/mocks/MockERC1271Wallet.sol';
8087
import {MockSpokeInstance} from 'tests/mocks/MockSpokeInstance.sol';

0 commit comments

Comments
 (0)