Open code423n4 opened 2 years ago
pauliax
The unchecked keyword can be applied in the following lines of code since there are statements before to ensure the arithmetic operations would not cause an integer underflow or overflow:
if (newAllocation > user.allocation) { ... rJoeNeeded = getRJoeAmount(newAllocation - user.allocation); if (block.timestamp > lastRewardTimestamp && joeSupply != 0) { uint256 multiplier = block.timestamp - lastRewardTimestamp; require( user.amount >= _amount, "RocketJoeStaking: withdraw amount exceeds balance" ); ... user.amount = user.amount - _amount; if (block.timestamp <= lastRewardTimestamp) { return; } ... uint256 multiplier = block.timestamp - lastRewardTimestamp;
Handle
pauliax
Vulnerability details
Impact
The unchecked keyword can be applied in the following lines of code since there are statements before to ensure the arithmetic operations would not cause an integer underflow or overflow: