In handleFees, when timeDiff = 0 the calculations for the fee are not required. Inside last else statement can an if statement added to avoid not needed calculations. This would save gas especially, when the contract is used more than once in a single block.
Handle
0x0x0x
Vulnerability details
In
handleFees
, whentimeDiff = 0
the calculations for the fee are not required. Inside lastelse
statement can anif
statement added to avoid not needed calculations. This would save gas especially, when the contract is used more than once in a single block.So this part
Can be replaced with the following:
Or alternatively all remaining calculations can be inside an
if (timeDiff != 0)
.