mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
741 B
21 lines
741 B
6 years ago
|
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(now >= lastWithdrawTime[msg.sender] + 1 weeks);
|
||
|
require(msg.sender.call.value(_weiToWithdraw)());
|
||
|
balances[msg.sender] -= _weiToWithdraw;
|
||
|
lastWithdrawTime[msg.sender] = now;
|
||
|
}
|
||
|
}
|