Skip to content

Commit

Permalink
refactor: only one assert
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Dec 12, 2024
1 parent 191b54e commit 5c3887d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions certora/specs/LiquidateBuffer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ rule liquidateImprovePosition(MorphoLiquidateHarness.MarketParams marketParams,
(seizedAssets, repaidShares, repaidAssets, lif) = liquidateView(marketParams, seizedAssetsInput, repaidSharesInput, collateralPrice);

uint256 borrowerCollateralQuoted = summaryMulDivDown(borrowerCollateral, collateralPrice, Util.oraclePriceScale());
require summaryMulDivUp(lif, borrowerAssets, Util.wad()) <= borrowerCollateralQuoted;
assert borrowerCollateral * collateralPrice * virtualTotalBorrowShares(id) * Util.wad() >= borrowerShares * Util.oraclePriceScale() * virtualTotalBorrowAssets(id) * lif;
require summaryMulDivUp(lif, borrowerAssets, Util.wad()) < borrowerCollateralQuoted;
assert borrowerCollateral * collateralPrice * virtualTotalBorrowShares(id) * Util.wad() > borrowerShares * Util.oraclePriceScale() * virtualTotalBorrowAssets(id) * lif;

assert repaidShares * Util.oraclePriceScale() * virtualTotalBorrowAssets(id) * lif >= seizedAssets * collateralPrice * virtualTotalBorrowShares(id) * Util.wad();

Expand All @@ -65,8 +65,8 @@ rule liquidateImprovePosition(MorphoLiquidateHarness.MarketParams marketParams,
uint256 newBorrowerCollateral = require_uint256(borrowerCollateral - seizedAssets);

assert repaidShares * borrowerCollateral >= seizedAssets * borrowerShares;
assert borrowerShares * newBorrowerCollateral >= newBorrowerShares * borrowerCollateral;
assert newTotalShares * virtualTotalBorrowAssets(id) >= newTotalAssets * virtualTotalBorrowShares(id);
assert borrowerShares * virtualTotalBorrowAssets(id) * newTotalShares * newBorrowerCollateral >= newBorrowerShares * virtualTotalBorrowShares(id) * newTotalAssets * borrowerCollateral;
// assert borrowerShares * newBorrowerCollateral >= newBorrowerShares * borrowerCollateral;
// assert newTotalShares * virtualTotalBorrowAssets(id) >= newTotalAssets * virtualTotalBorrowShares(id);
// assert borrowerShares * virtualTotalBorrowAssets(id) * newTotalShares * newBorrowerCollateral >= newBorrowerShares * virtualTotalBorrowShares(id) * newTotalAssets * borrowerCollateral;
// assert borrowerAssets * newBorrowerCollateral >= newBorrowerAssetsDown * borrowerCollateral;
}

0 comments on commit 5c3887d

Please sign in to comment.