Created
April 2, 2020 02:20
-
-
Save maurelian/c420240798d781d5744f5d869c08c0ba to your computer and use it in GitHub Desktop.
This file contains hidden or 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
pragma solidity ^0.5.0; | |
contract Foo { | |
ERC20 e20; | |
ERC20NoReturn e20NoReturn; | |
constructor() public { | |
// deploy both tokens | |
e20 = new ERC20(); | |
e20NoReturn = new ERC20NoReturn(); | |
} | |
function checkTransfer0() public returns (bool){ | |
// cast the non-compliant token to a compliant ERC20 type | |
ERC20 token = ERC20(address(e20NoReturn)); | |
token.transfer(block.coinbase, 0); // reverts on RETURNDATACOPY check | |
} | |
} | |
contract ERC20 { | |
function transfer(address _to, uint256 _value) external returns(bool) { | |
return true; | |
} | |
} | |
contract ERC20NoReturn { | |
function transfer(address _to, uint256 _value) external { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment