Last active
June 13, 2019 01:50
-
-
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)
This file contains 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.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