Skip to content

Commit 51416af

Browse files
Merge pull request #51 from aavegotchi/codex/devex-contributing-pr-template
DevEx: Add CONTRIBUTING.md + PR template
2 parents 0ad45a9 + cd6d86a commit 51416af

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.github/pull_request_template.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Summary
2+
3+
## Testing
4+
5+
- [ ] `forge build --sizes`
6+
- [ ] `npx hardhat compile`
7+
- [ ] `forge test` (if applicable)
8+
- [ ] `npm test` (if applicable)
9+
10+
## Checklist
11+
12+
- [ ] No secrets committed (for example `.env`, private keys, API keys)
13+
- [ ] If `AppStorage` changed: append-only (no reordering/removals/type changes)
14+
- [ ] Diamond auth paths use the correct sender pattern (`LibMeta.msgSender()` vs `msg.sender`)
15+
- [ ] Docs updated (if behavior or public API changed)
16+

CONTRIBUTING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Contributing
2+
3+
This repo contains the Aavegotchi contracts (Diamonds/facets/libraries) and supporting Hardhat tasks/scripts used for upgrades and operations.
4+
5+
## Local Setup
6+
7+
1. Initialize submodules (forge-std):
8+
9+
```bash
10+
git submodule update --init --recursive
11+
```
12+
13+
2. Install JS dependencies:
14+
15+
```bash
16+
npm ci
17+
```
18+
19+
3. Install Foundry (forge/anvil/cast):
20+
21+
- https://book.getfoundry.sh/getting-started/installation
22+
23+
## Common Commands
24+
25+
### Format
26+
27+
```bash
28+
forge fmt
29+
npm run prettier
30+
```
31+
32+
### Build / Compile
33+
34+
This repo compiles with multiple Solidity compiler versions (see `hardhat.config.ts`).
35+
36+
```bash
37+
forge build --sizes
38+
npx hardhat compile
39+
```
40+
41+
### Tests
42+
43+
```bash
44+
forge test
45+
npm test
46+
```
47+
48+
Some tests use a local fork (Hardhat `hardhat` network). For fork-based tests you will need an RPC URL in `.env` (for example `BASE_RPC_URL`).
49+
50+
## Diamond-Specific Guidelines
51+
52+
### Storage Safety (Critical)
53+
54+
The diamond’s state is a single `AppStorage` struct stored at slot 0:
55+
- `contracts/Aavegotchi/libraries/LibAppStorage.sol`
56+
57+
Rules of thumb:
58+
- Treat `AppStorage` as a database schema migration.
59+
- Append-only: do not reorder/remove existing fields or change field types.
60+
- If you need new state, add it at the end and consider backfills/init if required.
61+
62+
### msg.sender vs Meta-Transactions
63+
64+
Many auth checks use `LibMeta.msgSender()` (meta-tx aware). If you add new permissioned functions in facets, be deliberate about whether you should use:
65+
- `msg.sender` (direct call only)
66+
- `LibMeta.msgSender()` (supports meta-tx flows)
67+
68+
References:
69+
- `contracts/shared/libraries/LibMeta.sol`
70+
- `contracts/Aavegotchi/facets/MetaTransactionsFacet.sol`
71+
72+
## PR Expectations
73+
74+
- Keep PRs focused and small when possible.
75+
- Include tests (or explain why tests aren’t feasible).
76+
- Don’t commit secrets (`.env`, private keys, API keys).
77+
- Prefer changes that keep local dev flows safe by default (forks/simulations; no accidental broadcasts).
78+

0 commit comments

Comments
 (0)