Skip to content

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
Controller Handles:
  • 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:

RoleDescription
Vault ManagerAdds new vaults to the protocol, removes deprecated vaults, updates vault parameters like caps and target allocations. Critical for protocol expansion.
Price Feed ManagerSets and updates oracle addresses for each asset, configures staleness checks and heartbeat monitoring. Ensures accurate pricing across the protocol.
Rebalancing ManagerAuthorized to trigger rebalancing operations between vaults. Can execute swaps and move assets to maintain target allocations.
Rewards ManagerCollects reward tokens generated by vault strategies (e.g., MORPHO), sells them on DEXes, and converts to base assets. Optimizes protocol yield.
Config ManagerUpdates protocol-wide parameters like slippage tolerances, safety buffer, and operational thresholds. Allows tuning without full upgrades.
Emergency ManagerCan pause deposits, redemptions, or specific vaults in case of exploits or market emergencies.
Periphery ManagerManages peripheral contracts like depositors, swappers, and bridge integrations.
Yield ManagerTriggers 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.