Skip to content

Instantly share code, notes, and snippets.

@pertsev
Last active July 4, 2018 05:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pertsev/25657874806a216857f4e87515c8fbad to your computer and use it in GitHub Desktop.
Save pertsev/25657874806a216857f4e87515c8fbad to your computer and use it in GitHub Desktop.
Ether transfer dirty hack
contract Sender {
constructor() payable { }
function onExecuteTransfer(address _recipient, uint256 _value) public returns(bool) {
if (!_recipient.send(_value)) {
Sacrifice sheep = (new Sacrifice).value(_value)(_recipient);
}
return true;
}
}
contract Sacrifice {
constructor(address _recipient) payable {
selfdestruct(_recipient);
}
}
contract Recipient {
function getBalance() public view returns(uint256) {
return this.balance;
}
function () payable {
revert();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment