Skip to content

Commit

Permalink
feat: update AlreadyBidding error to provide failing id
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 committed Nov 23, 2023
1 parent c162444 commit ea5b5b4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,16 @@ contract Migration__20231123_UpgradeAuctionClaimeUnbiddedNames is RNSDeploy {
}

vm.revertTo(snapshotId);
uint256 firstFailId;
for (uint256 i; i < domainAuctions.length; ++i) {
if (domainAuctions[i].bid.bidder != address(0x0)) {
firstFailId = reservedIds[i];
break;
}
}
// !allowFailure
vm.prank(operator);
vm.expectRevert(INSAuction.AlreadyBidding.selector);
vm.expectRevert(abi.encodeWithSelector(INSAuction.AlreadyBidding.selector, firstFailId));
claimeds = auction.bulkClaimUnbiddedNames(tos, reservedIds, false);
}
}
4 changes: 2 additions & 2 deletions src/RNSAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
sAuction = _domainAuction[id];
mAuctionId = sAuction.auctionId;
if (!(mAuctionId == 0 || mAuctionId == auctionId || sAuction.bid.timestamp == 0)) {
revert AlreadyBidding();
revert AlreadyBidding(id);
}

sAuction.auctionId = auctionId;
Expand Down Expand Up @@ -232,7 +232,7 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
rnsUnified.transferFrom(address(this), tos[i], id);
claimeds[i] = true;
} else if (!allowFailure) {
revert AlreadyBidding();
revert AlreadyBidding(id);
}

unchecked {
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/INSAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface INSAuction {
error NotYetEnded();
error NoOneBidded();
error NullAssignment();
error AlreadyBidding();
error AlreadyBidding(uint256 id);
error RatioIsTooLarge();
error NameNotReserved();
error InvalidEventRange();
Expand Down

0 comments on commit ea5b5b4

Please sign in to comment.