Skip to content

Instantly share code, notes, and snippets.

@tim-cotten
Last active June 13, 2019 01:50
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/d0ee20eaf9d61f3bd9a85d1bc345afaa to your computer and use it in GitHub Desktop.
Save tim-cotten/d0ee20eaf9d61f3bd9a85d1bc345afaa to your computer and use it in GitHub Desktop.
Simple Deposit Account (v0.1.1 Don't Use - Intro Version for Safety Discussion)
pragma solidity >=0.4.22 <0.6.0;
contract DepositAccount {
address owner;
constructor() public {
owner = msg.sender;
}
function withdraw() public {
require(owner == msg.sender);
msg.sender.transfer(address(this).balance);
}
function withdraw(uint256 amount) public {
require(owner == msg.sender);
require(address(this).balance >= amount);
msg.sender.transfer(amount);
}
function() payable external {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment