diff --git a/contracts/compound/ComptrollerFirstExtension.sol b/contracts/compound/ComptrollerFirstExtension.sol index 467c04af..f23d4010 100644 --- a/contracts/compound/ComptrollerFirstExtension.sol +++ b/contracts/compound/ComptrollerFirstExtension.sol @@ -442,16 +442,16 @@ contract ComptrollerFirstExtension is view returns (uint256 _totalPages, address[] memory _pageOfBorrowers) { - if (pageSize == 0) pageSize = 300; - uint256 currentPageSize = pageSize; uint256 allBorrowersCount = allBorrowers.length; - if (allBorrowersCount == 0) { return (0, new address[](0)); } - _totalPages = allBorrowersCount / pageSize; + if (pageSize == 0) pageSize = 300; + uint256 currentPageSize = pageSize; uint256 sizeOfPageFromRemainder = allBorrowersCount % pageSize; + + _totalPages = allBorrowersCount / pageSize; if (sizeOfPageFromRemainder > 0) { _totalPages++; if (page + 1 == _totalPages) { @@ -463,9 +463,9 @@ contract ComptrollerFirstExtension is return (_totalPages, new address[](0)); } + uint256 offset = page * pageSize; _pageOfBorrowers = new address[](currentPageSize); for (uint256 i = 0; i < currentPageSize; i++) { - uint256 offset = page * pageSize; _pageOfBorrowers[i] = allBorrowers[i + offset]; } } diff --git a/contracts/test/liquidators/IonicLiquidatorTest.sol b/contracts/test/liquidators/IonicLiquidatorTest.sol index 903bdb39..baf48b98 100644 --- a/contracts/test/liquidators/IonicLiquidatorTest.sol +++ b/contracts/test/liquidators/IonicLiquidatorTest.sol @@ -75,7 +75,7 @@ contract IonicLiquidatorTest is UpgradesBaseTest { swapRouter = 0x5D61c537393cf21893BE619E36fC94cd73C77DD3; // kim router //quoter = IUniswapV3Quoter(0x7Fd569b2021850fbA53887dd07736010aCBFc787); // other sup quoter? quoter = IUniswapV3Quoter(0x5E6AEbab1AD525f5336Bd12E6847b851531F72ba); // sup quoter - usdcWhale = 0xB4fb31E7B1471A8e52dD1e962A281a732EaD59c1; + usdcWhale = 0x34b83A3759ba4c9F99c339604181bf6bBdED4C79; // vault wethWhale = 0xF4C85269240C1D447309fA602A90ac23F1CB0Dc0; poolAddress = 0xFB3323E24743Caf4ADD0fDCCFB268565c0685556; //uniV3PooForFlash = 0x293f2B2c17f8cEa4db346D87Ef5712C9dd0491EF; // kim weth-usdc pool