Parcourir la source

Minor changes to doc comments for token and other contracts

maurelian il y a 8 ans
Parent
commit
d357cf3a2e

+ 7 - 4
contracts/Bounty.sol

@@ -16,7 +16,7 @@ contract Bounty is PullPayment, Destructible {
   event TargetCreated(address createdAddress);
 
   /**
-   * @dev Function that allows the contract to recieve funds, if it hasn't been claimed.
+   * @dev Fallback function allowing the contract to recieve funds, if they haven't already been claimed.
    */
   function() payable {
     if (claimed) {
@@ -25,7 +25,8 @@ contract Bounty is PullPayment, Destructible {
   }
 
   /**
-   * @dev Create and deploy the target contract(extension of Target contract), and sets the msg.sender as a researcher
+   * @dev Create and deploy the target contract (extension of Target contract), and sets the 
+   * msg.sender as a researcher
    * @return A target contract
    */
   function createTarget() returns(Target) {
@@ -68,8 +69,10 @@ contract Bounty is PullPayment, Destructible {
 contract Target {
 
    /**
-    * @dev Funtion tha should check everything your contract assumes to be true all the time. If this function returns false, it means your contract was broken in some way and is in an inconsistent state. This is what security researchers will try to acomplish when trying to get the bounty.
-    * @return A boolean that indicates if the contract is broken or not.
+    * @dev Checks all values a contract assumes to be true all the time. If this function returns 
+    * false, the contract is broken in some way and is in an inconsistent state. 
+    * In order to win the bounty, security researchers will try to cause this broken state. 
+    * @return True if all invariant values are correct, false otherwise. 
     */
   function checkInvariant() returns(bool);
 }

+ 8 - 7
contracts/DayLimit.sol

@@ -2,7 +2,8 @@ pragma solidity ^0.4.8;
 
 /**
  * @title DayLimit
- * @dev Base contract that enables methods to be protected by placing a linear limit (specifiable) on a particular resource per calendar day. Is multiowned to allow the limit to be altered
+ * @dev Base contract that enables methods to be protected by placing a linear limit (specifiable)
+ * on a particular resource per calendar day. Is multiowned to allow the limit to be altered.
  */
 contract DayLimit {
 
@@ -11,7 +12,7 @@ contract DayLimit {
   uint public lastDay;
 
   /**
-   * @dev Constructor that sets the passed value as a dailyLimit
+   * @dev Constructor that sets the passed value as a dailyLimit.
    * @param _limit Uint to represent the daily limit.
    */
   function DayLimit(uint _limit) {
@@ -20,7 +21,7 @@ contract DayLimit {
   }
 
   /**
-   * @dev sets the daily limit. doesn't alter the amount already spent today
+   * @dev sets the daily limit. Does not alter the amount already spent today.
    * @param _newLimit Uint to represent the new limit.
    */
   function _setDailyLimit(uint _newLimit) internal {
@@ -35,8 +36,8 @@ contract DayLimit {
   }
 
   /**
-   * @dev Checks to see if there is enough resource to spend today. If true, the resource is expended.
-   * @param _value Uint representing the amout of resurce to spend.
+   * @dev Checks to see if there is enough resource to spend today. If true, the resource may be expended.
+   * @param _value Uint representing the amount of resource to spend.
    * @return A boolean that is True if the resource was spended and false otherwise.
    */
   function underLimit(uint _value) internal returns (bool) {
@@ -55,8 +56,8 @@ contract DayLimit {
   }
 
   /**
-   * @dev Private function to determine today index
-   * @return Uint of todays index.
+   * @dev Private function to determine today's index
+   * @return Uint of today's index.
    */
   function today() private constant returns (uint) {
     return now / 1 days;

+ 1 - 1
contracts/LimitBalance.sol

@@ -12,7 +12,7 @@ contract LimitBalance {
   uint public limit;
 
   /**
-   * @dev Constructor that sets the passed value as a limit
+   * @dev Constructor that sets the passed value as a limit. 
    * @param _limit Uint to represent the limit.
    */
   function LimitBalance(uint _limit) {

+ 17 - 11
contracts/ReentrancyGuard.sol

@@ -1,20 +1,26 @@
 pragma solidity ^0.4.8;
 
-/// @title Helps contracts guard agains rentrancy attacks.
-/// @author Remco Bloemen <remco@2π.com>
-/// @notice If you mark a function `nonReentrant`, you should also
-/// mark it `external`.
+/**
+ * @title Helps contracts guard agains rentrancy attacks.
+ * @author Remco Bloemen <remco@2π.com>
+ * @notice If you mark a function `nonReentrant`, you should also
+ * mark it `external`.
+ */
 contract ReentrancyGuard {
 
-  /// @dev We use a single lock for the whole contract.
+  /**
+   * @dev We use a single lock for the whole contract. 
+   */
   bool private rentrancy_lock = false;
 
-  /// Prevent contract from calling itself, directly or indirectly.
-  /// @notice If you mark a function `nonReentrant`, you should also
-  /// mark it `external`. Calling one nonReentrant function from
-  /// another is not supported. Instead, you can implement a
-  /// `private` function doing the actual work, and a `external`
-  /// wrapper marked as `nonReentrant`.
+  /**
+   * @dev Prevents a contract from calling itself, directly or indirectly.
+   * @notice If you mark a function `nonReentrant`, you should also
+   * mark it `external`. Calling one nonReentrant function from
+   * another is not supported. Instead, you can implement a
+   * `private` function doing the actual work, and a `external`
+   * wrapper marked as `nonReentrant`.
+   */
   modifier nonReentrant() {
     if(rentrancy_lock == false) {
       rentrancy_lock = true;

+ 5 - 5
contracts/ownership/Shareable.sol

@@ -44,9 +44,8 @@ contract Shareable {
   
   /** 
    * @dev Modifier for multisig functions. 
-   * @param _operation The operation must have an intrinsic hash in order
-   * that later attempts can be realised as the same underlying operation and
-   * thus count as confirmations.
+   * @param _operation The operation must have an intrinsic hash in order that later attempts can be
+   * realised as the same underlying operation and thus count as confirmations.
    */
   modifier onlymanyowners(bytes32 _operation) {
     if (confirmAndCheck(_operation)) {
@@ -59,6 +58,7 @@ contract Shareable {
    * transactions as well as the selection of addresses capable of confirming them.
    * @param _owners A list of owners.
    * @param _required The amount required for a transaction to be approved.
+   * @param _limit Uint to represent the daily limit.
    */
   function Shareable(address[] _owners, uint _required) {
     owners[1] = msg.sender;
@@ -74,8 +74,8 @@ contract Shareable {
   }
 
   /**
-   * @dev Revokes a prior confirmation of the given operation
-   * @param _operation bytes32 A string the identfies the operation.
+   * @dev Revokes a prior confirmation of the given operation.
+   * @param _operation A string identifying the operation.
    */
   function revoke(bytes32 _operation) external {
     uint index = ownerIndex[msg.sender];

+ 7 - 7
contracts/token/BasicToken.sol

@@ -7,7 +7,7 @@ import '../SafeMath.sol';
 
 /**
  * @title Basic token
- * @dev Basic version of StandardToken, with no allowances
+ * @dev Basic version of StandardToken, with no allowances. 
  */
 contract BasicToken is ERC20Basic {
   using SafeMath for uint;
@@ -15,7 +15,7 @@ contract BasicToken is ERC20Basic {
   mapping(address => uint) balances;
 
   /**
-   * @dev Fix for the ERC20 short address attack
+   * @dev Fix for the ERC20 short address attack.
    */
   modifier onlyPayloadSize(uint size) {
      if(msg.data.length < size + 4) {
@@ -26,8 +26,8 @@ contract BasicToken is ERC20Basic {
 
   /**
   * @dev transfer token for a specified address
-  * @param _to address The address which you want to transfer to
-  * @param _value uint the amout to be transfered
+  * @param _to The address to transfer to.
+  * @param _value The amount to be transferred.
   */
   function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) {
     balances[msg.sender] = balances[msg.sender].sub(_value);
@@ -36,9 +36,9 @@ contract BasicToken is ERC20Basic {
   }
 
   /**
-  * @dev Function to get the balance of the specified address
-  * @param _owner address The address you wish to get the balance from
-  * @return An uint representing the amout owned by the passed address
+  * @dev Gets the balance of the specified address.
+  * @param _owner The address to query the the balance of. 
+  * @return An uint representing the amount owned by the passed address.
   */
   function balanceOf(address _owner) constant returns (uint balance) {
     return balances[_owner];

+ 12 - 12
contracts/token/CrowdsaleToken.sol

@@ -4,12 +4,12 @@ pragma solidity ^0.4.8;
 import "./StandardToken.sol";
 
 
-/*
+/**
  * @title CrowdsaleToken
  *
  * @dev Simple ERC20 Token example, with crowdsale token creation
- * @dev IMPORTANT NOTE: do not use or deploy this contract as-is. It
- needs some changes to be production ready.
+ * @dev IMPORTANT NOTE: do not use or deploy this contract as-is. It needs some changes to be 
+ * production ready.
  */
 contract CrowdsaleToken is StandardToken {
 
@@ -24,17 +24,17 @@ contract CrowdsaleToken is StandardToken {
   uint public constant PRICE = 500;
 
   /**
-  * @dev A function that recieves ether and send the equivalent amount of
-  the token to the msg.sender
-  */
+   * @dev Fallback function which receives ether and sends the appropriate number of tokens to the 
+   * msg.sender.
+   */
   function () payable {
     createTokens(msg.sender);
   }
 
   /**
-  * @dev Function to create tokens and send to the specified address
-  * @param recipient address The address which will recieve the new tokens.
-  */
+   * @dev Creates tokens and send to the specified address.
+   * @param recipient The address which will recieve the new tokens.
+   */
   function createTokens(address recipient) payable {
     if (msg.value == 0) {
       throw;
@@ -51,9 +51,9 @@ contract CrowdsaleToken is StandardToken {
   }
 
   /**
-  * @dev replace this with any other price function
-  * @return The price per unit of token. 
-  */
+   * @dev replace this with any other price function
+   * @return The price per unit of token. 
+   */
   function getPrice() constant returns (uint result) {
     return PRICE;
   }

+ 26 - 30
contracts/token/LimitedTransferToken.sol

@@ -3,58 +3,54 @@ pragma solidity ^0.4.8;
 import "./ERC20.sol";
 
 /**
-
-* @title LimitedTransferToken
-
-* @dev LimitedTransferToken defines the generic interface and the implementation
-to limit token transferability for different events.
-It is intended to be used as a base class for other token contracts.
-LimitedTransferToken has been designed to allow for different limiting factors,
-this can be achieved by recursively calling super.transferableTokens() until the
-base class is hit. For example:
-function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
-  return min256(unlockedTokens, super.transferableTokens(holder, time));
-}
-
-A working example is VestedToken.sol:
-https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/VestedToken.sol
-
-*/
+ * @title LimitedTransferToken
+ * @dev LimitedTransferToken defines the generic interface and the implementation to limit token 
+ * transferability for different events. It is intended to be used as a base class for other token 
+ * contracts. 
+ * LimitedTransferToken has been designed to allow for different limiting factors,
+ * this can be achieved by recursively calling super.transferableTokens() until the base class is 
+ * hit. For example:
+ *     function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
+ *       return min256(unlockedTokens, super.transferableTokens(holder, time));
+ *     }
+ * A working example is VestedToken.sol:
+ * https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/VestedToken.sol
+ */
 
 contract LimitedTransferToken is ERC20 {
 
   /**
-  * @dev Checks whether it can transfer or otherwise throws.
-  */
+   * @dev Checks whether it can transfer or otherwise throws.
+   */
   modifier canTransfer(address _sender, uint _value) {
    if (_value > transferableTokens(_sender, uint64(now))) throw;
    _;
   }
 
   /**
-  * @dev Checks modifier and allows transfer if tokens are not locked.
-  * @param _to address The address that will recieve the tokens
-  * @param _value uint The amount of tokens to be transfered
-  */
+   * @dev Checks modifier and allows transfer if tokens are not locked.
+   * @param _to The address that will recieve the tokens.
+   * @param _value The amount of tokens to be transferred.
+   */
   function transfer(address _to, uint _value) canTransfer(msg.sender, _value) {
    return super.transfer(_to, _value);
   }
 
   /**
   * @dev Checks modifier and allows transfer if tokens are not locked.
-  * @param _from address The address that will send the tokens.
-  * @param _to address The address that will recieve the tokens.
-  * @param _value uint The amount of tokens to be transfered.
+  * @param _from The address that will send the tokens.
+  * @param _to The address that will recieve the tokens.
+  * @param _value The amount of tokens to be transferred.
   */
   function transferFrom(address _from, address _to, uint _value) canTransfer(_from, _value) {
    return super.transferFrom(_from, _to, _value);
   }
 
   /**
-  * @dev Default transferable tokens function returns all tokens for a holder (no limit).
-  * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide
-  the specific logic for limiting token transferability for a holder over time.
-  */
+   * @dev Default transferable tokens function returns all tokens for a holder (no limit).
+   * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the 
+   * specific logic for limiting token transferability for a holder over time.
+   */
   function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
     return balanceOf(holder);
   }

+ 10 - 10
contracts/token/MintableToken.sol

@@ -7,9 +7,9 @@ import '../ownership/Ownable.sol';
 
 
 /**
- * @tit;e Mintable token
+ * @title Mintable token
  * @dev: Simple ERC20 Token example, with mintable token creation
- @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
+ * @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
  * Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
  */
 
@@ -27,11 +27,11 @@ contract MintableToken is StandardToken, Ownable {
   }
 
   /**
-  * @dev Function to mint tokens
-  * @param _to address The address that will recieve the minted tokens
-  * @param _amout uint The amount of tokens to mint
-  * @return A boolean that indicates if the operation was successful
-  */
+   * @dev Function to mint tokens
+   * @param _to The address that will recieve the minted tokens.
+   * @param _amount The amount of tokens to mint.
+   * @return A boolean that indicates if the operation was successful.
+   */
   function mint(address _to, uint _amount) onlyOwner canMint returns (bool) {
     totalSupply = totalSupply.add(_amount);
     balances[_to] = balances[_to].add(_amount);
@@ -40,9 +40,9 @@ contract MintableToken is StandardToken, Ownable {
   }
 
   /**
-  * @dev Function to spot minting new tokens
-  * @return True if the operation was successful
-  */
+   * @dev Function to spot minting new tokens.
+   * @return True if the operation was successful.
+   */
   function finishMinting() onlyOwner returns (bool) {
     mintingFinished = true;
     MintFinished();

+ 5 - 6
contracts/token/SimpleToken.sol

@@ -6,10 +6,9 @@ import "./StandardToken.sol";
 
 /**
  * @title SimpleToken
- *
- * @dev Very simple ERC20 Token example, where all tokens are pre-assigned
- to the creator. Note they can later distribute these tokens
- as they wish using `transfer` and other `StandardToken` functions.
+ * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. 
+ * Note they can later distribute these tokens as they wish using `transfer` and other
+ * `StandardToken` functions.
  */
 contract SimpleToken is StandardToken {
 
@@ -19,8 +18,8 @@ contract SimpleToken is StandardToken {
   uint public INITIAL_SUPPLY = 10000;
 
   /**
-  * @dev Contructor that gives the msg.sender all of existing tokens. 
-  */
+   * @dev Contructor that gives msg.sender all of existing tokens. 
+   */
   function SimpleToken() {
     totalSupply = INITIAL_SUPPLY;
     balances[msg.sender] = INITIAL_SUPPLY;

+ 3 - 3
contracts/token/StandardToken.sol

@@ -36,9 +36,9 @@ contract StandardToken is BasicToken, ERC20 {
   }
 
   /**
-   * @dev Aprove the passed address to spend the specified amout tokens on the msg.sender behalf.
-   * @param _spender address The address which will spend the funds.
-   * @param _value uint the amout of tokens to be spended.
+   * @dev Aprove the passed address to spend the specified amount of tokens on beahlf of msg.sender.
+   * @param _spender The address which will spend the funds.
+   * @param _value The amount of tokens to be spent.
    */
   function approve(address _spender, uint _value) {
 

+ 46 - 47
contracts/token/VestedToken.sol

@@ -5,9 +5,9 @@ import "./StandardToken.sol";
 import "./LimitedTransferToken.sol";
 
 /**
-* @title Vested token
-* @dev Tokens that can be vested for a group of addresses.
-*/
+ * @title Vested token
+ * @dev Tokens that can be vested for a group of addresses.
+ */
 contract VestedToken is StandardToken, LimitedTransferToken {
 
   struct TokenGrant {
@@ -21,13 +21,13 @@ contract VestedToken is StandardToken, LimitedTransferToken {
   mapping (address => TokenGrant[]) public grants;
 
   /**
-  * @dev Grant tokens to a specified address
-  * @param _to address The address which the tokens will be granted to.
-  * @param _value uint256 The amount of tokens to be granted.
-  * @param _start uint64 Represents time of the begining of the grant.
-  * @param _cliff uint64 Represents the cliff period.
-  * @param _vesting uint64 Represents the vesting period.
-  */
+   * @dev Grant tokens to a specified address
+   * @param _to address The address which the tokens will be granted to.
+   * @param _value uint256 The amount of tokens to be granted.
+   * @param _start uint64 Represents time of the begining of the grant.
+   * @param _cliff uint64 Represents the cliff period.
+   * @param _vesting uint64 Represents the vesting period.
+   */
   function grantVestedTokens(
     address _to,
     uint256 _value,
@@ -53,11 +53,11 @@ contract VestedToken is StandardToken, LimitedTransferToken {
   }
 
 
-    /**
-    * @dev Revoke the grant of tokens of a specifed address.
-    * @param _holder address The address which will have its tokens revoked.
-    * @param _grantId uint The id of the token grant.
-    */
+  /**
+   * @dev Revoke the grant of tokens of a specifed address.
+   * @param _holder The address which will have its tokens revoked.
+   * @param _grantId The id of the token grant.
+   */
   function revokeTokenGrant(address _holder, uint _grantId) {
     TokenGrant grant = grants[_holder][_grantId];
 
@@ -76,22 +76,22 @@ contract VestedToken is StandardToken, LimitedTransferToken {
     Transfer(_holder, msg.sender, nonVested);
   }
 
- /**
- * @dev Check the amount of grants that an address has.
- * @param _holder address The holder of the grants.
- * @return A uint representing the total amount of grants.
- */
+  /**
+   * @dev Check the amount of grants that an address has.
+   * @param _holder The holder of the grants.
+   * @return A uint representing the total amount of grants.
+   */
   function tokenGrantsCount(address _holder) constant returns (uint index) {
     return grants[_holder].length;
   }
 
   /**
-  * @dev Get all information about a specifc grant.
-  * @param _holder address The address which will have its tokens revoked.
-  * @param _grantId uint The id of the token grant.
-  * @return Returns all the values that represent a TokenGrant(address, value,
-     start, cliff and vesting) plus the vested value at the current time.
-  */
+   * @dev Get all information about a specifc grant.
+   * @param _holder The address which will have its tokens revoked.
+   * @param _grantId The id of the token grant.
+   * @return Returns all the values that represent a TokenGrant(address, value, start, cliff 
+   * and vesting) plus the vested value at the current time.
+   */
   function tokenGrant(address _holder, uint _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting) {
     TokenGrant grant = grants[_holder][_grantId];
 
@@ -105,12 +105,11 @@ contract VestedToken is StandardToken, LimitedTransferToken {
   }
 
   /**
-  * @dev Get the amount of vested tokens at a specifc time.
-  * @param grant TokenGrant The grant to be checked.
-  * @param time uint64 The time to be checked
-  * @return An uint representing the amount of vested tokens of a specifc grant
-  on specifc time.
-  */
+   * @dev Get the amount of vested tokens at a specific time.
+   * @param grant TokenGrant The grant to be checked.
+   * @param time The time to be checked
+   * @return An uint representing the amount of vested tokens of a specific grant at a specific time.
+   */
   function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
     return calculateVestedTokens(
       grant.value,
@@ -154,21 +153,21 @@ contract VestedToken is StandardToken, LimitedTransferToken {
   }
 
   /**
-  * @dev Calculate the amount of non vested tokens at a specific time.
-  * @param grant TokenGrant The grant to be checked.
-  * @param time uint64 The time to be checked
-  * @return An uint representing the amount of non vested tokens of a specifc grant
-  on the passed time frame.
-  */
+   * @dev Calculate the amount of non vested tokens at a specific time.
+   * @param grant TokenGrant The grant to be checked.
+   * @param time uint64 The time to be checked
+   * @return An uint representing the amount of non vested tokens of a specifc grant on the 
+   * passed time frame.
+   */
   function nonVestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
     return grant.value.sub(vestedTokens(grant, time));
   }
 
   /**
-  * @dev Calculate the date when the holder can trasfer all its tokens
-  * @param holder address The address of the holder
-  * @return An uint representing the date of the last transferable tokens.
-  */
+   * @dev Calculate the date when the holder can trasfer all its tokens
+   * @param holder address The address of the holder
+   * @return An uint representing the date of the last transferable tokens.
+   */
   function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) {
     date = uint64(now);
     uint256 grantIndex = grants[holder].length;
@@ -178,11 +177,11 @@ contract VestedToken is StandardToken, LimitedTransferToken {
   }
 
   /**
-  * @dev Calculate the total amount of transferable tokens of a holder at a given time
-  * @param holder address The address of the holder
-  * @param time uint64 The specific time.
-  * @return An uint representing a holder's total amount of transferable tokens.
-  */
+   * @dev Calculate the total amount of transferable tokens of a holder at a given time
+   * @param holder address The address of the holder
+   * @param time uint64 The specific time.
+   * @return An uint representing a holder's total amount of transferable tokens.
+   */
   function transferableTokens(address holder, uint64 time) constant public returns (uint256 nonVested) {
     uint256 grantIndex = grants[holder].length;
     for (uint256 i = 0; i < grantIndex; i++) {