renamed Inheritable --> Heritable
This commit is contained in:
committed by
Alejandro Santander
parent
fe712c678a
commit
52b6181d78
@ -1,24 +1,25 @@
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
import "../ownership/Inheritable.sol";
|
||||
import "../ownership/Heritable.sol";
|
||||
|
||||
|
||||
/**
|
||||
* @title SimpleSavingsWallet
|
||||
* @dev Simplest form of savings wallet that can be inherited if owner dies.
|
||||
* @dev Simplest form of savings wallet whose ownership can be claimed by a heir
|
||||
* if owner dies.
|
||||
* In this example, we take a very simple savings wallet providing two operations
|
||||
* (to send and receive funds) and extend its capabilities by making it Inheritable.
|
||||
* (to send and receive funds) and extend its capabilities by making it Heritable.
|
||||
* The account that creates the contract is set as owner, who has the authority to
|
||||
* choose an heir account. Heir account can reclaim the contract ownership in the
|
||||
* case that the owner dies.
|
||||
*/
|
||||
contract SimpleSavingsWallet is Inheritable {
|
||||
contract SimpleSavingsWallet is Heritable {
|
||||
|
||||
event Sent(address payee, uint amount, uint balance);
|
||||
event Received(address payer, uint amount, uint balance);
|
||||
|
||||
|
||||
function SimpleSavingsWallet(uint _heartbeatTimeout) Inheritable(_heartbeatTimeout) public {}
|
||||
function SimpleSavingsWallet(uint _heartbeatTimeout) Heritable(_heartbeatTimeout) public {}
|
||||
|
||||
/**
|
||||
* @dev wallet can receive funds.
|
||||
|
||||
@ -5,12 +5,12 @@ import './Ownable.sol';
|
||||
|
||||
|
||||
/**
|
||||
* @title Inheritable
|
||||
* @dev The Inheritable contract provides ownership transfer capabilities, in the
|
||||
* @title Heritable
|
||||
* @dev The Heritable contract provides ownership transfer capabilities, in the
|
||||
* case that the current owner stops "heartbeating". Only the heir can pronounce the
|
||||
* owner's death.
|
||||
*/
|
||||
contract Inheritable is Ownable {
|
||||
contract Heritable is Ownable {
|
||||
address public heir;
|
||||
|
||||
// Time window the owner has to notify they are alive.
|
||||
@ -35,11 +35,11 @@ contract Inheritable is Ownable {
|
||||
|
||||
|
||||
/**
|
||||
* @notice Create a new Inheritable Contract with heir address 0x0.
|
||||
* @notice Create a new Heritable Contract with heir address 0x0.
|
||||
* @param _heartbeatTimeout time available for the owner to notify they are alive,
|
||||
* before the heir can take ownership.
|
||||
*/
|
||||
function Inheritable(uint _heartbeatTimeout) public {
|
||||
function Heritable(uint _heartbeatTimeout) public {
|
||||
setHeartbeatTimeout(_heartbeatTimeout);
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ contract Inheritable is Ownable {
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Heir can pronounce the owners death. To inherit the ownership, they will
|
||||
* @dev Heir can pronounce the owners death. To claim the ownership, they will
|
||||
* have to wait for `heartbeatTimeout` seconds.
|
||||
*/
|
||||
function proclaimDeath() public onlyHeir {
|
||||
@ -79,7 +79,7 @@ contract Inheritable is Ownable {
|
||||
/**
|
||||
* @dev Allows heir to transfer ownership only if heartbeat has timed out.
|
||||
*/
|
||||
function inherit() public onlyHeir {
|
||||
function claimHeirOwnership() public onlyHeir {
|
||||
require(!ownerLives());
|
||||
require(now >= timeOfDeath + heartbeatTimeout);
|
||||
OwnershipTransferred(owner, heir);
|
||||
Reference in New Issue
Block a user