How stabilitydao/stability-contracts works
Project type and purpose
• This is a modular Solidity smart-contract suite for “asset management, liquidity mining, and yield farming.”
• It comprises core vault contracts, strategy modules, adapters/integrations to external DeFi protocols, periphery helpers, and tokenomics.
File structure
• Top-level folders:
– src/core: core vault logic, proxy patterns
– src/adapters: protocol-agnostic adapters for integrations
– src/integrations: protocol-specific connectors (Aave, Uniswap v3, Curve, etc.)
– src/strategies: strategy blueprints developers deploy into vaults
– src/periphery: external entry points (e.g., router, multicall)
– src/tokenomics: token issuance and vesting contracts
• scripts/: deployment/upgrade scripts (core, periphery, strategy, vaults, tokenomics)
• lib/: pinned external Solidity libraries (OpenZeppelin, Solady, forge-std)
• tests/: contract test suites mapped to each module
• config files: foundry.toml (build & test runner), slither.config.json (static analysis)
Leverage README and Guides
• The README references developer- and admin-guides (guides/Core.md, Strategy.md, ADM.md).
• Guides detail architecture patterns (e.g., upgradable proxy, strategy lifecycle, adapter pattern).
Main components & their relationships
a. On-chain framework (all within the EVM boundary):
1. Core Vault System
– VaultFactory / ProxyAdmin
– VaultBase (ERC-4626 style shares)
– Governance roles (ADM)
2. Strategy Layer
– BaseStrategy interface
– Concrete strategy contracts that Vaults delegate to
3. Adapter Layer
– Generic Adapter interfaces
– Mapping of Adapter ➞ Integration modules
4. Integration Layer
– Protocol connectors (AaveAdapter, UniswapV3Pool, CurvePool, etc.)
– Oracles & price feeds (Chainlink, DIA)
5. Periphery
– Router / multicall helpers / emergency withdraw
6. Tokenomics
– Platform token contract
– Emission schedule / vesting
b. Off-chain components:
– Deployment scripts (script/deploy-*)
– CI/CD pipelines (GitHub workflows lint, test, slither)
– Audits & coverage reports
Architectural patterns and design principles
• Upgradable proxies (src/core/proxy)
• ERC-4626 vault pattern (deposit/withdraw, shares)
• Adapter pattern: decouple core logic from protocol specifics
• Strategy plug-in: vaults target arbitrary strategies at runtime
• Separation of concerns: core ≠ periphery ≠ integrations