@@ -189,7 +189,7 @@ contract BaseTest is Test {
189
189
amountBorrowed.wDivDown (marketParams.lltv).mulDivDown (ORACLE_PRICE_SCALE, priceCollateral);
190
190
amountCollateral = bound (amountCollateral, 0 , Math.min (maxCollateral, MAX_COLLATERAL_ASSETS));
191
191
192
- vm.assume (amountCollateral > 0 );
192
+ vm.assume (amountCollateral > 0 && amountCollateral < maxCollateral );
193
193
return (amountCollateral, amountBorrowed, priceCollateral);
194
194
}
195
195
@@ -330,13 +330,15 @@ contract BaseTest is Test {
330
330
{
331
331
Id _id = _marketParams.id ();
332
332
333
- uint256 collateral = morpho.collateral (_id, borrower);
334
333
uint256 collateralPrice = IOracle (_marketParams.oracle).price ();
335
- uint256 maxRepaidAssets = morpho.expectedBorrowAssets (_marketParams, borrower);
334
+ uint256 borrowShares = morpho.borrowShares (_id, borrower);
335
+ (,, uint256 totalBorrowAssets , uint256 totalBorrowShares ) = morpho.expectedMarketBalances (_marketParams);
336
+ uint256 maxRepaidAssets = borrowShares.toAssetsDown (totalBorrowAssets, totalBorrowShares);
336
337
uint256 maxSeizedAssets = maxRepaidAssets.wMulDown (_liquidationIncentiveFactor (_marketParams.lltv)).mulDivDown (
337
338
ORACLE_PRICE_SCALE, collateralPrice
338
339
);
339
340
341
+ uint256 collateral = morpho.collateral (_id, borrower);
340
342
return bound (seizedAssets, 0 , Math.min (collateral, maxSeizedAssets));
341
343
}
342
344
0 commit comments