Only using SafeMath
when necessary can save gas
#41
Labels
bug
Something isn't working
G (Gas Optimization)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
or the arithmetic operations that will never over/underflow, using SafeMath will cost more gas.
For example:
https://github.com/code-423n4/2021-11-yaxis/blob/146febcb61ae7fe20b0920849c4f4bbe111c6ba7/contracts/v3/alchemix/Alchemist.sol#L623-L637
_amount - _totalCredit
will never underflow.Recommendation
Change to:
The text was updated successfully, but these errors were encountered: