The value of endTime is written to redundantly as it is not re-used.
Example:
// If this was the first successful bid...
if (auction.state == State.Pending) {
// First bid updates auction state to Running
auction.state = State.Running;
// For auctions where clock is triggered by first bid, update start time
if (auction.clock == Clock.Trigger) {
// Set start time
auction.start = block.timestamp;
endTime = auction.start + auction.duration;
}
// Notify listeners of state change
emit AuctionStarted(consignment.id);
} else {
// Should not apply to first bid
// For bids placed within the extension window
// Extend the duration so that auction still lasts for the length of the extension window
if ((block.timestamp + extensionWindow) >= endTime) {
auction.duration += (extensionWindow - (endTime - block.timestamp));
emit AuctionExtended(_consignmentId);
}
}
mhs.auctions[_consignmentId] = auction;
// Announce the bid
emit BidAccepted(_consignmentId, auction.buyer, auction.bid);
}
Recommendation:
We advise the assignment to be omitted from the codebase.
ARF-03C: Redundant Value Assignment
Description:
The value of
endTime
is written to redundantly as it is not re-used.Example:
Recommendation:
We advise the assignment to be omitted from the codebase.