Skip to content

Commit

Permalink
refactor: testLiquidateHealthyPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
makcandrov committed Aug 4, 2023
1 parent 2b17afa commit baaeff8
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions test/forge/integration/TestIntegrationLiquidate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,22 @@ contract IntegrationLiquidateTest is BlueBaseTest {
uint256 amountSupplied,
uint256 amountBorrowed,
uint256 amountSeized,
uint256 priceCollateral,
uint256 priceBorrowable
uint256 priceCollateral
) public {
amountSupplied = bound(amountSupplied, 1, 2 ** 64);
amountBorrowed = bound(amountBorrowed, 1, 2 ** 64);
amountSeized = bound(amountSeized, 1, 2 ** 64);
amountCollateral = bound(amountCollateral, 1, 2 ** 64);
priceCollateral = bound(priceCollateral, 0, 2 ** 64);
priceBorrowable = bound(priceBorrowable, 0, 2 ** 64);
(amountCollateral, amountBorrowed, priceCollateral) =
_boundHealthyPosition(amountCollateral, amountBorrowed, priceCollateral);

vm.assume(
amountCollateral.mulWadDown(priceCollateral).mulWadDown(market.lltv)
>= amountBorrowed.mulWadUp(priceBorrowable)
);
vm.assume(amountSupplied >= amountBorrowed);
vm.assume(amountCollateral >= amountSeized);
amountSupplied = bound(amountSupplied, amountBorrowed, 2 ** 64);
_provideLiquidity(amountSupplied);

borrowableOracle.setPrice(priceBorrowable);
amountSeized = bound(amountSeized, 1, amountCollateral);

borrowableOracle.setPrice(FixedPointMathLib.WAD);
collateralOracle.setPrice(priceCollateral);

borrowableAsset.setBalance(address(this), amountSupplied);
borrowableAsset.setBalance(LIQUIDATOR, amountBorrowed);
collateralAsset.setBalance(BORROWER, amountCollateral);

blue.supply(market, amountSupplied, address(this), hex"");

vm.startPrank(BORROWER);
blue.supplyCollateral(market, amountCollateral, BORROWER, hex"");
blue.borrow(market, amountBorrowed, BORROWER, BORROWER);
Expand Down

0 comments on commit baaeff8

Please sign in to comment.