Add natspec comments to four ownership contracts

pull/210/head
maurelian 8 years ago committed by maurelian
parent b788f33c6a
commit e851938199
  1. 20
      contracts/ownership/Claimable.sol
  2. 17
      contracts/ownership/Contactable.sol
  3. 17
      contracts/ownership/DelayedClaimable.sol
  4. 23
      contracts/ownership/Ownable.sol

@ -4,14 +4,18 @@ pragma solidity ^0.4.8;
import './Ownable.sol'; import './Ownable.sol';
/* /**
* Claimable * @title Claimable
* * @dev Extension for the Ownable contract, where the ownership needs to be claimed.
* Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer. * This allows the new owner to accept the transfer.
*/ */
contract Claimable is Ownable { contract Claimable is Ownable {
address public pendingOwner; address public pendingOwner;
/**
* @dev The onlyPendingOwner modifier throws if called by any account other than the
* pendingOwner.
*/
modifier onlyPendingOwner() { modifier onlyPendingOwner() {
if (msg.sender != pendingOwner) { if (msg.sender != pendingOwner) {
throw; throw;
@ -19,10 +23,18 @@ contract Claimable is Ownable {
_; _;
} }
/**
* @dev The transferOwnership function allows the current owner to set the pendingOwner
* address.
* @param pendingOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner; pendingOwner = newOwner;
} }
/**
* @dev The claimOwnership function allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner {
owner = pendingOwner; owner = pendingOwner;
pendingOwner = 0x0; pendingOwner = 0x0;

@ -1,15 +1,22 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.8;
import './Ownable.sol'; import './Ownable.sol';
/*
* Contactable token /**
* Basic version of a contactable contract * @title Contactable token
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
* contact information.
*/ */
contract Contactable is Ownable{ contract Contactable is Ownable{
string public contactInformation; string public contactInformation;
function setContactInformation(string info) onlyOwner{ /**
* @dev The setContactInformation() function allows the current owner to transfer control of the
* contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function setContactInformation(string info) onlyOwner{
contactInformation = info; contactInformation = info;
} }

@ -4,15 +4,22 @@ pragma solidity ^0.4.8;
import './Claimable.sol'; import './Claimable.sol';
/* /**
* DelayedClaimable * @title DelayedClaimable
* Extension for the Claimable contract, where the ownership needs to be claimed before/after certain block number * @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
* a certain block number.
*/ */
contract DelayedClaimable is Claimable { contract DelayedClaimable is Claimable {
uint public end; uint public end;
uint public start; uint public start;
/**
* @dev the setLimits function can be used to specify the time period during which a pending
* owner can claim ownership.
* @params _start The earliest time ownership can be claimed
* @params _end The latest time ownership can be claimed.
*/
function setLimits(uint _start, uint _end) onlyOwner { function setLimits(uint _start, uint _end) onlyOwner {
if (_start > _end) if (_start > _end)
throw; throw;
@ -20,6 +27,10 @@ contract DelayedClaimable is Claimable {
start = _start; start = _start;
} }
/**
* @dev setLimit() modifier throws if called by any account other than the owner.
*/
function claimOwnership() onlyPendingOwner { function claimOwnership() onlyPendingOwner {
if ((block.number > end) || (block.number < start)) if ((block.number > end) || (block.number < start))
throw; throw;

@ -1,19 +1,28 @@
pragma solidity ^0.4.8; pragma solidity ^0.4.8;
/* /**
* Ownable * @title Ownable
* *
* Base contract with an owner. * @dev The Ownable contract has an owner address, and provides basic authorization control
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner. * functions, this simplifies the implementation of "user permissions".
*/ */
contract Ownable { contract Ownable {
address public owner; address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() { function Ownable() {
owner = msg.sender; owner = msg.sender;
} }
/**
* @dev The onlyOwner modifier throws if called by any account other than the owner.
*/
modifier onlyOwner() { modifier onlyOwner() {
if (msg.sender != owner) { if (msg.sender != owner) {
throw; throw;
@ -21,6 +30,12 @@ contract Ownable {
_; _;
} }
/**
* @dev The transferOwnership function allows the current owner to transfer control of the
* contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner { function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) { if (newOwner != address(0)) {
owner = newOwner; owner = newOwner;

Loading…
Cancel
Save