EarnPool — Disable
Overview
Disabling an EarnPool removes a yield strategy from the vault's active whitelist. The pool's balance is excluded from future totalValues() calculations. Funds should be fully withdrawn from the pool before disabling.
Access Control
Only the PoolManager role may call disablePool().
Flow
sequenceDiagram
actor PM as PoolManager
actor Tr as Trader
participant Port as KPortfolio
participant Pool as EarnPool (target)
Note over Tr,Pool: Step 1: Withdraw all funds first
Tr->>Port: withdrawPool(poolAddress, totalBalance)
Port->>Pool: withdraw(totalBalance)
Pool-->>Port: USDC returned
Note over PM,Port: Step 2: Disable the pool
PM->>Port: disablePool(poolAddress)
Note over Port: Remove from activePools array
Port-->>PM: Pool disabled
Preconditions
| Condition | Detail |
|---|---|
| Pool is currently enabled | Cannot disable a pool that is not in the active list. |
| Pool balance is zero (recommended) | Disabling with remaining funds would exclude those assets from NAV calculations, causing accounting discrepancies. |
Caller has PoolManager role |
Enforced via AccessControl. |
Security Considerations
- Stranded Funds: If a pool is disabled while it still holds funds, those assets become invisible to
totalValues(). PPS calculations will understate NAV, potentially allowing exit at a loss for remaining holders. - Ordering: Always
withdrawPool()beforedisablePool(). The protocol should ideally enforce a zero-balance check on disable.