From cd9d0a3e7f7b0cd68777b7a402221d16cc08304a Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Mon, 2 Jan 2023 20:46:27 +0000 Subject: [PATCH] Edit hashforether.sol --- solidity_examples/hashforether.sol | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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); + } +}