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
586 B
21 lines
586 B
6 years ago
|
contract TimeLock {
|
||
|
|
||
|
mapping(address => uint) public balances;
|
||
|
mapping(address => uint) public lockTime;
|
||
|
|
||
|
function deposit() public payable {
|
||
|
balances[msg.sender] += msg.value;
|
||
|
lockTime[msg.sender] = now + 1 weeks;
|
||
|
}
|
||
|
|
||
|
function increaseLockTime(uint _secondsToIncrease) public {
|
||
|
lockTime[msg.sender] += _secondsToIncrease;
|
||
|
}
|
||
|
|
||
|
function withdraw() public {
|
||
|
require(balances[msg.sender] > 0);
|
||
|
require(now > lockTime[msg.sender]);
|
||
|
balances[msg.sender] = 0;
|
||
|
msg.sender.transfer(balances[msg.sender]);
|
||
|
}
|
||
|
}
|