Skip to content

EarnPool — Enable

Overview

Enabling an EarnPool adds a new yield strategy to the vault's whitelist. Once enabled, the Trader can allocate funds to the pool, and its balance is included in totalValues() during settlement.

Access Control

Only the PoolManager role may call enablePool().


Flow

sequenceDiagram
    actor PM as PoolManager
    participant Port as KPortfolio
    participant Pool as EarnPool (new)

    PM->>Port: enablePool(poolAddress)
    Note over Port: Validate pool interface<br/>Add to activePools array
    Port-->>PM: Pool enabled

Preconditions

Condition Detail
Pool address is a valid contract Must implement the IEarnPool interface (valuesOf, deposit, withdraw).
Pool is not already enabled Prevents duplicate entries in the active pools list.
Caller has PoolManager role Enforced via AccessControl.

Security Considerations

  1. Malicious Pool Risk: A whitelisted malicious contract could steal funds deposited by the Trader. The PoolManager role must be held by a multi-sig with thorough contract review before enabling.
  2. Pool Count Bound: Each additional pool increases gas cost of totalValues() during settlement. A maximum pool count should be enforced to prevent out-of-gas reverts.
  3. Adapter Correctness: The EarnPool adapter must correctly translate between the vault's USDC and the underlying protocol's deposit/withdraw mechanics. Incorrect adapters can lead to accounting errors.