Skip to content

Commit

Permalink
_revertIfActiveAuctions helper should revert with ActiveAuction e…
Browse files Browse the repository at this point in the history
…rror (#1031)

* _revertIfActiveAuctions helper should revert with ActiveAuction error

* Fix comment
  • Loading branch information
grandizzy authored Dec 16, 2023
1 parent 00f5eff commit be8718b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/base/Pool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ abstract contract Pool is Clone, ReentrancyGuard, Multicall, IPool {
* @dev update `reserveAuction.latestBurnEventEpoch` and burn event `timestamp` state
* @dev === Reverts on ===
* @dev 2 weeks not passed `ReserveAuctionTooSoon()`
* @dev unsettled liquidation `AuctionNotCleared()`
* @dev unsettled liquidation `AuctionActive()`
* @dev === Emit events ===
* @dev - `KickReserveAuction`
*/
Expand Down
5 changes: 3 additions & 2 deletions src/libraries/helpers/RevertsHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Maths } from '../internal/Maths.sol';

// See `IPoolErrors` for descriptions
error AuctionNotCleared();
error AuctionActive();
error AmountLTMinDebt();
error DustAmountNotExceeded();
error LimitIndexExceeded();
Expand Down Expand Up @@ -97,13 +98,13 @@ import { Maths } from '../internal/Maths.sol';
/**
* @notice Check if there are still active / non settled auctions in pool.
* @notice Prevents kicking reserves auctions until all pending auctions are fully settled.
* @dev Reverts with `AuctionNotCleared`.
* @dev Reverts with `AuctionActive`.
* @param auctions_ Auctions data.
*/
function _revertIfActiveAuctions(
AuctionsState storage auctions_
) view {
if (auctions_.noOfAuctions != 0) revert AuctionNotCleared();
if (auctions_.noOfAuctions != 0) revert AuctionActive();
}

/**
Expand Down
5 changes: 2 additions & 3 deletions tests/forge/unit/ERC20Pool/ERC20PoolLiquidationsSettle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1153,9 +1153,8 @@ contract ERC20PoolLiquidationsSettleRegressionTest is ERC20HelperContract {
assertEq(claimableReserves, 294_613_859.916107852369559136 * 1e18);

// test reserves auction cannot be kicked until auction settled
vm.expectRevert(abi.encodeWithSignature('AuctionNotCleared()'));
_pool.kickReserveAuction();

_assertReserveAuctionUnsettledLiquidation();

// settle auction with reserves
changePrank(actor6);
_settle({
Expand Down
2 changes: 1 addition & 1 deletion tests/forge/utils/DSTestPlus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ abstract contract DSTestPlus is Test, IPoolEvents {
}

function _assertReserveAuctionUnsettledLiquidation() internal {
vm.expectRevert(IPoolErrors.AuctionNotCleared.selector);
vm.expectRevert(IPoolErrors.AuctionActive.selector);
_pool.kickReserveAuction();
}

Expand Down

0 comments on commit be8718b

Please sign in to comment.