Last active
July 4, 2018 05:47
-
-
Save pertsev/25657874806a216857f4e87515c8fbad to your computer and use it in GitHub Desktop.
Ether transfer dirty hack
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
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