Last active
December 3, 2018 07:38
-
-
Save nourharidy/7ece6bb4311f5484635a4edd816aae9c to your computer and use it in GitHub Desktop.
Simple HODLer contract. Written in 10mins. Passed static analysis but is not guaranteed to be safe.
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.5.0; | |
contract HODLer { | |
uint releaseDate; | |
address owner; | |
// Contract deployer specifies deposit release date in constructor | |
constructor(uint secondsSince1971) public { | |
releaseDate = secondsSince1971; | |
owner = msg.sender; | |
} | |
// Anyone can deposit simply by sending ether to the contract address | |
function () payable external; | |
// Only owner can withdraw all Ether after releaseDate has passed | |
function withdraw() public { | |
require(msg.sender == owner); | |
require(now > releaseDate); | |
msg.sender.transfer(address(this).balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment