diff --git a/solidity_examples/hashforether.sol b/solidity_examples/hashforether.sol index f8fe4473..0fde81b1 100644 --- a/solidity_examples/hashforether.sol +++ b/solidity_examples/hashforether.sol @@ -3,13 +3,13 @@ pragma solidity 0.5.0; contract HashForEther { - function withdrawWinnings() public { + function withdrawWinnings() public payable { // Winner if the last 8 hex characters of the address are 0. - require(uint32(msg.sender) == 0); - _sendWinnings(); - } - - function _sendWinnings() public { - msg.sender.transfer(address(this).balance); - } -} \ No newline at end of file + if (uint32(msg.sender) == 0) + _sendWinnings(); + } + + function _sendWinnings() public { + msg.sender.transfer(address(this).balance); + } +}