forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added example use-case for Inheritable.sol
- Loading branch information
1 parent
b709206
commit a613cd0
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |