How code-423n4/2025-03-silo-finance works
Main Components
• Vault Module – The “silo-vaults” directory includes the main vault contracts such as SiloVault, IdleVault, VaultsFactory, and related libraries (e.g., ConstantsLib, ErrorsLib, SiloVaultActionsLib). These contracts implement ERC4626 functionality and are forked/adapted from MorphoVault, with extra features for rewards management.
• Incentives Module – Found mainly in “silo-core/contracts/incentives” and “silo-vaults/contracts/incentives”. These components manage reward distribution, including gauge-like incentive controllers and factories. Key contracts here include SiloIncentivesController, BaseIncentivesController, and DistributionManager.
• Oracle Module – Organized under “silo-oracles.” This module integrates external data feeds from Chainlink, Dia, UniswapV3, and other oracle sources, which provide essential price or rate data.
• Governance and Token Locking – The “ve-silo” directory holds contracts related to governance, vote-escrow, and related modules to manage governance tokens and staking.
• Certification and Verification – The “certora” directory contains formal verification specs and configuration files to ensure code integrity.
• Deployment and Testing Frameworks – Multiple directories (like “silo-core/deploy”, “silo-foundry-utils”, “test”, and “pvt”) support deployment scripts, automated tests (via Foundry and Hardhat), and simulation setups.
• Proposals and Documentation – The “proposals” and various README/md files provide documentation, audit details, and deployment input files.
Relationships and Interactions
• The Vault Module is the core of the protocol, with vault contracts being deployed via factory patterns (using OpenZeppelin’s Clones) and interacting with external ERC4626 vaults.
• The Incentives Module attaches to vaults – reward distribution logic is executed after user interactions within the vaults (deposit, withdraw) and relies on libraries and controllers in “silo-core.”
• The Oracle Module feeds external data (price, interest rate models) to both vault operations and incentive calculations.
• Governance (through ve-silo) governs key protocol roles (owner, curator, allocator, guardian) and interacts with incentive and vault modules to manage administration and reward parameters.
• The Certification/Verification layer provides formal proofs and configuration details to ensure all contracts adhere to expected invariants and behaviors.
• Deployment scripts and testing utilities tie all these systems together, ensuring that on-chain interactions follow the design and that testing (including Foundry and formal proofs) is up-to-date.
Architectural Patterns and Design Principles
• Modular Design – The project is clearly segmented into directories (silo-core, silo-vaults, silo-oracles, ve-silo), reflecting a microservices-like or component-based approach.
• Factory & Proxy Patterns – Vaults and incentives are deployed using factory patterns (e.g., Clones) that allow for flexible and standard deployment.
• Layered Architecture – Core business logic (vault management) is separated from reward/incentive mechanisms and from external oracle integrations.
• Reusability and Formal Verification – The integration of Certora specs and extensive testing structure emphasizes ensuring correctness and safe code reuse across modules.
Relevant Technologies, Frameworks, and Libraries
• Solidity and ERC4626 standards – Core operations for vaults.
• OpenZeppelin libraries – For proxies, access control, ERC20, SafeERC20, EnumerableSet, and more.
• Morpho-blue libraries – For additional utilities migrated to SiloVault.
• Foundry and Hardhat – For deployment scripting and testing.
• External integrations – Chainlink, Dia, Uniswap (v3) among others.
• Certora – For formal verification and ensuring invariants.