Appearance
Repayment Flow
This diagram shows the complete flow when a borrower repays interest and/or principal via StructuredPool.
Process Overview
- Forced Interest Accrual - Calculate current interest debt
- Split Payment - Divide payment between interest and principal
- Pay Fees - Protocol and underwriter fees deducted from interest
- Route to Reserve - Transfer net amounts and update accounting
Key Points
- Payment Priority: Interest is paid first, then principal
- Fee Deduction: Protocol and underwriter fees are deducted from gross interest before distribution to LPs
- Interest Increases Pool Value: Net interest payments increase
virtualBalance, making LPs' shares worth more - Principal Restores Credit: Principal repayment reduces
_outstandingDebt, allowing borrower to draw again - Direct Transfers: Fees go directly from payer to treasury/underwriter; net amounts to Reserve
Accounting Effects
Interest Payment
- ✅ Protocol fee → Treasury (e.g., 5% of gross interest)
- ✅ Underwriter fee → Underwriter (if underwriter exists)
- ✅ Net interest increases
virtualBalance(available for withdrawal) - ✅ Increases
totalNetInterestEarned(performance metric) - ✅ Increases share price (LPs earn net returns)
Principal Payment
- ✅ Decreases
_outstandingDebt(borrower owes less) - ✅ Decreases
virtualDeployed - ✅ Increases
virtualBalance(capital back in pool) - ✅ Decreases
outstandingDebt
Related Flows
- Drawdown Flow - How borrower draws capital
- Deposit Flow - How LPs earn from interest