How sherlock-audit/2025-04-burve works
Project type and purpose
• This is an on‐chain DeFi protocol written in Solidity, organized as a Foundry project.
• It implements both a “multi‐asset” engine (using the EIP‑2535 Diamond proxy pattern) and a “single‐asset” engine for vaults, with pluggable integrations to external protocols (e.g. BGTExchange, Uniswap, pseudo‑ERC4626 vaults, Kodiak).
• It’s intended for deployment on multiple EVM‐compatible chains and audited via the Sherlock contest.
File structure
Top‐level:
• .github / workflows – CI, issue templates
• .gitmodules – 3rd‑party submodules
• README.md – contest & audit scope details
• Burve/ – the actual Foundry project root
Burve/:
• foundry.toml – build/test configuration
• lib/ – Git submodules: Commons (utility library), forge‑std, OpenZeppelin Contracts, Uniswap v3 core
• src/
– core utilities (FullMath.sol, Timed.sol, TransferHelper.sol)
– integrations/
· BGTExchange – on‑chain exchanger interface + impl
· adjustor – classes for on‑chain decimal/peg adjustments (IAdjustor, DecimalAdjustor, FixedAdjustor, etc.)
· pseudo4626 – a no‑op ERC4626 vault shim
– multi/ – “multi‐asset” Diamond implementation
· Diamond.sol + Store.sol + Simplex, Asset, Value, Token, Constants, Adjustor, Closure, Vertex, facets (LockFacet, SwapFacet, VaultFacet, etc.)
– single/ – “single‐asset” implementation
· Burve.sol (entrypoint), Fees.sol, Info.sol, TickRange.sol, IStationProxy
• script/ – deployment scripts and utilities
• test/ – unit tests grouped by feature
README for additional insights
• Project conforms to ERC‑2535 (Diamond standard).
• Integrations handle unusual ERC‑20 behaviors, rebasing, flash mints, etc.
• Off‑chain bots/keepers update adjustors for moving pegs.
• Audit scope focuses on balance invariants, fair earnings, admin parameter limits.
Components and relationships
a. Main on‐chain components:
– Proxy layer
· Diamond proxy (multi)
· Single‐asset proxy (Burve.sol)
– Business logic modules
· Multi facets (LockFacet, SwapFacet, SimplexFacet, ValueFacet, VaultFacet, etc.)
· Single‐asset modules (Fees, Info, TickRange, StationProxy)
· Integrations
· BGTExchanger
· Adjustor variants
· pseudo4626 vault
· Uniswap/Kodiak adapters in single/integrations
– Shared libraries (FullMath, TransferHelper, Timed)
– Storage
· Store.sol (multi)
· E4626 View contracts
– External systems
· ERC20 tokens (including weird tokens)
· ERC4626 vaults
· Off‐chain keepers/ bots
– Deployment & testing
· Foundry scripts
· GitHub workflows
b. Interactions & data flow
– User calls → Proxy → facet entrypoint → Store.sol → underlying modules → external protocols (ERC20 vaults, Uniswap pools) → state update → events
– BGT earnings flow: user action → BGTExchange → station proxy → user harvest
– Adjustor: off‑chain price peg updates → Adjustor contracts → facets read adjusted values
c. Architectural patterns & principles
– EIP‑2535 Diamond pattern for extensibility (facets + proxy + central storage)
– Modular “single” vs. “multi” engine separation
– Strategy pattern for integrations (IAdjustor, IBGTExchanger)
– Use of well‑tested libraries (OpenZeppelin, Commons)
d. Key technologies & frameworks
– Solidity (0.8.x)
– Foundry (forge‑std tests, foundry.toml)
– Git submodules for shared libs
– EIP‑2535 Diamond proxy
– External integrations: Uniswap v3 core, OpenZeppelin Contracts