How se7en-seas/boring-vault works
Project type and purpose
• This is a Solidity/Ethereum smart‐contract project (using Foundry) implementing the “Boring Vault” architecture with three pluggable onchain components—Manager, Teller, Accountant—and a core vault contract. It includes offchain scripts for Merkle tree generation and deployments across multiple EVM chains.
Top‐level structure to architecture domains
• Onchain Contracts (src/)
• src/base – core contracts: BoringVault, ManagerWithMerkleVerification, TellerWithMultiAssetSupport, AccountantWithRateProviders, Roles, Drones, micro-managers.
• src/atomic-queue – atomic withdrawal queue implementation used by the Teller.
• src/base/DecodersAndSanitizers – per-protocol modules that sanitize strategy calls.
• src/interfaces – external protocol interfaces (Aave, Curve, EigenLayer, etc.).
• Offchain Processes (script/, leafs/, resources/)
• script/MerkleRootCreation – builds Merkle trees from strategist leaf JSONs.
• leafs/… – strategist-specific leaf definitions (Decoder addresses, Targets, Selectors, PackedArguments).
• script/ArchitectureDeployments – orchestrates deployment JSONs.
• deployments/… – JSON artifacts recording deployed addresses by network.
• Tooling & CI
• foundry.toml, forge CLI (build/test)
• .github/workflows/test.yml – continuous integration.
• lib/ – onchain libraries (openzeppelin, solmate, OAppAuth, ccip).
• test/ – unit and integration tests.
Main components and relationships
• Core Vault (BoringVault)
• Connects to Manager to validate and execute strategy calls via Merkle proofs.
• Exposes deposit/withdraw hooks used internally by the Teller.
• ManagerWithMerkleVerification
• Reads onchain Merkle root (set at deployment).
• Verifies proofs against Strategist leafs JSON (offchain prepared).
• Delegates calls through DecodersAndSanitizers → Target contracts.
• TellerWithMultiAssetSupport
• Calls into BoringVault for share accounting.
• Uses atomic-queue for permissioned withdrawals.
• Enforces shareLockPeriod & refund logic.
• Queries Accountant for exchange rates.
• AccountantWithRateProviders
• Accepts offchain‐computed share price updates (via oracles/scripts).
• Enforces rate‐limit and bound‐limit on updates.
• Pauses vault on anomalous updates.
• Offchain Merkle & Rate Pipeline
• Strategist authors leaf definitions under leafs/.
• MerkleRootCreation scripts produce a Merkle root and JSON proof store.
• Deployment scripts push root & contract addresses onto each network.
• Offchain oracles (Chainlink, custom) compute share rates → Accountant.
Architectural patterns & principles
• Pluggable modules: core vault delegates Manager, Teller, Accountant.
• Least‐privilege strategies via Merkle‐tree allowlist.
• Permissioned and time-locked asset flows to mitigate MEV.
• Rate‐limited, bound‐limited offchain oracles for manipulation resistance.
• Multi-network deploy artifacts to support Arbitrum, Mainnet, Base, etc.