Skip to content
Prev Previous commit
Next Next commit
Added encapsulation to Heritable public variables.
  • Loading branch information
trejas committed Jan 24, 2018
commit 6e89ffea1efe8df3fe7c1cab6824c0116fd2c15d
11 changes: 5 additions & 6 deletions contracts/ownership/Heritable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,20 @@ contract Heritable is Ownable {
heir = newHeir;
}


/**
* @dev Use these getter functions to access the internal variables in
* an inherited contract.
*/
function getHeir() public view returns(address) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of #666 we've adopted the convention that private state variables with public getters follow the naming convention that

  • state variable has a suffix underscore _, and
  • getter is the name of the variable without suffix underscore.

In this case, for example, we'd have address private heir_ and function heir() public view.

Can you please change the PR to follow this convention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

return heir;
return heir;
}

function getHeartbeatTimeout() public view returns(uint256) {
return heartbeatTimeout;
return heartbeatTimeout;
}

function getTimeOfDeath() public view returns(uint256) {
return timeOfDeath;
return timeOfDeath;
}

/**
Expand All @@ -82,7 +81,7 @@ contract Heritable is Ownable {
function proclaimDeath() public onlyHeir {
require(ownerLives());
OwnerProclaimedDead(owner, heir, timeOfDeath);
timeOfDeath = now;
timeOfDeath = block.timestamp;
}

/**
Expand All @@ -98,7 +97,7 @@ contract Heritable is Ownable {
*/
function claimHeirOwnership() public onlyHeir {
require(!ownerLives());
require(now >= timeOfDeath + heartbeatTimeout);
require(block.timestamp >= timeOfDeath + heartbeatTimeout);
OwnershipTransferred(owner, heir);
HeirOwnershipClaimed(owner, heir);
owner = heir;
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
},
"dependencies": {
"dotenv": "^4.0.0",
"ethjs-abi": "^0.2.1"
"ethjs-abi": "^0.2.1",
"lint": "^1.1.2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mistakenly installed this package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are correct. Fixed.

}
}