From de77d30ae3b9cb678798acf6fa1228e644c3b306 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Mon, 29 Jan 2024 14:57:25 +0100 Subject: [PATCH] fix: cannot borrow reserves --- test/prod/compound/setup/TestSetup.sol | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/prod/compound/setup/TestSetup.sol b/test/prod/compound/setup/TestSetup.sol index 88821aa76..d620ab1ce 100644 --- a/test/prod/compound/setup/TestSetup.sol +++ b/test/prod/compound/setup/TestSetup.sol @@ -191,6 +191,7 @@ contract TestSetup is Config, ProdTest { uint96 _amount, uint256 _price ) internal view returns (uint256) { + ICToken poolToken = ICToken(_market.poolToken); return bound( _amount, @@ -199,9 +200,7 @@ contract TestSetup is Config, ProdTest { Math.min( Math.min( (_market.maxBorrows - _market.totalBorrows) / 2, - _market.underlying == wEth - ? cEth.balance - : ERC20(_market.underlying).balanceOf(_market.poolToken) + poolToken.getCash() - poolToken.totalReserves() ), MAX_USD_AMOUNT.div(_price) ),