From 6911f86228dfbce77e9d7888c2a90ae503fc782b Mon Sep 17 00:00:00 2001 From: Van0k Date: Tue, 19 Mar 2024 14:17:52 +0400 Subject: [PATCH] fix: fix expectedLiquidity == 0 corner case in tests --- contracts/test/helpers/IntegrationTestHelper.sol | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/contracts/test/helpers/IntegrationTestHelper.sol b/contracts/test/helpers/IntegrationTestHelper.sol index 5bdacfa4..69844122 100644 --- a/contracts/test/helpers/IntegrationTestHelper.sol +++ b/contracts/test/helpers/IntegrationTestHelper.sol @@ -339,11 +339,13 @@ contract IntegrationTestHelper is TestHelper, BalanceHelper, ConfigManager { if (remainingBorrowable < minDebt) { uint256 depositAmount = 5 * minDebt; { - uint256 utilization = - WAD * (pool.expectedLiquidity() - pool.availableLiquidity()) / pool.expectedLiquidity(); - if (utilization > 85 * WAD / 100) { - depositAmount = - pool.expectedLiquidity() * utilization / (75 * WAD / 100) - pool.expectedLiquidity(); + if (pool.expectedLiquidity() != 0) { + uint256 utilization = + WAD * (pool.expectedLiquidity() - pool.availableLiquidity()) / pool.expectedLiquidity(); + if (utilization > 85 * WAD / 100) { + depositAmount = + pool.expectedLiquidity() * utilization / (75 * WAD / 100) - pool.expectedLiquidity(); + } } }