sablier-labs / flow

🍃 Smart contracts of the Sablier Flow protocol.
Other
8 stars 0 forks source link

fix: depletionTimeOf calculation #317

Closed smol-ninja closed 1 day ago

smol-ninja commented 2 days ago

There was a small discrepancy between the definition of "depletion timestamp" and its implementation.

Depletion time is defined as the UNIX timestamp at which the total debt exceeds stream balance by 1 wei. That is, at depletion time, $\text{total debt} = \text{stream balance} + 1$. This also means that at depletion time, $\text{uncovered debt} = 1$. At depletion time, the streamed accrues 1 wei of uncovered debt. Therefore, this PR closes the gap between the definition and the implementation.

Therefore, consider the following cases and the expected results:

Changelog

smol-ninja commented 2 days ago

RustyRabbit has given a green signal. @PaulRBerg if you can have a quick look and approve, I can merge and prepare it for Codehawk. Thank you.