Skip to content

Commit

Permalink
test: widen condition and add assume
Browse files Browse the repository at this point in the history
  • Loading branch information
pakim249CAL committed Aug 26, 2023
1 parent 3977f89 commit 6f43e71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/forge/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ contract BaseTest is Test {
uint256 internal constant MAX_TEST_AMOUNT = 1e28;
uint256 internal constant MIN_TEST_SHARES = MIN_TEST_AMOUNT * SharesMathLib.VIRTUAL_SHARES;
uint256 internal constant MAX_TEST_SHARES = MAX_TEST_AMOUNT * SharesMathLib.VIRTUAL_SHARES;
uint256 internal constant MIN_TEST_LLTV = 0.1 ether;
uint256 internal constant MAX_TEST_LLTV = 0.9 ether;
uint256 internal constant MIN_TEST_LLTV = 0.01 ether;
uint256 internal constant MAX_TEST_LLTV = 0.99 ether;
uint256 internal constant MIN_COLLATERAL_PRICE = 1e10;
uint256 internal constant MAX_COLLATERAL_PRICE = 1e40;
uint256 internal constant MAX_COLLATERAL_ASSETS = type(uint128).max;
Expand Down
7 changes: 6 additions & 1 deletion test/forge/integration/LiquidateIntegrationTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,18 @@ contract LiquidateIntegrationTest is BaseTest {
(amountCollateral, amountBorrowed, priceCollateral) =
_boundUnhealthyPosition(amountCollateral, amountBorrowed, priceCollateral);

console2.log(amountCollateral);
console2.log(amountBorrowed);
console2.log(priceCollateral);

vm.assume(amountCollateral > 1);

amountSupplied = bound(amountSupplied, amountBorrowed, MAX_TEST_AMOUNT);
amountSupplied = bound(amountSupplied, amountBorrowed, amountBorrowed + MAX_TEST_AMOUNT);
_supply(amountSupplied);

uint256 incentive = _liquidationIncentive(marketParams.lltv);
uint256 maxSeized = amountBorrowed.wMulDown(incentive).mulDivDown(ORACLE_PRICE_SCALE, priceCollateral);
vm.assume(maxSeized != 0);
amountSeized = bound(amountSeized, 1, min(maxSeized, amountCollateral - 1));
uint256 expectedRepaid = amountSeized.mulDivUp(priceCollateral, ORACLE_PRICE_SCALE).wDivUp(incentive);

Expand Down

0 comments on commit 6f43e71

Please sign in to comment.