Skip to content

Commit

Permalink
Merge pull request #188 from Gearbox-protocol/tests-pool-fix
Browse files Browse the repository at this point in the history
fix: fix expectedLiquidity == 0 corner case in tests
  • Loading branch information
0xmikko authored Mar 19, 2024
2 parents 022b855 + 6911f86 commit 846d918
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contracts/test/helpers/IntegrationTestHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down

0 comments on commit 846d918

Please sign in to comment.