In the _withdraw
function, accumulating the protocol fee into protocolRevenue[token]
without overflow checks poses a risk. This approach can lead to integer overflow, especially if large values accumulate over time or if there are high transaction volumes. An overflow could result in inaccurate fee calculations, compromising the contract's integrity and reliability.
In Solidity, integer overflow can occur when the value of a variable exceeds the maximum limit of its data type.
The above uses unchecked
, which disables overflow checks, making it possible for protocolRevenue[token]
to exceed the maximum limit of uint256
.
If an overflow occurs, protocolRevenue[token]
would wrap around to zero or another unintended value, potentially misrepresenting the actual accumulated protocol fees.
Manual Review
Implement a safer approach by using SafeMath
for addition operations. This ensures that protocolRevenue[token]
won’t exceed its limit, preventing unintended value wraps.
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.