Skip to content

Commit

Permalink
ah: make constructor an initializer
Browse files Browse the repository at this point in the history
best practice
  • Loading branch information
eladmallel committed Feb 19, 2024
1 parent 34ceb02 commit c59c9fd
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/nouns-contracts/contracts/NounsAuctionHouseV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ contract NounsAuctionHouseV2 is
/// @notice The Nouns price feed state
mapping(uint256 => SettlementState) settlementHistory;

constructor(INounsToken _nouns, address _weth, uint256 _duration) {
constructor(
INounsToken _nouns,
address _weth,
uint256 _duration
) initializer {
nouns = _nouns;
weth = _weth;
duration = _duration;
Expand Down Expand Up @@ -226,7 +230,7 @@ contract NounsAuctionHouseV2 is
*/
function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage) external override onlyOwner {
require(_minBidIncrementPercentage > 0, 'must be greater than zero');

minBidIncrementPercentage = _minBidIncrementPercentage;

emit AuctionMinBidIncrementPercentageUpdated(_minBidIncrementPercentage);
Expand Down Expand Up @@ -360,10 +364,11 @@ contract NounsAuctionHouseV2 is
* @return settlements An array of type `Settlement`, where each Settlement includes a timestamp,
* the Noun ID of that auction, the winning bid amount, and the winner's address.
*/
function getSettlements(
uint256 auctionCount,
bool skipEmptyValues
) external view returns (Settlement[] memory settlements) {
function getSettlements(uint256 auctionCount, bool skipEmptyValues)
external
view
returns (Settlement[] memory settlements)
{
uint256 latestNounId = auctionStorage.nounId;
if (!auctionStorage.settled && latestNounId > 0) {
latestNounId -= 1;
Expand Down

0 comments on commit c59c9fd

Please sign in to comment.