Open code423n4 opened 2 years ago
WatchPug
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L355-L363
function dilutedBalance(uint112 amount) internal view returns (uint256) { // duration / timeRemaining * amount if (block.timestamp < startTime) { return amount; } else { uint32 timeRemaining = endStream - uint32(block.timestamp); return ((uint256(streamDuration) * amount * 10**6) / timeRemaining) / 10**6; } }
Change to:
function dilutedBalance(uint112 amount) internal view returns (uint256) { // duration / timeRemaining * amount if (block.timestamp < startTime) { return amount; } else { uint32 timeRemaining = endStream - uint32(block.timestamp); return ((uint256(streamDuration) * amount * 1e6) / timeRemaining) / 1e6; } }
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-11-streaming/blob/56d81204a00fc949d29ddd277169690318b36821/Streaming/src/Locke.sol#L355-L363
Recommendation
Change to: