Controller Overview
The Controller is the brain of the Generic Protocol. It orchestrates everything: calculating how many shares you get for your deposits, managing vaults, determining redemption values, and handling yield distribution. Every major action flows through the Controller.
What is the Controller?
The Controller is the central smart contract that:
- Calculates Share Values - Determines how many GenericUnit tokens you get for deposits
- Manages Vaults - Oversees all vaults and their strategies
- Handles Redemptions - Calculates what collateral you receive when redeeming
- Distributes Yield - Allocates earnings to share holders
- Enforces Limits - Ensures vault caps and diversification rules
- Integrates Oracles - Uses Chainlink for accurate pricing
- Coordinates Rebalancing - Swaps between assets to maintain targets
- Controls Access - Manages who can perform sensitive operations
Think of it as the operating system for the protocol - everything goes through it.
Separation of Concerns
Vaults Handle:- Storing collateral
- Deploying to strategies
- Managing liquidity
- Business logic
- Pricing calculations
- Cross-vault coordination
- Access control
This separation means vaults can be simple, secure, and immutable while the Controller handles complex logic and can be upgraded.
Roles (Managers)
The Controller uses a multi-role access control system for security and operational flexibility:
| Role | Description |
|---|---|
| Vault Manager | Adds new vaults to the protocol, removes deprecated vaults, updates vault parameters like caps and target allocations. Critical for protocol expansion. |
| Price Feed Manager | Sets and updates oracle addresses for each asset, configures staleness checks and heartbeat monitoring. Ensures accurate pricing across the protocol. |
| Rebalancing Manager | Authorized to trigger rebalancing operations between vaults. Can execute swaps and move assets to maintain target allocations. |
| Rewards Manager | Collects reward tokens generated by vault strategies (e.g., MORPHO), sells them on DEXes, and converts to base assets. Optimizes protocol yield. |
| Config Manager | Updates protocol-wide parameters like slippage tolerances, safety buffer, and operational thresholds. Allows tuning without full upgrades. |
| Emergency Manager | Can pause deposits, redemptions, or specific vaults in case of exploits or market emergencies. |
| Periphery Manager | Manages peripheral contracts like depositors, swappers, and bridge integrations. |
| Yield Manager | Triggers yield distribution. |
Each role is assigned and can be revoked by governance.
Upgradability
The Controller is upgradeable to allow protocol evolution while maintaining security. This allows the protocol to adapt to DeFi innovation while protecting existing user deposits.