contracts icon indicating copy to clipboard operation
contracts copied to clipboard

House Protocol E2E tests

Open zzzuhaibmohd opened this issue 4 months ago • 0 comments

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.sol covering 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

  1. Setup and Configuration: Validates initial module parameters and role assignment
  2. Bonding Curve Purchase: Tests issuance token acquisition through funding manager
  3. Borrowing Process: Validates loan creation, collateral locking, and state tracking
  4. Repayment Process: Tests loan repayment calculation and collateral unlocking
  5. 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.

zzzuhaibmohd avatar Oct 01 '25 07:10 zzzuhaibmohd