DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

EPOCH_DURATION should used instead of "1 weeks"

Summary

EPOCH_DURATION should used instead of "1 weeks"

Vulnerability Details

https://github.com/Cyfrin/2024-08-fjord/blob/main/src/FjordPoints.sol#L245

uint256 public constant EPOCH_DURATION = 1 weeks;

EPOCH_DURATION is "1 weeks" in FjordPoints.sol, maybe one day, code will change to another value, such as 4 weeks, then function distributePoints() will action abnomally.

Impact

if EPOCH_DURATION is not "1 weeks", function distributePoints() will action abnomally.

Tools Used

manually reviewed

Recommendations

function distributePoints() public {
if (block.timestamp < lastDistribution + EPOCH_DURATION) {
return;
}
if (totalStaked == 0) {
return;
}
uint256 epochsPending = (block.timestamp - lastDistribution) / EPOCH_DURATION;
pointsPerToken =
pointsPerToken.add(epochsPending * (pointsPerEpoch.mul(PRECISION_18).div(totalStaked)));
totalPoints = totalPoints.add(pointsPerEpoch * epochsPending);
lastDistribution = lastDistribution + (epochsPending * EPOCH_DURATION);
emit PointsDistributed(pointsPerEpoch, pointsPerToken);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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