Skip to content

Instantly share code, notes, and snippets.

@jakep84
Created January 2, 2022 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakep84/e184adcab0cd2062051aeab0ee200f9e to your computer and use it in GitHub Desktop.
Save jakep84/e184adcab0cd2062051aeab0ee200f9e to your computer and use it in GitHub Desktop.
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