The _calculate_vested_amount()
function does not properly handle cases where block.timestamp
is less than self.vesting_start_time
, potentially leading to underflow issues when calculating elapsed
In the _calculate_vested_amount()
function:
If block.timestamp < self.vesting_start_time
, then elapsed = current_time - start_time
will underflow, as unsigned integers (uint256
) cannot be negative.
This could lead to an incorrect vested amount calculation or unexpected contract behavior.
If an underflow occurs, it can cause incorrect vested amounts to be returned, leading to miscalculations in token distribution.
Manual Review
Modify _calculate_vested_amount()
to ensure elapsed
does not go negative by adding an additional check:
The `_calculate_vested_amount` function is called in ` claim` and `claimable_amount` functions. There is a check that ensures the `block.timestamp` is greater or equal to the `vesting_start_time` in the both functions. Also, the admin sets the start and end time of the vesting. This means it will be always correct. Therefore, there is no risk from underflow or division by zero in `_calculate_vested_amount` function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.