22// Modifications Copyright (c) 2025 IOTA Stiftung
33// SPDX-License-Identifier: Apache-2.0
44
5- /// Implementation of auction module.
65module iota_names_auction ::auction ;
76
87use iota::balance::{Self , Balance };
@@ -29,6 +28,7 @@ const AUCTION_BIDDING_PERIOD_MS: u64 = 60 * 60 * 1000;
2928const AUCTION_MIN_QUIET_PERIOD_MS : u64 = 10 * 60 * 1000 ;
3029/// The overbid must be at least of 1 IOTA, which is 10^9 NANOs
3130const AUCTION_MIN_OVERBID_VALUE_IOTA : u64 = 1_000_000_000 ;
31+
3232// === Abort codes ===
3333
3434#[error]
@@ -51,14 +51,14 @@ const ENoProfits: vector<u8> = b"There are no profits to withdraw.";
5151/// Authorization witness to call protected functions of `iota_names`.
5252public struct AuctionAuth has drop {}
5353
54- /// The AuctionHouse application.
54+ /// The ` AuctionHouse` application.
5555public struct AuctionHouse has key , store {
5656 id: UID ,
5757 balance: Balance <IOTA >,
5858 auctions: LinkedTable <Name , Auction >,
5959}
6060
61- /// The Auction application.
61+ /// The ` Auction` application.
6262#[allow(lint(coin_field))]
6363public struct Auction has store {
6464 name: Name ,
@@ -77,7 +77,8 @@ fun init(ctx: &mut TxContext) {
7777 });
7878}
7979
80- /// Start an auction if it's not started yet; and make the first bid.
80+ /// Start an auction for a name by placing the first bid.
81+ /// This will fail if the name is not available or already being auctioned.
8182public fun start_auction_and_place_bid (
8283 self: &mut AuctionHouse ,
8384 iota_names: &mut IotaNames ,
@@ -121,13 +122,14 @@ public fun start_auction_and_place_bid(
121122 self.auctions.push_front (name, auction)
122123}
123124
124- /// #### Notice
125125/// Bidders use this function to place a new bid.
126126///
127- /// Panics
128- /// Panics if `name` is invalid
129- /// or there isn't an auction for `name`
130- /// or `bid` is too low,
127+ /// ### Panics
128+ ///
129+ /// Panics if:
130+ /// - the name is invalid
131+ /// - there is no auction for the name
132+ /// - the bid is too low
131133public fun place_bid (
132134 self: &mut AuctionHouse ,
133135 name: String ,
@@ -201,11 +203,11 @@ public fun place_bid(
201203 self.auctions.push_front (name, auction);
202204}
203205
204- /// #### Notice
205- /// Auction winner can come and claim the NFT
206+ /// Auction winners can use this function to claim the NFT associated with the name.
206207///
207- /// Panics
208- /// sender is not the winner
208+ /// ### Panics
209+ ///
210+ /// Panics if the sender is not the winner.
209211public fun claim (
210212 self: &mut AuctionHouse ,
211213 name: String ,
@@ -245,11 +247,7 @@ public fun claim(
245247
246248// === Public Functions ===
247249
248- /// #### Notice
249- /// Get metadata of an auction
250- ///
251- /// #### Params
252- /// The name being auctioned.
250+ /// Get metadata of an auction.
253251///
254252/// #### Return
255253/// (`start_timestamp_ms`, `end_timestamp_ms`, `current_bidder`, `highest_amount`)
@@ -290,6 +288,11 @@ public fun collect_winning_auction_fund(
290288
291289// === Admin Functions ===
292290
291+ /// Admin functionality used to withdraw all funds from the auction house.
292+ ///
293+ /// ### Panics
294+ ///
295+ /// Panics if the auction house has no profits.
293296public fun admin_withdraw_funds (
294297 _: &AdminCap ,
295298 self: &mut AuctionHouse ,
0 commit comments