Created
October 27, 2018 00:14
-
-
Save micahriggan/d57424f7da2fc72e3a6d28d2ac1bcc65 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.4.24; | |
contract SimpleContract { | |
uint public paymentCount = 0; | |
event PaymentReceived(uint value, address sender); | |
address public owner; | |
constructor() public { | |
owner = msg.sender; | |
} | |
function () public payable { | |
paymentCount += 1; | |
emit PaymentReceived(msg.value, msg.sender); | |
} | |
function balance() public view returns(uint) { | |
return address(this).balance; | |
} | |
modifier isOwner() { | |
require(msg.sender == owner, "Must be the owner"); | |
_; | |
} | |
function withdraw() public isOwner { | |
owner.transfer(this.balance()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment