SimpleSavingsWallet.sol 838 B

12345678910111213141516171819202122232425262728293031323334
  1. pragma solidity ^0.4.11;
  2. import "../ownership/Inheritable.sol";
  3. /**
  4. * @title SimpleSavingsWallet
  5. * @dev Simplest form of savings wallet that can be inherited if owner dies.
  6. */
  7. contract SimpleSavingsWallet is Inheritable {
  8. event Sent(address payee, uint amount, uint balance);
  9. event Received(address payer, uint amount, uint balance);
  10. function SimpleSavingsWallet(uint _heartbeatTimeout) Inheritable(_heartbeatTimeout) public {}
  11. /**
  12. * @dev wallet can receive funds.
  13. */
  14. function () public payable {
  15. Received(msg.sender, msg.value, this.balance);
  16. }
  17. /**
  18. * @dev wallet can send funds
  19. */
  20. function sendTo(address payee, uint amount) public onlyOwner {
  21. require(payee != 0 && payee != address(this));
  22. require(amount > 0);
  23. payee.transfer(amount);
  24. Sent(payee, amount, this.balance);
  25. }
  26. }