Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 3.29 KB

File metadata and controls

45 lines (33 loc) · 3.29 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project

A yield farming aggregator: YieldAggregator.sol routes user deposits through protocol adapters (AaveV3Adapter.sol, CompoundV3Adapter.sol) implementing a shared IProtocolAdapter interface (deposit/withdraw/getShareValue). Auto-compounding/strategy-switching is planned via a Chainlink CRE keeper (see yield-aggregator-compounder/) but not yet implemented.

The repo has three distinct areas with separate toolchains:

  • src/, test/, lib/ — the Foundry/Solidity contracts (primary focus of most work)
  • frontend/ — Next.js 15 + RainbowKit + wagmi dapp (own package.json, npm run dev)
  • yield-aggregator-compounder/ — Chainlink CRE workflow (YAML config, not Solidity)

onboarding.md (a security-review onboarding doc) is a more accurate architecture reference than README.md, which is mostly empty headers.

Build, test, lint (Foundry)

CI (.github/workflows/test.yml) runs, in order:

forge fmt --check
forge build --sizes
forge test -vvv

Match this before considering contract work done.

  • Fork tests hit live Ethereum mainnet (vm.createSelectFork("mainnet_eth") in test/unit/YieldAggregatorTest.t.sol and test/fuzz/Invariants.t.sol), using deal()-funded USDC against real Aave/Compound deployments. They require a working RPC URL. foundry.toml's mainnet_eth endpoint reads ${ETH_MAINNET_RPC_URL} — note that onboarding.md documents a different variable name (MAINNET_RPC_URL); when in doubt, foundry.toml is what Foundry actually reads.
  • StrategyManager.sol is excluded from compilation via foundry.toml's skip list — it's an intentional stub (all internal functions are no-ops), not a build error.
  • OracleLib.sol is also an intentional empty placeholder for future work.
  • foundry.toml [lint] excludes mixed-case-function and custom-errors from enforcement.
  • Invariant tests run with runs = 1000, depth = 128, fail_on_revert = false.
  • No script/ directory exists yet — there is no forge-script deployment flow in this repo currently.

Code style (contracts)

  • Custom errors only, no require strings. Namespaced as ContractName__ErrorName (e.g. YieldAggregator__InsufficientBalance).
  • File/contract layout follows the Cyfrin/Patrick-Collins convention: version pragma → imports → errors, then type declarations → state variables → events → modifiers → functions (constructor/receive/fallback/external/public/internal/private/view-pure), with ////... SECTION ...//// banner comments dividing groups.
  • NatSpec (@title, @author, @notice, @dev) is expected on contracts and most functions/errors.

Known issues / caveats (from onboarding.md)

  • getPositionValue/getYieldEarned are not view — they call into live adapter state.
  • Withdrawal uses swap-and-pop on the positions array, which shifts indices; off-chain caches of position index can go stale.
  • YieldAggregator__InvalidSharesReceived is effectively dead code.
  • No minimum-deposit enforcement — dust/rounding risk, especially in the Compound V3 adapter.
  • AaveV3Adapter withdrawals deliberately subtract 1 wei as a rounding buffer to avoid NOT_ENOUGH_AVAILABLE_USER_BALANCE reverts — this is intentional, not a bug.