How cyfrin/2024-12-quantamm works
Main Components and Architecture
a) Core Protocol Layer
• QuantAMMWeightedPool (Central component)
• UpdateWeightRunner (Weight management system)
• Rules Engine (Strategy implementation)
• Oracle System
b) Integration Layer
• Balancer V3 Integration
• External Oracle Integration
• Pool Hooks System
c) Infrastructure Layer
• Storage Systems
• Security Controls
• Administrative Systems
Component Relationships
a) Primary Flow:
Traders/LPs -> Balancer V3 Vault -> QuantAMMWeightedPool -> UpdateWeightRunner -> Rules Engine -> Oracles
b) Secondary Flows:
UpdateWeightRunner -> QuantAMMStorage
Rules -> QuantammBasedRuleHelpers
Pool Hooks -> QuantAMMWeightedPool
Detailed Component Breakdown
a) QuantAMMWeightedPool:
• To: Balancer V3 Vault, UpdateWeightRunner
• Interfaces: IQuantAMMWeightedPool
• Weight management, trading functions
b) UpdateWeightRunner:
• To: Rules Engine, Oracles
• Weight calculation flow
• Update intervals
c) Rules Engine:
• Rule types (Momentum, Antimomentum, etc.)
• To: Base rule components
• Strategy calculation flow
d) Oracle System:
• ChainlinkOracle, MultiHopOracle
• To: External price feeds
• Data flow paths
Administrative Controls
Show:
• QuantAMM Admin controls
• Pool Owner permissions
• Emergency systems
• Timelock mechanisms
Implementation Notes
• Clear separation between Balancer V3 infrastructure and QuantAMM additions
• Strategy execution flow
• Oracle integration points
• Security boundaries between trusted and untrusted components
Technical Details
Specific technical implementations:
• Storage packing (9dp resolution)
• Oracle caching system
• Guard rail implementation
• Weight update mechanisms
Interaction Flows
Processes:
• LP deposit/withdrawal flow
• Trading flow
• Weight update flow
• Strategy execution flow
Remember to include version information and date, as this is a protocol under active development with multiple audit phases.