Skip to content

Commit ccc1171

Browse files
committed
update natspec
1 parent 121b0ee commit ccc1171

File tree

2 files changed

+41
-15
lines changed

2 files changed

+41
-15
lines changed

src/RandomnessConsumer.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {RandomnessReceiverBase} from "@randomness-solidity/src/RandomnessReceive
1313
/// Deployed at: 0x410354CCce2c9d99bfD1968F91d37767beE97315
1414
contract RandomnessConsumer is RandomnessReceiverBase {
1515
// RandomnessSender proxy address on Filecoin calibration testnet
16-
address public constant RANDOMNESS_SENDER = 0x9c789bc7F2B5c6619Be1572A39F2C3d6f33001dC;
16+
address public constant RANDOMNESS_SENDER = 0x9c789bc7F2B5c6619Be1572A39F2C3d6f33001dC;
1717

1818
bytes32 public randomness;
1919
uint256 public requestId;
@@ -27,7 +27,6 @@ contract RandomnessConsumer is RandomnessReceiverBase {
2727
requestId = requestRandomness();
2828
}
2929

30-
3130
/// @dev Callback function that is called when randomness is received.
3231
/// @param requestID The ID of the randomness request that was made.
3332
/// @param _randomness The random value received.

src/SealedBidAuction.sol

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
8585
seller = msg.sender;
8686
}
8787

88-
// BID PHASES
89-
90-
// Phase 1. Bidding Phase
91-
// Submit a sealed bid
88+
/// BID PHASES
89+
90+
/// @dev Phase 1. Bidding Phase
91+
/// @notice Submit a sealed bid to participate in the auction.
92+
/// @param sealedBid The encrypted bid amount to submit to the auction.
93+
/// @return bidID The unique identifier for the submitted bid.
9294
function placeSealedBid(TypesLib.Ciphertext calldata sealedBid)
9395
external
9496
payable
@@ -118,8 +120,10 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
118120
return bidID;
119121
}
120122

121-
// Phase 2. Reveal Phase
122-
// Unseal sealed bid
123+
/// @dev Phase 2. Reveal Phase
124+
/// @notice Unseals the sealed bid after the bidding phase has ended.
125+
/// @param requestID The unique identifier for the bid to unseal.
126+
/// @param decryptionKey The key used to decrypt the sealed bid.
123127
function receiveBlocklock(uint256 requestID, bytes calldata decryptionKey)
124128
external
125129
override
@@ -145,6 +149,9 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
145149
emit BidUnsealed(bid.bidID, bid.bidder, bid.unsealedBid);
146150
}
147151

152+
/// @dev Updates the highest bid during the reveal phase.
153+
/// @param bidID The unique identifier of the bid being evaluated.
154+
/// @param unsealedBid The decrypted bid amount.
148155
function updateHighestBid(uint256 bidID, uint256 unsealedBid) internal {
149156
Bid storage bid = bidsById[bidID];
150157

@@ -160,8 +167,9 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
160167
emit BidUnsealed(bidID, bid.bidder, unsealedBid);
161168
}
162169

163-
// Phase 3. Auction Finalization
164-
// Withdraw refundable reserve amounts paid during bidding
170+
/// @dev Phase 3. Auction Finalization
171+
/// @notice Allows bidders (except the highest bidder) to withdraw refundable reserve amounts.
172+
/// @return The amount to withdraw as a refund.
165173
function withdrawRefund() external onlyAfter(biddingEndBlock) onlyAfterBidsUnsealed nonReentrant {
166174
require(msg.sender != highestBidder, "Highest bidder cannot withdraw refund.");
167175
Bid memory bid = bids[msg.sender];
@@ -172,7 +180,9 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
172180
emit ReservePriceClaimed(bid.bidID, msg.sender, amount);
173181
}
174182

175-
// Fulfil highest bid
183+
/// @dev Fulfill the highest bid after the bidding ends and bids are unsealed.
184+
/// @notice Only the highest bidder can fulfill the bid and pay the difference.
185+
/// @param msg.value The value sent in the transaction must equal the highest bid minus the reserve price.
176186
function fulfillHighestBid() external payable onlyAfter(biddingEndBlock) onlyAfterBidsUnsealed {
177187
require(highestBid > 0, "Highest bid is zero.");
178188
require(msg.sender == highestBidder, "Only the highest bidder can fulfil.");
@@ -186,16 +196,23 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
186196
emit HighestBidFulfilled(msg.sender, msg.value + RESERVE_PRICE);
187197
}
188198

189-
// Finalize auction
199+
/// @dev Finalizes the auction and declares the winner.
200+
/// @notice Marks the auction as ended and emits an event with the winning bid and bidder.
190201
function finalizeAuction() external onlyAfterBidsUnsealed {
191202
require(!auctionEnded, "Auction already finalised.");
192203
auctionEnded = true;
193204
emit AuctionEnded(highestBidder, highestBid);
194205
}
195206

196-
/**
197-
* Getters
198-
*/
207+
/// GETTERS
208+
209+
/// @dev Retrieves bid details using the bid ID.
210+
/// @param bidID The unique identifier for the bid.
211+
/// @return sealedBid The encrypted sealed bid.
212+
/// @return decryptionKey The decryption key used for revealing the bid.
213+
/// @return unsealedBid The decrypted bid amount.
214+
/// @return bidder The address of the bidder.
215+
/// @return revealed Whether the bid has been revealed.
199216
function getBidWithBidID(uint256 bidID)
200217
external
201218
view
@@ -214,6 +231,13 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
214231
revealed = bidsById[bidID].revealed;
215232
}
216233

234+
/// @dev Retrieves bid details using the bidder's address.
235+
/// @param bidder The address of the bidder.
236+
/// @return sealedBid The encrypted sealed bid.
237+
/// @return decryptionKey The decryption key used for revealing the bid.
238+
/// @return unsealedBid The decrypted bid amount.
239+
/// @return _bidder The address of the bidder.
240+
/// @return revealed Whether the bid has been revealed.
217241
function getBidWithBidder(address bidder)
218242
external
219243
view
@@ -232,6 +256,9 @@ contract SealedBidAuction is ISealedBidAuction, AbstractBlocklockReceiver, Reent
232256
revealed = bidsById[bidderToBidID[bidder]].revealed;
233257
}
234258

259+
/// @dev Retrieves the current highest bid and bidder's address.
260+
/// @return highestBidAmount The amount of the highest bid.
261+
/// @return highestBidderAddress The address of the highest bidder.
235262
function getHighestBid() external view returns (uint256 highestBidAmount, address highestBidderAddress) {
236263
highestBidAmount = highestBid;
237264
highestBidderAddress = highestBidder;

0 commit comments

Comments
 (0)