Comptroller (Isolated Pools)
The Comptroller contract for isolated liquidity pools serves as the risk management layer for each individual pool within the Rheofi Protocol.each isolated pool deploys its own Comptroller instance, enabling fully customizable risk parameters tailored to the specific assets and risk profile of that pool.
Overview
The isolated pool Comptroller governs all market interactions within its pool, including supply, borrow, liquidation, and reward distribution. Pool creators and governance can configure collateral factors, liquidation incentives, supply/borrow caps, and other risk parameters independently of other pools in the protocol.
Each Comptroller maintains its own set of listed markets, user memberships, and risk configurations, providing complete isolation from other pools.
Key Functions
enterMarkets
Allows a user to enable specific assets as collateral within the pool.
function enterMarkets(address[] calldata rTokens) external returns (uint256[] memory);
- rTokens: Array of RToken addresses to enable as collateral.
- Returns an array of error codes (0 = success).
exitMarket
Removes an asset from the caller's collateral set, provided the removal does not create a shortfall.
function exitMarket(address rTokenAddress) external returns (uint256);
supportMarket
Lists a new RToken market within the pool. Restricted to governance or authorized callers.
function supportMarket(IRToken rToken) external;
setCollateralFactor
Configures the collateral factor for a given market, determining how much borrowing power each unit of collateral provides.
function setCollateralFactor(
IRToken rToken,
uint256 newCollateralFactorMantissa,
uint256 newLiquidationThresholdMantissa
) external;
setMarketBorrowCaps / setMarketSupplyCaps
Sets borrow and supply caps for markets, restricting the maximum amount that can be borrowed or supplied.
function setMarketBorrowCaps(IRToken[] calldata rTokens, uint256[] calldata newBorrowCaps) external;
function setMarketSupplyCaps(IRToken[] calldata rTokens, uint256[] calldata newSupplyCaps) external;
liquidateAccount
Liquidates an account that has fallen below the required collateral threshold.
function liquidateAccount(
address borrower,
LiquidationOrder[] calldata orders
) external;
Access Control
All administrative functions are gated through the AccessControlManager, ensuring only authorized governance actions can modify pool parameters. The Comptroller validates permissions for every privileged operation before execution.