Component: Contracts (Lending) | Effort: 4-5 days | Priority: MEDIUM
Current State
No reserve fund or protocol revenue mechanism. All interest goes to depositors.
Missing Functions
Reserve fund functions:
set_reserve_factor() - Set percentage of interest for reserves (admin)
get_reserve_factor() - Get current reserve factor
get_reserve_balance() - Get accumulated reserves
withdraw_reserves() - Withdraw reserves (admin/treasury)
get_protocol_revenue() - Get total protocol revenue
allocate_reserves() - Allocate reserves to insurance fund
Why This Matters
- Sustainability: Protocol needs revenue for operations
- Insurance: Reserves can cover bad debt
- Governance: Revenue funds development and grants
- Standard practice: All lending protocols have reserve factor
Current Gap
The calculate_interest() function at line 385 doesn't split interest between depositors and protocol. All interest goes to pool.
Tasks
Acceptance Criteria
- Reserve factor configurable
- Interest split correctly
- Reserves accumulate properly
- Admin can withdraw reserves
- Tests validate calculations
- Documentation explains reserve model
Component: Contracts (Lending) | Effort: 4-5 days | Priority: MEDIUM
Current State
No reserve fund or protocol revenue mechanism. All interest goes to depositors.
Missing Functions
Reserve fund functions:
set_reserve_factor()- Set percentage of interest for reserves (admin)get_reserve_factor()- Get current reserve factorget_reserve_balance()- Get accumulated reserveswithdraw_reserves()- Withdraw reserves (admin/treasury)get_protocol_revenue()- Get total protocol revenueallocate_reserves()- Allocate reserves to insurance fundWhy This Matters
Current Gap
The
calculate_interest()function at line 385 doesn't split interest between depositors and protocol. All interest goes to pool.Tasks
set_reserve_factor()(admin only)withdraw_reserves()(admin/treasury only)get_reserve_balance()viewallocate_reserves()to insurance fundAcceptance Criteria