Skip to content

EarnPool — Deposit

Overview

The Trader allocates idle USDC from KPortfolio into an enabled EarnPool to generate yield. This is a manual, discretionary operation — the protocol does not auto-allocate.

Access Control

Only the Trader role may call depositPool().


Flow

sequenceDiagram
    actor Tr as Trader
    participant Port as KPortfolio
    participant Pool as EarnPool
    participant Proto as Underlying Protocol (Aave/Morpho/HLP)

    Tr->>Port: depositPool(poolAddress, amount)
    Port->>Port: Verify pool is enabled
    Port->>Pool: deposit(amount)
    Pool->>Proto: supply/deposit USDC
    Proto-->>Pool: Receipt (aToken / share)
    Pool-->>Port: Deposit confirmed
    Port-->>Tr: Success

Step-by-Step

Step Actor Action Detail
1 Trader Select target pool and amount. Off-chain decision based on allocation targets (e.g., 80% Aave, 20% Morpho).
2 Trader Call deposit. portfolio.depositPool(poolAddress, amount)
3 KPortfolio Validate. Confirm pool is in the enabled whitelist. Confirm sufficient idle USDC.
4 KPortfolio Transfer to pool. USDC sent to EarnPool adapter via SafeERC20.
5 EarnPool Deposit to protocol. Adapter-specific logic (e.g., Aave pool.supply(), Morpho vault.deposit()).

Preconditions

Condition Enforcement
Pool is enabled Pool must be in activePools whitelist.
Sufficient idle USDC in Portfolio USDC.balanceOf(portfolio) >= amount
Caller has Trader role AccessControl modifier
Vault is not paused whenNotPaused modifier

Security Considerations

  1. Trader Cannot Steal: The Trader can only move funds to whitelisted pools — never to arbitrary addresses. This limits the blast radius of a compromised Trader key.
  2. Over-Allocation: If the Trader deploys all idle USDC, the vault may have insufficient liquidity for user withdrawals, triggering pool withdrawals (with potential slippage) during redemptions.