Last active
June 13, 2019 01:49
-
-
Save tim-cotten/6e0b651b58efbc9e46e17f250a83a2bd to your computer and use it in GitHub Desktop.
Simple Deposit Account (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 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