Using ratePerSecond() to calculate the _recipientBalance() incurs an unnecessary precision loss.
Vulnerability Detail
The current formula in _recipientBalance() to calculate the vested amount (balance) incurs an unnecessary precision loss, as it includes div before mul:
WATCHPUG
medium
Unnecessary precision loss in
_recipientBalance()
Summary
Using
ratePerSecond()
to calculate the_recipientBalance()
incurs an unnecessary precision loss.Vulnerability Detail
The current formula in
_recipientBalance()
to calculate the vested amount (balance
) incurs an unnecessary precision loss, as it includes div before mul:This can be avoided and the improved formula can also save some gas.
Impact
Precision loss in
_recipientBalance()
.Code Snippet
https://github.com/sherlock-audit/2022-11-nounsdao/blob/main/src/Stream.sol#L341-L344
Tool used
Manual Review
Recommendation
Consdier changing to: