How lindy-labs/sandclock-contracts works
Main Components
a. Vault Layer:
• Five main vaults (scWETH, scUSDC, scUSDCv2, scWETHv2, scLUSD)
• SQuartz staking contract separately
• Each vault should be represented as a distinct component
b. Protocol Integration Layer:
• External DeFi protocols (Lido, Curve, Balancer, Aave V3, Uniswap V3, Liquity)
• Price feeds (Chainlink)
• 0x Exchange router
c. Adapter Layer (for v2 vaults):
• Adapter architecture for scUSDCv2 and scWETHv2
• Adapter connections to multiple lending protocols
d. Keeper System:
• Keeper bot infrastructure
• Rebalancing flows
Component Relationships
a. User Interaction Flow:
• Entry points for user deposits (WETH, USDC, LUSD, Quartz)
• Token flow for minting vault shares
• Redemption paths
b. Strategy Flows:
• Leveraged positions
• Rebalancing paths
• Profit reinvestment routes
Specific Implementation Details
• Rectangles: Main vault contracts
• Hexagons: External protocols
• Diamonds: Price oracles
• Rounded rectangles: Adapters
• Circles: Keeper systems
• Blue: Core vault contracts
• Green: External protocols
• Yellow: Oracle systems
• Purple: Adapter layer
• Red: Critical paths/risk areas
User Interaction Layer
↓
Vault Layer (ERC4626 Vaults)
↓
Adapter Layer (for v2 vaults)
↓
Protocol Integration Layer
↓
External DeFi Protocols & Oracles
Important Elements to Highlight
• Security boundaries (based on audit reports in /audits)
• Multi-sig controlled components
• Keeper bot interaction points
• Risk exposure paths
• ERC4626 compliance interfaces
Technical Details
• Interface connections (from /src/interfaces)
• Price feed integrations
• Testing boundaries (based on /test structure)
• Contract interactions
Documentation References
References to:
• Audit reports location
• Certora formal verification specs
• Testing coverage metrics
• External protocol documentation
Remember to include version control information and deployment addresses in supplementary documentation, as indicated by the presence of deployment scripts in the /script directory.
This architecture should emphasize the modular nature of the system, particularly the adapter pattern used in v2 vaults, while clearly showing the risk exposure paths through various external protocols.