Skip to content

Instantly share code, notes, and snippets.

@tim-cotten
Last active June 13, 2019 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-cotten/6e0b651b58efbc9e46e17f250a83a2bd to your computer and use it in GitHub Desktop.
Save tim-cotten/6e0b651b58efbc9e46e17f250a83a2bd to your computer and use it in GitHub Desktop.
Simple Deposit Account (Don't Use - Intro Version for Safety Discussion)
pragma solidity >=0.4.22 <0.6.0;
contract DepositAccount {
address payable owner;
constructor() public {
owner = msg.sender;
}
function withdraw() public {
require(owner == msg.sender);
owner.transfer(address(this).balance);
}
function withdraw(uint256 amount) public {
require(owner == msg.sender);
require(address(this).balance >= amount);
owner.transfer(amount);
}
function() payable external {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment