It is easy to spend money on crypto DeFI
speculation when you know you might just
want to keep it in ETH until it matures.
Now you can.
This is a simple dapp that lets you lock
money for a future date using a smart contract
Select a time to lock the funds up autonomously
When the time expires you can withdraw the funds.
For example you had locked away 10 eth in February 2020
It would now be $17000 USD.
Sometimes we need a little help to create our own sovereign 401k.
pragma solidity >=0.4.22 <0.7.0; contract FutureBank { address private owner; mapping (address => uint256) private balances; mapping (address => uint256) private locktime; modifier onlyOwner() { require (msg.sender == owner); _; } constructor() public { owner = msg.sender; } function deposit(uint256 lockdays) public payable { require(lockdays < 365); uint256 balance = balances[msg.sender]; balances[msg.sender] = balance + msg.value; if(balance == 0) { locktime[msg.sender] += ( now + (lockdays * 1 days) ); } else { locktime[msg.sender] += (lockdays * 1 days); } } function depositSeconds(uint256 lockseconds) public payable { require(lockseconds < 24*60*60); uint256 balance = balances[msg.sender]; balances[msg.sender] = balance + msg.value; if(balance == 0) { locktime[msg.sender] += ( now + lockseconds ); } else { locktime[msg.sender] += ( lockseconds ); } } function balance() public view returns(uint){ return balances[msg.sender]; } function delay() public view returns(uint){ return locktime[msg.sender]; } function withdraw() external { require(balances[msg.sender] > 0,"No funds in account"); require(block.timestamp > locktime[msg.sender],"Too soon to withdraw"); uint256 amount = balances[msg.sender]; balances[msg.sender] -= amount; (bool success, ) = msg.sender.call{value:amount}(""); require(success, "Transfer failed."); } function withdrawAmount(uint256 amount) external { require(balances[msg.sender] >= amount,"Insufficient balance"); require(block.timestamp > locktime[msg.sender],"Too soon to withdraw"); balances[msg.sender] -= amount; //require(msg.sender.send(amount)); (bool success, ) = msg.sender.call{value:amount}(""); require(success, "Transfer failed."); } event Sent(address from, address to, uint amount); function transfer(address receiver, uint amount) public { require(amount <= balances[msg.sender], "Insufficient balance"); balances[msg.sender] -= amount; balances[receiver] += amount; emit Sent(msg.sender, receiver, amount); } //contract IsPayable { // function () payable {} //} }
Please enter a number of funds to move (in ETH)
If depositing then please also enter how many days or seconds to lock funds for