// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.6.4; contract EtherStore { uint256 public withdrawalLimit = 1 ether; mapping(address => uint256) public lastWithdrawTime; mapping(address => uint256) public balances; function depositFunds() public payable { balances[msg.sender] += msg.value; } function withdrawFunds (uint256 _weiToWithdraw) public { require(balances[msg.sender] >= _weiToWithdraw); // limit the withdrawal require(_weiToWithdraw <= withdrawalLimit); // limit the time allowed to withdraw require(block.timestamp >= lastWithdrawTime[msg.sender] + 1 weeks); (bool success, ) = msg.sender.call{value: _weiToWithdraw}(""); require(success); balances[msg.sender] -= _weiToWithdraw; lastWithdrawTime[msg.sender] = block.timestamp; } }
0.7.1