code-423n4 / 2021-10-slingshot-findings

0 stars 0 forks source link

Unchecked maths #97

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

Using the 'unchecked' keyword to avoid redundant arithmetic underflow/overflow checks to save gas when an underflow/overflow cannot happen. Unchecked can be applied here:

if (currentAllowance < amount) { // ... token.safeIncreaseAllowance(spender, amount - currentAllowance); }

Recommended Mitigation Steps

Consider using unchecked maths where gas costs are important and overflow/underflow are not possible.