WETHMock withdraw function unnecessary safe math #90
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Handle
pants
Vulnerability details
Since you are using solidity version >= 0.8.0 you have additional underflow / overflow checks that takes gas cost.
Here I talk about the WETHMock.withdraw where you first require(balanceOf[msg.sender] >= wad) and then compute balanceOf[msg.sender] - wad
without using unchecked{...} keyword to save gas.
Using this unchecked{...} keyword can help to save gas (SLOAD) of this important function.
This issue also appears at WETHMock.transferFrom, lines 75 and 78.
The text was updated successfully, but these errors were encountered: