Created
May 26, 2019 03:30
-
-
Save wanseob/a1f707b150bf6554da0a9ad671750689 to your computer and use it in GitHub Desktop.
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
import './SafeMath.sol'; | |
pragma solidity ^0.5.0; | |
contract FOMO { | |
using SafeMath for *; | |
address public winner; | |
uint public lockTime; | |
constructor() public payable { | |
lockTime = now.add(5 minutes); | |
} | |
function deposit() public payable returns(bool) { | |
require(msg.value == 1 ether); | |
winner = msg.sender; | |
lockTime = lockTime.add(5 minutes); | |
return true; | |
} | |
function withdraw() public returns(bool) { | |
require(msg.sender == winner); | |
require(now >= lockTime); | |
msg.sender.transfer(address(this).balance); | |
return true; | |
} | |
function getLockTime() public view returns(uint) { | |
return lockTime; | |
} | |
function getNow() public view returns(uint) { | |
return now; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment