# Yearn Roles & Governance

#### Role Architecture

The **Yearn V3 Role Architecture** for a `BaseStrategy` centers around three primary roles: **Manager**, **Keeper**, and **Fee Recipient**. Each role has distinct responsibilities to ensure smooth operations, proper governance, and secure profit realization.

***

**Primary Roles and Responsibilities**

| **Role**          | **Responsibilities**                                                        |
| ----------------- | --------------------------------------------------------------------------- |
| **Manager**       | Controls key parameters, executes emergency functions, and configures fees. |
| **Keeper**        | Triggers state updates via `report()` calls, enabling profit realization.   |
| **Fee Recipient** | Passively receives performance fees during profit distribution.             |

***

**Manager**

The **Manager** oversees the configuration of critical strategy parameters, handles role assignments, and executes emergency controls when needed.

**Responsibilities**:

* **Parameter Control**:
  * Configures `profitMaxUnlockTime` (profit unlocking duration).
  * Sets `performanceFee` (fee percentage).
  * Assigns `performanceFeeRecipient` (fee distribution address).
  * Assigns the `keeper` role.
* **Emergency Functions**:
  * Enables or disables the strategy via the `shutdown` flag.
  * Executes emergency actions through the `emergencyAdmin`.
* **Role Management**:
  * Manages 2-step ownership transfers (`management` and `pendingManagement`).

**Manager-Controlled Fields** (in `StrategyData` struct):

```solidity
struct StrategyData {        
   uint32 profitMaxUnlockTime;     // Unlock duration
   uint16 performanceFee;          // Fee percentage
   address performanceFeeRecipient;// Fee recipient
   address keeper;                 // Keeper address
   address management;             // Current manager
   address pendingManagement;      // Pending manager
   address emergencyAdmin;         // Emergency admin
   bool shutdown;                  // Emergency control
}
```

***

**Keeper**

The **Keeper** is responsible for maintaining strategy operations by periodically calling the `report()` function. This role focuses on ensuring accurate profit realization and portfolio updates.

**Responsibilities**:

* **Report Calls**:
  * Executes `report()` to calculate `totalAssets`, determine profit/loss, and trigger profit unlocking.
  * Updates the `lastReport` timestamp and related state fields.

**Keeper-Accessible Fields** (in `StrategyData` struct):

```solidity
struct StrategyData {      
   uint256 profitUnlockingRate;    // Rate of profit unlocking
   uint96 fullProfitUnlockDate;    // Unlock completion date
   uint96 lastReport;              // Timestamp of last report
}
```

**Key Features of `report()`**:

* Calculates the new `totalAssets`.
* Determines realized profit or loss.
* Sets `profitUnlockingRate` and updates `fullProfitUnlockDate`.
* Records the `lastReport` timestamp for tracking.

The Keeper does not directly control strategy parameters but ensures the system operates within defined configurations by updating state through reporting.

***

**Fee Recipient**

The **Fee Recipient** passively receives performance fees during profit realization.

**Responsibilities**:

* Collects performance fees as specified by the strategy (e.g., 10% of realized profits by default).
* Receives fees directly into the designated address (`performanceFeeRecipient`) during the `report()` process.

The Fee Recipient does not perform any actions or control parameters—it simply receives the allocated fees as part of the profit distribution.
