contracts
contracts copied to clipboard
House Protocol E2E tests
Overview
Implemented comprehensive end-to-end testing for the House Protocol Lending Facility that validates the complete borrowing lifecycle with dynamic fee calculation and proper integration with the bonding curve funding manager.
File to Review
https://github.com/33Audits/inverter-contracts/blob/feat/house-protocol-e2e-tests/test/e2e/logicModule/LM_PC_Lending_Facility_v1_E2E.t.sol
Key Changes
-
Complete E2E Test Suite: Added
LM_PC_Lending_Facility_v1_E2E.t.solcovering the full lending facility lifecycle - Integration Testing: Validates proper integration between lending facility, bonding curve funding manager, and dynamic fee calculator
- State Management: Comprehensive validation of loan creation, tracking, and repayment state changes
Test Coverage
Setup and Configuration
- Initial module configuration validation (borrowable quota, max leverage)
- Role-based access control setup
- Module factory integration and orchestrator deployment
Bonding Curve Integration
- Issuance token purchase from discrete bonding curve
- Token balance verification and state tracking
- Funding manager interaction validation
Borrowing Flow
- Collateral token borrowing against locked issuance tokens
- Loan creation with unique ID generation
- Loan state validation (active status, principal amount, locked tokens)
- Outstanding loan amount tracking
Repayment Flow
- Loan repayment calculation based on current floor price
- Full loan repayment and closure
- Issuance token unlocking verification
- Outstanding loan amount reset validation
Test Scenarios
- Setup and Configuration: Validates initial module parameters and role assignment
- Bonding Curve Purchase: Tests issuance token acquisition through funding manager
- Borrowing Process: Validates loan creation, collateral locking, and state tracking
- Repayment Process: Tests loan repayment calculation and collateral unlocking
- State Management: Verifies proper cleanup and state reset after repayment
The E2E test ensures the lending facility operates correctly within the complete Inverter ecosystem, validating all integration points and state management requirements.