Created
January 2, 2022 19:01
-
-
Save jakep84/e184adcab0cd2062051aeab0ee200f9e 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
pragma solidity ^0.8.0; | |
contract PiggyBank { | |
address payable hodlerAddress; | |
uint balance = 0; | |
uint deadline; | |
uint minValue = 1; | |
function enrollBank() public { | |
hodlerAddress == msg.sender; | |
deadline = block.timestamp + 10 minutes; | |
} | |
function deposit() public payable { | |
require(msg.value >= minValue); | |
balance += msg.value; | |
} | |
function withdraw() public { | |
require(block.timestamp >= deadline); | |
hodlerAddress.transfer(balance); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment