Summary
After reviewing Auction.sol, I confirm this is a valid finding but with low severity since it's primarily an event emission issue without direct economic impact.
Vulnerable Code
function checkAuctionEnded() external {
require(block.timestamp >= state.endTime, "Auction not ended");
emit AuctionEnded(getPrice());
}
Technical Impact Analysis
No State Change
function checkAuctionEnded() external {
require(block.timestamp >= state.endTime, "Auction not ended");
emit AuctionEnded(getPrice());
}
Event Dependency
function getAuctionStatus() external {
if(block.timestamp >= auction.state.endTime) {
}
}
Recommended Mitigation
contract Auction is IAuction, Ownable {
bool public isEnded;
function finalizeAuction() external {
require(block.timestamp >= state.endTime, "Auction not ended");
require(!isEnded, "Auction already finalized");
isEnded = true;
uint256 finalPrice = getPrice();
if (state.totalRemaining > 0) {
zeno.mint(owner(), state.totalRemaining);
state.totalAllocated -= state.totalRemaining;
state.totalRemaining = 0;
}
emit AuctionEnded(
finalPrice,
state.totalAllocated - state.totalRemaining,
state.totalRemaining
);
}
modifier whenActive() {
require(block.timestamp > state.startTime, "Auction not started");
require(block.timestamp < state.endTime, "Auction ended");
require(!isEnded, "Auction finalized");
_;
}
}
Additional Recommendations
Add finalization events:
event AuctionFinalized(
uint256 finalPrice,
uint256 totalSold,
uint256 totalUnsold,
uint256 totalRaised
);
Add getter function:
function getAuctionStatus() external view returns (
bool initialized,
bool started,
bool ended,
bool finalized
) {
return (
true,
block.timestamp > state.startTime,
block.timestamp >= state.endTime,
isEnded
);
}