Skip to content

Commit

Permalink
correct reserve auction kick timing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
EdNoepel committed Nov 9, 2023
1 parent 944d946 commit 760cdca
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/libraries/external/KickerActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,10 @@ library KickerActions {
KickReserveAuctionParams calldata params_
) external {
// retrieve timestamp of latest burn event and last burn timestamp
uint256 latestBurnEpoch = reserveAuction_.latestBurnEventEpoch;
uint256 lastBurnTimestamp = reserveAuction_.burnEvents[latestBurnEpoch].timestamp;
uint256 latestBurnEpoch = reserveAuction_.latestBurnEventEpoch;

// check that at least two weeks have passed since the last reserve auction completed, and that the auction was not kicked within the past 72 hours
if (block.timestamp < lastBurnTimestamp + 2 weeks || block.timestamp - reserveAuction_.kicked <= 72 hours) {
// check that at least two weeks have passed since the last reserve auction completed
if (block.timestamp < reserveAuction_.kicked + 2 weeks + 72 hours) {
revert ReserveAuctionTooSoon();
}

Expand Down
19 changes: 18 additions & 1 deletion tests/forge/unit/ERC721Pool/ERC721PoolReserveAuction.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,25 @@ contract ERC721PoolReserveAuctionTest is ERC721HelperContract {
// pass time to allow auction to complete
skip(48 hours);

// check that you can't start a new auction unless two weeks have passed
// check that you can't start a new auction immediately after the last one finished
_assertReserveAuctionTooSoon();

// check that you can't start a new auction two weeks after the last start...
skip(2 weeks - 72 hours);
_assertReserveAuctionTooSoon();

// ...or a day later...
skip(1 days);
_assertReserveAuctionTooSoon();

// ...but you can start another auction 2 weeks after the last one completed
skip(72 hours - 1 days);
_kickReserveAuction({
from: _bidder,
remainingReserves: 415.792367191826572589 * 1e18,
price: 1_000_000_000 * 1e18,
epoch: 2
});
}

function testClaimableReserveAuction() external {
Expand Down

0 comments on commit 760cdca

Please sign in to comment.