Skip to content

Commit

Permalink
docs: add natspec to the auctions
Browse files Browse the repository at this point in the history
  • Loading branch information
stevennevins committed Jan 19, 2024
1 parent 7efbc64 commit 70a68eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/ConstantVRGEA.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ pragma solidity ^0.8.18;
import {VRGEA} from "src/VRGEA.sol";
import {unsafeWadDiv} from "solmate/utils/SignedWadMath.sol";

/// @title ConstantVRGEA - Constant Rate Gradual English Auction
/// @notice This contract extends VRGEA with a constant target sale time for the auction regardless of the amount sold.
abstract contract ConstantVRGEA is VRGEA {
int256 public immutable duration;
/// @notice The fixed duration for the auction in dayWads (fixed-point representation of days).
int256 public duration;

/// @dev _duration must be in dayWads
/// @dev Initializes a ConstantVRGEA contract with specified parameters.
/// @param _startTime The start time of the auction.
/// @param _reservePrice The reserve price for the auction.
/// @param _minBidIncrease The percentage by which a new bid must exceed the previous bid.
/// @param _duration The constant duration of the auction in dayWads.
constructor(
uint256 _startTime,
uint256 _reservePrice,
Expand All @@ -17,6 +24,10 @@ abstract contract ConstantVRGEA is VRGEA {
duration = _duration;
}

/// @notice Returns the constant target sale time for the auction.
/// @dev Overrides the getTargetSaleTime function from the VRGEA contract to provide a constant target sale time.
/// @param numSold The number of items sold, which is not used in this constant implementation.
/// @return The constant target sale time for the auction.
function getTargetSaleTime(int256 /* numSold */) public view virtual override returns (int256) {
return duration;
}
Expand Down
10 changes: 8 additions & 2 deletions src/LinearVRGEA.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {VRGEA} from "src/VRGEA.sol";
import {unsafeWadDiv} from "solmate/utils/SignedWadMath.sol";

/// @title LinearVRGEA - Linear Variable Rate Gradual English Auction
/// @notice This contract extends the VRGEA contract with a linear pricing function that defines the rate at which items are available for sale
abstract contract LinearVRGEA is VRGEA {
int256 public immutable perTimeUnit;
int256 public perTimeUnit;

constructor(
uint256 _startTime,
Expand All @@ -16,6 +18,10 @@ abstract contract LinearVRGEA is VRGEA {
perTimeUnit = _perTimeUnit;
}

/// @notice Calculates the target sale time based on the amount sold using a linear formula.
/// @dev Overrides the getTargetSaleTime function from the VRGEA contract with a linear sale supply schedule.
/// @param sold The cumulative amount sold in the auction.
/// @return The target sale time based on the linear pricing function.
function getTargetSaleTime(int256 sold) public view virtual override returns (int256) {
return unsafeWadDiv(sold, perTimeUnit);
}
Expand Down

0 comments on commit 70a68eb

Please sign in to comment.