MorpheusAI

MorpheusAI
Foundry
22,500 USDC
View results
Submission Details
Severity: low
Invalid

``getPeriodReward()`` of LinearDistributionIntervalDecrease library has an unused logic.

Summary

getPeriodReward() is used to calculate the reward for the period and there is a logic to calculate interval that is less then 'interval_' range. But that logic can never be reached.

Vulnerability Details

./LinearDistributionIntervalDecrease.sol#Line47-Line54
// Calculate interval that less then 'interval_' range
uint256 timePassedBefore_ = startTime_ - payoutStart_;
if ((timePassedBefore_ / interval_) == ((endTime_ - payoutStart_) / interval_)) {
uint256 intervalsPassed_ = timePassedBefore_ / interval_;
uint256 intervalFullReward_ = initialAmount_ - intervalsPassed_ * decreaseAmount_;
return (intervalFullReward_ * (endTime_ - startTime_)) / interval_;
}

Here, for this block to execute:

uint256 timePassedBefore_ = startTime_ - payoutStart_;
if ((timePassedBefore_ / interval_) == ((endTime_ - payoutStart_) / interval_)) {
...
}

startTime and endTime needs to be same.

But this line clearly prevents that:

./LinearDistributionIntervalDecrease.sol#Line42-Line45
// Return 0 when calculation 'startTime_' is bigger then 'endTime_'...
if (startTime_ >= endTime_) {
return 0;
}

Impact

Interval that less then 'interval_' range can't be calculated.

Tools Used

Manual Analysis

Recommendations

Modify the logic accordingly for correct calculation.

Updates

Lead Judging Commences

inallhonesty Lead Judge over 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.