Skip to content

Commit

Permalink
burn: use new getPrices function from auction house
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrai committed Oct 6, 2023
1 parent 44ef0b9 commit 23b84ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ contract ExcessETHBurner is IExcessETHBurner, Ownable {
*/
function meanAuctionPrice() public view returns (uint256) {
uint16 numberOfPastAuctionsForMeanPrice_ = numberOfPastAuctionsForMeanPrice;
INounsAuctionHouseV2.Settlement[] memory settlements = auction.prices(numberOfPastAuctionsForMeanPrice_);
uint256[] memory prices = auction.getPrices(numberOfPastAuctionsForMeanPrice_);

if (settlements.length < numberOfPastAuctionsForMeanPrice_) revert NotEnoughAuctionHistory();
if (prices.length < numberOfPastAuctionsForMeanPrice_) revert NotEnoughAuctionHistory();

uint256 sum = 0;
for (uint16 i = 0; i < numberOfPastAuctionsForMeanPrice_; i++) {
sum += settlements[i].amount;
sum += prices[i];
}

return sum / numberOfPastAuctionsForMeanPrice_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,8 @@ contract AuctionMock is INounsAuctionHouseV2 {
pricesHistory = pricesHistory_;
}

function prices(uint256) external view override returns (INounsAuctionHouseV2.Settlement[] memory priceHistory_) {
priceHistory_ = new INounsAuctionHouseV2.Settlement[](pricesHistory.length);
for (uint256 i; i < pricesHistory.length; ++i) {
priceHistory_[i].amount = pricesHistory[i];
}
function getPrices(uint256) external view override returns (uint256[] memory) {
return pricesHistory;
}

function auction() external view returns (INounsAuctionHouseV2.AuctionV2 memory) {
Expand All @@ -60,6 +57,12 @@ contract AuctionMock is INounsAuctionHouseV2 {

function setMinBidIncrementPercentage(uint8 minBidIncrementPercentage) external {}

function getSettlements(uint256 auctionCount) external view returns (Settlement[] memory settlements) {}

function getSettlements(uint256 startId, uint256 endId) external view returns (Settlement[] memory settlements) {}

function getPrices(uint256 startId, uint256 endId) external view returns (uint256[] memory prices) {}

function warmUpSettlementState(uint256[] calldata nounIds) external {}
}

Expand Down

0 comments on commit 23b84ba

Please sign in to comment.