How struct-defi/struct-contracts works
Component Relationships
a) Control Flow:
• Factory → Product creation
• Product → YieldSource interactions
• Product → SPToken minting/burning
b) Data Flow:
• User deposits → Products
• Products → Yield Sources → External protocols
• Price feeds → Oracle → Products
• Protocol fees → DistributionManager
State Transitions
OPEN → INVESTED → WITHDRAWN
Important Details
a) Role-based Access:
• GOVERNANCE, KEEPER, PAUSER, PRODUCT, FACTORY roles
b) Integration Points:
• Chainlink price feeds
• DEX interactions (TraderJoe, GMX)
• Reward distribution paths
Technical Specifications
Annotations for:
• Smart contract inheritance relationships
• Key parameters (leverage thresholds, durations)
• Protocol fees flow
• Token relationships (SPToken to deposits)
Integration flexibility with different protocols
Remember to include the three main states (OPEN, INVESTED, WITHDRAWN) as they are crucial to the protocol's operation, and clearly show how funds flow through the system during each state.