Flow

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

`SablierFlow::depletionTimeOf` calculates the time by which stream balance is greater than total debts which is the opposite of what is stated in its natspec.

Description

https://github.com/Cyfrin/2024-10-sablier/blob/main/src/interfaces/ISablierFlow.sol#L118C5-L123C1
https://github.com/Cyfrin/2024-10-sablier/blob/main/src/SablierFlow.sol#L87C8-L90C88

As can be seen from the above the intention is to calculate the time by which the total debt exceeds stream balance.
However, the code calculates the time by which the stream balance exceeds total debt and even furthers return zero when total debt exceeds stream balance.

// If the total debt exceeds balance, return zero.
if (snapshotDebtScaled + _ongoingDebtScaledOf(streamId) >= balanceScaled + oneMVTScaled) {
return 0;
}

The point here is that the calculation based on the natspec should be based on when total debt exceeds balance, and not when balance > total debt.

Impact

No severe impact as it is a view function which was not used anywhere within the protocol but however the function provides misleading information.

Recommendation

Depends on intention. Correct natspec or correct code.

Updates

Lead Judging Commences

inallhonesty Lead Judge 9 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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