added example use-case for Inheritable.sol

pull/680/head
zava 7 years ago committed by Alejandro Santander
parent b709206f9f
commit a613cd03c9
  1. 34
      contracts/examples/SimpleSavingsWallet.sol

@ -0,0 +1,34 @@
pragma solidity ^0.4.11;
import "../ownership/Inheritable.sol";
/**
* @title SimpleSavingsWallet
* @dev Simplest form of savings wallet that can be inherited if owner dies.
*/
contract SimpleSavingsWallet is Inheritable {
event Sent(address payee, uint amount, uint balance);
event Received(address payer, uint amount, uint balance);
function SimpleSavingsWallet(uint _heartbeatTimeout) Inheritable(_heartbeatTimeout) public {}
/**
* @dev wallet can receive funds.
*/
function () public payable {
Received(msg.sender, msg.value, this.balance);
}
/**
* @dev wallet can send funds
*/
function sendTo(address payee, uint amount) public onlyOwner {
require(payee != 0 && payee != address(this));
require(amount > 0);
payee.transfer(amount);
Sent(payee, amount, this.balance);
}
}
Loading…
Cancel
Save