Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity 0.4.18;
- contract ForceEther {
- bool youWin = false;
- // due to the throwing fallback function normally the contract cannot receive ether
- // if a contract selfdestructs with this contract as a target, the fallback function
- // does not get called => this.balance > 0 and thus the attacker wins
- function onlyNonZeroBalance() {
- require(this.balance != 0);
- youWin = true;
- }
- // throw if any ether is received
- function() payable {
- revert();
- }
- }
Add Comment
Please, Sign In to add comment