Browse Source

Add natspec comments to four ownership contracts

maurelian 8 years ago
parent
commit
e851938199

+ 16 - 4
contracts/ownership/Claimable.sol

@@ -4,14 +4,18 @@ pragma solidity ^0.4.8;
 import './Ownable.sol';
 
 
-/*
- * Claimable
- *
- * Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer.
+/**
+ * @title Claimable
+ * @dev Extension for the Ownable contract, where the ownership needs to be claimed. 
+ * This allows the new owner to accept the transfer.
  */
 contract Claimable is Ownable {
   address public pendingOwner;
 
+  /**
+   * @dev The onlyPendingOwner modifier throws if called by any account other than the 
+   * pendingOwner. 
+   */
   modifier onlyPendingOwner() {
     if (msg.sender != pendingOwner) {
       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 {
     pendingOwner = newOwner;
   }
 
+  /**
+   * @dev The claimOwnership function allows the pendingOwner address to finalize the transfer.
+   */
   function claimOwnership() onlyPendingOwner {
     owner = pendingOwner;
     pendingOwner = 0x0;

+ 12 - 5
contracts/ownership/Contactable.sol

@@ -1,15 +1,22 @@
 pragma solidity ^0.4.8;
 
 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{
 
-     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;
      }
 

+ 14 - 3
contracts/ownership/DelayedClaimable.sol

@@ -4,15 +4,22 @@ pragma solidity ^0.4.8;
 import './Claimable.sol';
 
 
-/*
- * DelayedClaimable
- * Extension for the Claimable contract, where the ownership needs to be claimed before/after certain block number
+/**
+ * @title DelayedClaimable
+ * @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
+ * a certain block number.
  */
 contract DelayedClaimable is Claimable {
 
   uint public end;
   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 {
     if (_start > _end)
         throw;
@@ -20,6 +27,10 @@ contract DelayedClaimable is Claimable {
     start = _start;
   }
 
+
+  /**
+   * @dev setLimit() modifier throws if called by any account other than the owner. 
+   */
   function claimOwnership() onlyPendingOwner {
     if ((block.number > end) || (block.number < start))
         throw;

+ 19 - 4
contracts/ownership/Ownable.sol

@@ -1,19 +1,28 @@
 pragma solidity ^0.4.8;
 
 
-/*
- * Ownable
+/**
+ * @title Ownable
  *
- * Base contract with an owner.
- * Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
+ * @dev The Ownable contract has an owner address, and provides basic authorization control 
+ * functions, this simplifies the implementation of "user permissions".
  */
 contract Ownable {
   address public owner;
 
+
+  /** 
+   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
+   * account.
+   */
   function Ownable() {
     owner = msg.sender;
   }
 
+
+  /**
+   * @dev The onlyOwner modifier throws if called by any account other than the owner. 
+   */
   modifier onlyOwner() {
     if (msg.sender != owner) {
       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 {
     if (newOwner != address(0)) {
       owner = newOwner;