// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @notice Minimal market stub implementing AereInsuranceFund's /// IAereLendingMarketForFund. Lets a test pin an EXACT debt balance so /// the fund's clamp-then-cap ordering can be exercised at precise /// boundaries, free of the per-second interest drift the real /// AereLendingMarket introduces over the 7-day registration timelock. contract MockDebtMarketForFund { address public immutable debtToken; mapping(address => uint256) public debt; constructor(address _debtToken) { debtToken = _debtToken; } function DEBT_TOKEN() external view returns (address) { return debtToken; } function setDebt(address user, uint256 amount) external { debt[user] = amount; } function debtBalance(address user) external view returns (uint256) { return debt[user]; } /// @notice Pulls `amount` of the debt token from the caller (the fund) and /// reduces the stored debt, mirroring a real repay. function repayOnBehalfOf(address account, uint256 amount) external { require(IERC20(debtToken).transferFrom(msg.sender, address(this), amount), "pull failed"); uint256 d = debt[account]; debt[account] = amount >= d ? 0 : d - amount; } }