Redundant arithmetic underflow/overflow checks can be avoided when an underflow/overflow cannot happen.
Proof of Concept
The "unchecked" keyword can be applied here since there is an "if" statement before to ensure the arithmetic operations, would not cause an integer underflow or overflow.
Handle
Dravee
Vulnerability details
Impact
Redundant arithmetic underflow/overflow checks can be avoided when an underflow/overflow cannot happen.
Proof of Concept
The "unchecked" keyword can be applied here since there is an "if" statement before to ensure the arithmetic operations, would not cause an integer underflow or overflow.
Instances include: https://github.com/code-423n4/2021-12-vader/blob/main/contracts/dex-v2/pool/VaderPoolV2.sol#L78-L79
Tools Used
Recommended Mitigation Steps
Add the "unchecked" keyword.
Or move the line inside the
unchecked
statement right below it