Skip to content

Commit

Permalink
added example use-case for Inheritable.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
azavalla authored and eternauta1337 committed Jan 18, 2018
1 parent b709206 commit a613cd0
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions contracts/examples/SimpleSavingsWallet.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit a613cd0

Please sign in to comment.