This repo is Aave V3 Origin — a Foundry-based Solidity smart-contract codebase. There is no web server, database, API, or other long-running service. "Running the application" means compiling the contracts and running the Foundry test suite against Foundry's built-in in-memory EVM. There is nothing to start as a daemon.
forge(Foundry) is installed at~/.foundry/binand is onPATHvia~/.bashrc(installed withfoundryup, currently v1.7.x). Ifforgeis ever missing in a non-login shell, runexport PATH="$HOME/.foundry/bin:$PATH".- Solidity dependencies are git submodules (
lib/forge-std,lib/solidity-utils, plus nested OpenZeppelin modules). They must be initialized (git submodule update --init --recursive); the startup update script handles this. Builds fail with missing-import errors if they are absent. - Node/npm deps (
npm install) are only needed forprettier(lint) andchangesets(release) — not for compiling or testing contracts. - Fuzzing toolchain is installed in
~/.local/bin(onPATHvia~/.bashrc):echidna(v2.3.x),medusa(v1.5.x), pluscrytic-compileandsolc-select(withsolc 0.8.27selected globally, matchingfoundry.toml). Both fuzzers compile throughcrytic-compile, which auto-detects the Foundry project and runsforge buildunder the hood. If they are missing in a non-login shell, runexport PATH="$HOME/.local/bin:$PATH"(andsolc-select use 0.8.27ifsolcresolves to the wrong version).
- Build:
forge build - Test (standard):
make test(=forge test -vvv --no-match-contract DeploymentsGasLimits). Plainforge test --no-match-contract DeploymentsGasLimitsis faster/quieter. TheDeploymentsGasLimitssuite is intentionally excluded from the standard run (gas-snapshot assertions). - Single contract:
make test-contract filter=<ContractName> - Lint:
npm run lint(prettier check);npm run lint:fixto auto-format. - Coverage:
make coverage(needslcov/genhtml). - 1inch Earn tests:
make test-1inch-earn(forge unit/e2e + mainnet-fork whenRPC_MAINNETis set).make test-1inch-earn-anvilruns the 17-stage Anvil integration harness (tests/1inch-earn/anvil/run-anvil-integration.sh): the real deploy scripts + live runtime scenarios viacast, including real-token multi-asset flows.
- Fund real ERC20s with
deal_erc20 <token> <holder> <rawAmt>— the cast equivalent of forge'sdeal. It auto-detects thebalanceOfmapping slot by probing base slots 0..30 and writes viaanvil_setStorageAt(verified for WETH slot 3 / WBTC+wstETH slot 0 / USDT slot 2 / USDC+cbBTC slot 9). Use this instead of hunting for mainnet whales, whose balances drift and break reruns.ensure_supply_wethwraps real ETH (so WETH9 stays ETH-backed for gateway unwraps). - Determinism on multiplexed public RPCs (default
ethereum-rpc.publicnode.com): the harness pins ~32 blocks behind HEAD (FORK_BLOCK=<n>to override), sends every pool action with an explicit--gas-limitsocastSKIPS the estimationeth_call(that estimation is what transiently reverts on a cold fork read), and gates progression on index-immunescaledBalanceOfreads (neverbalanceOf, which multiplies by a lazily-fetched reserve index that can read 0) with a mine+poll retry via theensure_*helpers. Expect-revert checks deliberately keep estimation (no--gas-limit). A dedicated single-node RPC removes all nondeterminism. - When adding a scenario: reuse
ensure_supply/ensure_supply_weth/ensure_borrow/ensure_debt_cleared/ensure_withdrawn(idempotent, effect-gated) rather than rawcast send, and assert withbn_*/sbal/balhelpers. Anvil default accounts #0..#9 are the available signers (#0 is the deployer/KYC owner). - Stateful fuzzing (invariants):
make echidna/make medusa. These run indefinitely by design (echidna_config.yamltestLimit: 20000000;medusa.jsontimeout: 0), so run them in a background/tmux session and stop them manually. See the fuzzing gotcha below before relying on them.
- Reusable agent skills are installed under
.agents/skills/(vianpx skills, tracked inskills-lock.json) and indexed by the always-on Cursor rule.cursor/rules/agent-skills.mdc. Load the relevantSKILL.mdwhen its trigger matches:solidity-auditor(whole-file/repo security review),differential-review(security review of a PR/diff),entry-point-analyzer(entry-point / access-control mapping),token-integration-analyzer(token listing / weird-token checks),fp-check(verify a suspected finding),variant-analysis(hunt variants of a confirmed bug),x-ray(pre-audit readiness report),fizz(Echidna/Medusa invariant suites — note it may add a[profile.fuzz]block tofoundry.toml),upgrade-solidity-contracts(proxy/upgrade/storage-layout work),develop-secure-contractsandsetup-solidity-contracts(OpenZeppelin integration/setup). - Manage with
npx skills list/npx skills update.
- Running the test suite writes generated JSON files into
reports/(Foundryfs_permissionsgrant read-write there). These are gitignored test artifacts and are also excluded fromnpm run lintvia.prettierignore(as are the vendored skills under.agents/), sonpm run lintis clean on a fresh checkout and after test runs. - The default
forge testrun needs no.envand no network..envRPC endpoints (see.env.example) are only for fork tests and deployment scripts; deployment additionally requires a Ledger. echidna/medusaare installed (see Toolchain), butmake echidnaandmake medusacurrently fail on the committed configs due to pre-existing config/source drift, not a tooling problem: bothtests/invariants/_config/echidna_config.yamlandmedusa.jsonstill declare a predeployedEModeLogiclibrary (0xf09), butEModeLogicno longer exists insrc/(e-mode logic was refactored into other libraries). Symptoms after a successful ~15scrytic-compile/forge build: echidna printsGiven contract "EModeLogic" not found in given file; medusa printsEModeLogic was specified in the predeployed contracts but was not found in the compilation artifacts. The binaries themselves are verified working on a standalone harness. Fixing the campaigns requires updating those config files (out of scope for env setup).slitheris not installed; both fuzzers emit a non-fatal warning and continue without it.Certorais also not installed. Installingslither(pip3 install --user slither-analyzer) is optional and only improves fuzzing effectiveness.