Last active
January 31, 2019 19:33
-
-
Save nachinius/76ee1c22ac6560d525390e97e66c2445 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.3; | |
| contract Addressable { | |
| address payable public target; | |
| function addressSet(address payable y) public { | |
| target = y; | |
| } | |
| } | |
| /** | |
| * Can receive money. | |
| * Can be stolen. | |
| * Payable at address. | |
| */ | |
| contract GammaPayableRevertable is Addressable { | |
| uint public amount = 1; | |
| function stealMyEth() public { | |
| address myAddress = address(this); | |
| msg.sender.transfer(myAddress.balance); | |
| } | |
| event Received(uint amount, address benefactor); | |
| event AboutToSending(uint amount, address benefactor); | |
| function () payable external { | |
| emit Received(msg.value, msg.sender); | |
| emit AboutToSending(amount++, target); | |
| target.transfer(amount); | |
| revert("Reverting test"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment