Skip to content

Instantly share code, notes, and snippets.

@apow2
Last active April 30, 2021 01:00
Show Gist options
  • Save apow2/407e8a781d04d1aa5ce177902aa9fd01 to your computer and use it in GitHub Desktop.
Save apow2/407e8a781d04d1aa5ce177902aa9fd01 to your computer and use it in GitHub Desktop.
a tip jar
contract TipJar{
address owner;
constructor() public{
owner = msg.sender;
}
receive() external payable{
}
fallback() external payable {
}
function withdrawBalance(){
require(msg.sender==owner);
uint256 balance = address(this).balance;
msg.sender.transfer(balance)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment