TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

Repeated Check for Ended Epoch

Summary

The check if (!epochs[_currentEpochId].hasEnded()) { revert InvalidOperation(); } is repeated in multiple functions. This can be refactored into a modifier to reduce code duplication and improve readability.

Vulnerability Details

The repeated check for whether the current epoch has ended can be refactored into a modifier. This simplifies the code and ensures consistency across functions that require this check.

Impact

Refactoring repeated code into a modifier reduces code duplication, making the contract more maintainable and readable.

Tools Used

Manual review.

Recommendations

Create a modifier to encapsulate the check for an ended epoch and apply it to relevant functions:

modifier onlyWhenEpochEnded() {
if (!epochs[_currentEpochId].hasEnded()) { revert InvalidOperation(); }
_;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.