pragma solidity ^0.4.18; contract Will { address public owner; address public beneficiary; uint256 public deathTimeout = 4 weeks; uint256 public lastSignOfLife; function Will(address _beneficiary) public{ owner = msg.sender; beneficiary = _beneficiary; } function ImAlive() public { require(msg.sender == owner); lastSignOfLife = now; } function withdrawUponDeath() public { require(now > lastSignOfLife + deathTimeout); beneficiary.transfer(this.balance); } function withdrawWhenAlive(uint256 _amount) public { require(owner == msg.sender);//only owner can do this msg.sender.transfer(_amount); } function () payable public { } function getBalance() public view returns(uint256) { return this.balance; } }
0.4.18