Skip to content

Commit 9ff32b8

Browse files
authored
feat: maintain reserved status for ids listed in RNSAuction contract (#46)
2 parents 6ea2558 + a752039 commit 9ff32b8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/RNSAuction.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pragma solidity ^0.8.19;
44
import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
55
import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
66
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
7+
import { BitMaps } from "@openzeppelin/contracts/utils/structs/BitMaps.sol";
78
import { INSUnified, INSAuction } from "./interfaces/INSAuction.sol";
89
import { LibSafeRange } from "./libraries/math/LibSafeRange.sol";
910
import { LibRNSDomain } from "./libraries/LibRNSDomain.sol";
@@ -12,6 +13,7 @@ import { RONTransferHelper } from "./libraries/transfers/RONTransferHelper.sol";
1213

1314
contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
1415
using LibSafeRange for uint256;
16+
using BitMaps for BitMaps.BitMap;
1517
using LibEventRange for EventRange;
1618

1719
/// @inheritdoc INSAuction
@@ -37,6 +39,8 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
3739
address payable internal _treasury;
3840
/// @dev The gap ratio between 2 bids with the starting price.
3941
uint256 internal _bidGapRatio;
42+
/// @dev Mapping from id => bool reserved status
43+
BitMaps.BitMap internal _reserved;
4044

4145
modifier whenNotStarted(bytes32 auctionId) {
4246
_requireNotStarted(auctionId);
@@ -90,6 +94,7 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
9094

9195
for (uint256 i; i < length;) {
9296
(, ids[i]) = rnsUnified.mint(parentId, labels[i], address(0x0), address(this), domainExpiryDuration);
97+
_reserved.set(ids[i]);
9398

9499
unchecked {
95100
++i;
@@ -101,7 +106,7 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
101106
* @inheritdoc INSAuction
102107
*/
103108
function reserved(uint256 id) public view returns (bool) {
104-
return _rnsUnified.ownerOf(id) == address(this);
109+
return _reserved.get(id);
105110
}
106111

107112
/**

0 commit comments

Comments
 (0)