Only use SafeMath
when necessary can save gas
#307
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
For the arithmetic operations that will never over/underflow, using SafeMath will cost more gas.
For example:
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/Auction.sol#L238-L242
unclaimedArbTokens - amountTokens
will never underflow.Recommendation
Change to:
https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionBurnReserveSkew.sol#L76-L80
maxBurnSpend - premiumExcess
will never underflow.Recommendation
Change to:
The text was updated successfully, but these errors were encountered: