Closed code423n4 closed 2 years ago
Jujic
Transfer amount can be checked for > 0 before calling safeTransfer`. This can save gas by avoiding the external call.
https://github.com/code-423n4/2022-01-sherlock/blob/c763f10c4b5fe2127677d6c25b83adcf3bcec212/contracts/SherBuy.sol#L188
token.safeTransfer(msg.sender, token.balanceOf(address(this)));
Remix
Check that transfer amount > 0 before executed.
The caller should do the check offline to save gas.
Handle
Jujic
Vulnerability details
Impact
Transfer amount can be checked for > 0 before calling safeTransfer`. This can save gas by avoiding the external call.
Proof of Concept
https://github.com/code-423n4/2022-01-sherlock/blob/c763f10c4b5fe2127677d6c25b83adcf3bcec212/contracts/SherBuy.sol#L188
Tools Used
Remix
Recommended Mitigation Steps
Check that transfer amount > 0 before executed.