Skip to content

Instantly share code, notes, and snippets.

@maurelian
Created April 2, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maurelian/c420240798d781d5744f5d869c08c0ba to your computer and use it in GitHub Desktop.
Save maurelian/c420240798d781d5744f5d869c08c0ba to your computer and use it in GitHub Desktop.
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