-
-
Save IllIllI000/2b00a32e8f0559e8f386ea4f1800abc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.13; | |
//pragma solidity 0.4.21; // both cases work on this version | |
/** | |
* @title MissingReturnBug | |
* @author IllIllI | |
*/ | |
interface IERC20 { | |
function transfer(address to, uint value) external returns (bool); | |
} | |
contract BadERC20 { | |
function transfer(address, uint) external pure { | |
return; | |
} | |
} | |
// test case of the missing return bug described here: | |
// https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca | |
contract Test { | |
function testIt() external { | |
BadERC20 bad = new BadERC20(); | |
//BadERC20(address(bad)).transfer(address(this), 0); // works | |
IERC20(address(bad)).transfer(address(this), 0); // doesn't work - reverts | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment