Browse Source

tests: fix most of the static warnings (#844)

Leo Arias 7 years ago
parent
commit
82ce197e44

+ 11 - 4
contracts/AddressUtils.sol

@@ -1,20 +1,27 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * Utility library of inline functions on addresses
  */
 library AddressUtils {
 
   /**
-   * Returns whether there is code in the target address
+   * Returns whether the target address is a contract
    * @dev This function will return false if invoked during the constructor of a contract,
    *  as the code is not actually created until after the constructor finishes.
-   * @param addr address address to check
-   * @return whether there is code in the target address
+   * @param addr address to check
+   * @return whether the target address is a contract
    */
   function isContract(address addr) internal view returns (bool) {
     uint256 size;
-    assembly { size := extcodesize(addr) }
+    // XXX Currently there is no better way to check if there is a contract in an address
+    // than to check the size of the code at that address.
+    // See https://ethereum.stackexchange.com/a/14016/36603
+    // for more details about how this works.
+    // TODO Check this again before the Serenity release, because all addresses will be
+    // contracts then.
+    assembly { size := extcodesize(addr) }  // solium-disable-line security/no-inline-assembly
     return size > 0;
   }
 

+ 1 - 1
contracts/DayLimit.sol

@@ -61,7 +61,7 @@ contract DayLimit {
    * @return uint256 of today's index.
    */
   function today() private view returns (uint256) {
-    return now / 1 days;
+    return block.timestamp / 1 days;
   }
 
   /**

+ 7 - 0
contracts/ECRecovery.sol

@@ -5,6 +5,10 @@ pragma solidity ^0.4.18;
  * @title Eliptic curve signature operations
  *
  * @dev Based on https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d
+ *
+ * TODO Remove this library once solidity supports passing a signature to ecrecover.
+ * See https://github.com/ethereum/solidity/issues/864
+ *
  */
 
 library ECRecovery {
@@ -25,6 +29,9 @@ library ECRecovery {
     }
 
     // Divide the signature in r, s and v variables
+    // ecrecover takes the signature parameters, and the only way to get them
+    // currently is to use assembly.
+    // solium-disable-next-line security/no-inline-assembly
     assembly {
       r := mload(add(sig, 32))
       s := mload(add(sig, 64))

+ 1 - 0
contracts/MerkleProof.sol

@@ -24,6 +24,7 @@ library MerkleProof {
     bytes32 computedHash = _leaf;
 
     for (uint256 i = 32; i <= _proof.length; i += 32) {
+      // solium-disable-next-line security/no-inline-assembly
       assembly {
         // Load the current element of the proof
         proofElement := mload(add(_proof, i))

+ 2 - 2
contracts/crowdsale/Crowdsale.sol

@@ -3,6 +3,7 @@ pragma solidity ^0.4.18;
 import "../token/ERC20/ERC20.sol";
 import "../math/SafeMath.sol";
 
+
 /**
  * @title Crowdsale
  * @dev Crowdsale is a base contract for managing a token crowdsale,
@@ -11,11 +12,10 @@ import "../math/SafeMath.sol";
  * functionality and/or custom behavior.
  * The external interface represents the basic interface for purchasing tokens, and conform
  * the base architecture for crowdsales. They are *not* intended to be modified / overriden.
- * The internal interface conforms the extensible and modifiable surface of crowdsales. Override 
+ * The internal interface conforms the extensible and modifiable surface of crowdsales. Override
  * the methods to add functionality. Consider using 'super' where appropiate to concatenate
  * behavior.
  */
-
 contract Crowdsale {
   using SafeMath for uint256;
 

+ 2 - 0
contracts/crowdsale/distribution/FinalizableCrowdsale.sol

@@ -4,6 +4,7 @@ import "../../math/SafeMath.sol";
 import "../../ownership/Ownable.sol";
 import "../validation/TimedCrowdsale.sol";
 
+
 /**
  * @title FinalizableCrowdsale
  * @dev Extension of Crowdsale where an owner can do extra work
@@ -37,4 +38,5 @@ contract FinalizableCrowdsale is TimedCrowdsale, Ownable {
    */
   function finalization() internal {
   }
+
 }

+ 11 - 9
contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol

@@ -4,6 +4,7 @@ import "../validation/TimedCrowdsale.sol";
 import "../../token/ERC20/ERC20.sol";
 import "../../math/SafeMath.sol";
 
+
 /**
  * @title PostDeliveryCrowdsale
  * @dev Crowdsale that locks tokens from withdrawal until it ends.
@@ -13,15 +14,6 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
 
   mapping(address => uint256) public balances;
 
-  /**
-   * @dev Overrides parent by storing balances instead of issuing tokens right away.
-   * @param _beneficiary Token purchaser
-   * @param _tokenAmount Amount of tokens purchased
-   */
-  function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
-    balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
-  }
-
   /**
    * @dev Withdraw tokens only after crowdsale ends.
    */
@@ -32,4 +24,14 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
     balances[msg.sender] = 0;
     _deliverTokens(msg.sender, amount);
   }
+
+  /**
+   * @dev Overrides parent by storing balances instead of issuing tokens right away.
+   * @param _beneficiary Token purchaser
+   * @param _tokenAmount Amount of tokens purchased
+   */
+  function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
+    balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
+  }
+
 }

+ 5 - 4
contracts/crowdsale/price/IncreasingPriceCrowdsale.sol

@@ -3,9 +3,10 @@ pragma solidity ^0.4.18;
 import "../validation/TimedCrowdsale.sol";
 import "../../math/SafeMath.sol";
 
+
 /**
  * @title IncreasingPriceCrowdsale
- * @dev Extension of Crowdsale contract that increases the price of tokens linearly in time. 
+ * @dev Extension of Crowdsale contract that increases the price of tokens linearly in time.
  * Note that what should be provided to the constructor is the initial and final _rates_, that is,
  * the amount of tokens per wei contributed. Thus, the initial rate must be greater than the final rate.
  */
@@ -28,12 +29,12 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
   }
 
   /**
-   * @dev Returns the rate of tokens per wei at the present time. 
-   * Note that, as price _increases_ with time, the rate _decreases_. 
+   * @dev Returns the rate of tokens per wei at the present time.
+   * Note that, as price _increases_ with time, the rate _decreases_.
    * @return The number of tokens a buyer gets per wei at a given time
    */
   function getCurrentRate() public view returns (uint256) {
-    uint256 elapsedTime = now.sub(openingTime);
+    uint256 elapsedTime = block.timestamp.sub(openingTime);
     uint256 timeRange = closingTime.sub(openingTime);
     uint256 rateRange = initialRate.sub(finalRate);
     return initialRate.sub(elapsedTime.mul(rateRange).div(timeRange));

+ 5 - 5
contracts/crowdsale/validation/TimedCrowdsale.sol

@@ -15,10 +15,10 @@ contract TimedCrowdsale is Crowdsale {
   uint256 public closingTime;
 
   /**
-   * @dev Reverts if not in crowdsale time range. 
+   * @dev Reverts if not in crowdsale time range.
    */
   modifier onlyWhileOpen {
-    require(now >= openingTime && now <= closingTime);
+    require(block.timestamp >= openingTime && block.timestamp <= closingTime);
     _;
   }
 
@@ -28,7 +28,7 @@ contract TimedCrowdsale is Crowdsale {
    * @param _closingTime Crowdsale closing time
    */
   function TimedCrowdsale(uint256 _openingTime, uint256 _closingTime) public {
-    require(_openingTime >= now);
+    require(_openingTime >= block.timestamp);
     require(_closingTime >= _openingTime);
 
     openingTime = _openingTime;
@@ -40,9 +40,9 @@ contract TimedCrowdsale is Crowdsale {
    * @return Whether crowdsale period has elapsed
    */
   function hasClosed() public view returns (bool) {
-    return now > closingTime;
+    return block.timestamp > closingTime;
   }
-  
+
   /**
    * @dev Extend parent behavior requiring to be within contributing period
    * @param _beneficiary Token purchaser

+ 10 - 1
contracts/examples/SampleCrowdsale.sol

@@ -33,7 +33,16 @@ contract SampleCrowdsaleToken is MintableToken {
  */
 contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale, MintedCrowdsale {
 
-  function SampleCrowdsale(uint256 _openingTime, uint256 _closingTime, uint256 _rate, address _wallet, uint256 _cap, MintableToken _token, uint256 _goal) public
+  function SampleCrowdsale(
+    uint256 _openingTime,
+    uint256 _closingTime,
+    uint256 _rate,
+    address _wallet,
+    uint256 _cap,
+    MintableToken _token,
+    uint256 _goal
+  )
+    public
     Crowdsale(_rate, _wallet, _token)
     CappedCrowdsale(_cap)
     TimedCrowdsale(_openingTime, _closingTime)

+ 5 - 3
contracts/mocks/ERC223TokenMock.sol

@@ -2,10 +2,12 @@ pragma solidity ^0.4.18;
 
 import "../token/ERC20/BasicToken.sol";
 
+
 contract ERC223ContractInterface {
   function tokenFallback(address _from, uint256 _value, bytes _data) external;
 }
 
+
 contract ERC223TokenMock is BasicToken {
 
   function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
@@ -18,11 +20,11 @@ contract ERC223TokenMock is BasicToken {
     returns (bool success)
   {
     transfer(_to, _value);
-    bool is_contract = false;
+    bool isContract = false;
     assembly {
-      is_contract := not(iszero(extcodesize(_to)))
+      isContract := not(iszero(extcodesize(_to)))
     }
-    if (is_contract) {
+    if (isContract) {
       ERC223ContractInterface receiver = ERC223ContractInterface(_to);
       receiver.tokenFallback(msg.sender, _value, _data);
     }

+ 1 - 0
contracts/mocks/ERC721BasicTokenMock.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "../token/ERC721/ERC721BasicToken.sol";
 
+
 /**
  * @title ERC721BasicTokenMock
  * This mock just provides a public mint and burn functions for testing purposes

+ 2 - 1
contracts/mocks/ERC721ReceiverMock.sol

@@ -2,10 +2,11 @@ pragma solidity ^0.4.18;
 
 import "../token/ERC721/ERC721Receiver.sol";
 
+
 contract ERC721ReceiverMock is ERC721Receiver {
   bytes4 retval;
   bool reverts;
-  
+
   event Received(address _address, uint256 _tokenId, bytes _data, uint256 _gas);
 
   function ERC721ReceiverMock(bytes4 _retval, bool _reverts) public {

+ 2 - 1
contracts/mocks/ERC721TokenMock.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "../token/ERC721/ERC721Token.sol";
 
+
 /**
  * @title ERC721TokenMock
  * This mock just provides a public mint and burn functions for testing purposes,
@@ -23,4 +24,4 @@ contract ERC721TokenMock is ERC721Token {
   function setTokenURI(uint256 _tokenId, string _uri) public {
     super._setTokenURI(_tokenId, _uri);
   }
-}
+}

+ 1 - 0
contracts/mocks/MessageHelper.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.11;
 
+
 contract MessageHelper {
 
   event Show(bytes32 b32, uint256 number, string text);

+ 2 - 1
contracts/mocks/RefundableCrowdsaleImpl.sol

@@ -3,6 +3,7 @@ pragma solidity ^0.4.18;
 import "../token/ERC20/MintableToken.sol";
 import "../crowdsale/distribution/RefundableCrowdsale.sol";
 
+
 contract RefundableCrowdsaleImpl is RefundableCrowdsale {
 
   function RefundableCrowdsaleImpl (
@@ -12,7 +13,7 @@ contract RefundableCrowdsaleImpl is RefundableCrowdsale {
     address _wallet,
     MintableToken _token,
     uint256 _goal
-  ) 
+  )
     public
     Crowdsale(_rate, _wallet, _token)
     TimedCrowdsale(_openingTime, _closingTime)

+ 1 - 0
contracts/mocks/StandardTokenMock.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "../token/ERC20/StandardToken.sol";
 
+
 // mock class using StandardToken
 contract StandardTokenMock is StandardToken {
 

+ 2 - 1
contracts/mocks/TimedCrowdsaleImpl.sol

@@ -3,6 +3,7 @@ pragma solidity ^0.4.18;
 import "../token/ERC20/ERC20.sol";
 import "../crowdsale/validation/TimedCrowdsale.sol";
 
+
 contract TimedCrowdsaleImpl is TimedCrowdsale {
 
   function TimedCrowdsaleImpl (
@@ -11,7 +12,7 @@ contract TimedCrowdsaleImpl is TimedCrowdsale {
     uint256 _rate,
     address _wallet,
     ERC20 _token
-  ) 
+  )
     public
     Crowdsale(_rate, _wallet, _token)
     TimedCrowdsale(_openingTime, _closingTime)

+ 8 - 1
contracts/token/ERC20/SafeERC20.sol

@@ -15,7 +15,14 @@ library SafeERC20 {
     assert(token.transfer(to, value));
   }
 
-  function safeTransferFrom(ERC20 token, address from, address to, uint256 value) internal {
+  function safeTransferFrom(
+    ERC20 token,
+    address from,
+    address to,
+    uint256 value
+  )
+    internal
+  {
     assert(token.transferFrom(from, to, value));
   }
 

+ 2 - 2
contracts/token/ERC20/TokenTimelock.sol

@@ -21,7 +21,7 @@ contract TokenTimelock {
   uint256 public releaseTime;
 
   function TokenTimelock(ERC20Basic _token, address _beneficiary, uint256 _releaseTime) public {
-    require(_releaseTime > now);
+    require(_releaseTime > block.timestamp);
     token = _token;
     beneficiary = _beneficiary;
     releaseTime = _releaseTime;
@@ -31,7 +31,7 @@ contract TokenTimelock {
    * @notice Transfers tokens held by timelock to beneficiary.
    */
   function release() public {
-    require(now >= releaseTime);
+    require(block.timestamp >= releaseTime);
 
     uint256 amount = token.balanceOf(this);
     require(amount > 0);

+ 12 - 4
contracts/token/ERC20/TokenVesting.sol

@@ -40,7 +40,15 @@ contract TokenVesting is Ownable {
    * @param _duration duration in seconds of the period in which the tokens will vest
    * @param _revocable whether the vesting is revocable or not
    */
-  function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public {
+  function TokenVesting(
+    address _beneficiary,
+    uint256 _start,
+    uint256 _cliff,
+    uint256 _duration,
+    bool _revocable
+  )
+    public
+  {
     require(_beneficiary != address(0));
     require(_cliff <= _duration);
 
@@ -104,12 +112,12 @@ contract TokenVesting is Ownable {
     uint256 currentBalance = token.balanceOf(this);
     uint256 totalBalance = currentBalance.add(released[token]);
 
-    if (now < cliff) {
+    if (block.timestamp < cliff) {
       return 0;
-    } else if (now >= start.add(duration) || revoked[token]) {
+    } else if (block.timestamp >= start.add(duration) || revoked[token]) {
       return totalBalance;
     } else {
-      return totalBalance.mul(now.sub(start)).div(duration);
+      return totalBalance.mul(block.timestamp.sub(start)).div(duration);
     }
   }
 }

+ 1 - 1
contracts/token/ERC721/DeprecatedERC721.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./ERC721.sol";
 
+
 /**
  * @title ERC-721 methods shipped in OpenZeppelin v1.7.0, removed in the latest version of the standard
  * @dev Only use this interface for compatibility with previously deployed contracts
@@ -12,4 +13,3 @@ contract DeprecatedERC721 is ERC721 {
   function transfer(address _to, uint256 _tokenId) public;
   function tokensOf(address _owner) public view returns (uint256[]);
 }
-

+ 3 - 0
contracts/token/ERC721/ERC721.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./ERC721Basic.sol";
 
+
 /**
  * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
  * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
@@ -12,6 +13,7 @@ contract ERC721Enumerable is ERC721Basic {
   function tokenByIndex(uint256 _index) public view returns (uint256);
 }
 
+
 /**
  * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
  * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
@@ -22,6 +24,7 @@ contract ERC721Metadata is ERC721Basic {
   function tokenURI(uint256 _tokenId) public view returns (string);
 }
 
+
 /**
  * @title ERC-721 Non-Fungible Token Standard, full implementation interface
  * @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md

+ 12 - 5
contracts/token/ERC721/ERC721Basic.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * @title ERC721 Non-Fungible Token Standard basic interface
  * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
@@ -7,19 +8,25 @@ pragma solidity ^0.4.18;
 contract ERC721Basic {
   event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
   event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
-  event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);  
+  event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
 
   function balanceOf(address _owner) public view returns (uint256 _balance);
   function ownerOf(uint256 _tokenId) public view returns (address _owner);
   function exists(uint256 _tokenId) public view returns (bool _exists);
-  
+
   function approve(address _to, uint256 _tokenId) public;
   function getApproved(uint256 _tokenId) public view returns (address _operator);
-  
+
   function setApprovalForAll(address _operator, bool _approved) public;
   function isApprovedForAll(address _owner, address _operator) public view returns (bool);
 
   function transferFrom(address _from, address _to, uint256 _tokenId) public;
-  function safeTransferFrom(address _from, address _to, uint256 _tokenId) public;  
-  function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public;
+  function safeTransferFrom(address _from, address _to, uint256 _tokenId) public;
+  function safeTransferFrom(
+    address _from,
+    address _to,
+    uint256 _tokenId,
+    bytes _data
+  )
+    public;
 }

+ 30 - 7
contracts/token/ERC721/ERC721BasicToken.sol

@@ -5,6 +5,7 @@ import "./ERC721Receiver.sol";
 import "../../math/SafeMath.sol";
 import "../../AddressUtils.sol";
 
+
 /**
  * @title ERC721 Non-Fungible Token Standard basic implementation
  * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
@@ -12,10 +13,10 @@ import "../../AddressUtils.sol";
 contract ERC721BasicToken is ERC721Basic {
   using SafeMath for uint256;
   using AddressUtils for address;
-  
+
   // Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`
   // which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
-  bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; 
+  bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
 
   // Mapping from token ID to owner
   mapping (uint256 => address) internal tokenOwner;
@@ -106,7 +107,6 @@ contract ERC721BasicToken is ERC721Basic {
     return tokenApprovals[_tokenId];
   }
 
-
   /**
   * @dev Sets or unsets the approval of a given operator
   * @dev An operator is allowed to transfer all tokens of the sender on their behalf
@@ -144,7 +144,7 @@ contract ERC721BasicToken is ERC721Basic {
     clearApproval(_from, _tokenId);
     removeTokenFrom(_from, _tokenId);
     addTokenTo(_to, _tokenId);
-    
+
     Transfer(_from, _to, _tokenId);
   }
 
@@ -159,7 +159,14 @@ contract ERC721BasicToken is ERC721Basic {
   * @param _to address to receive the ownership of the given token ID
   * @param _tokenId uint256 ID of the token to be transferred
   */
-  function safeTransferFrom(address _from, address _to, uint256 _tokenId) public canTransfer(_tokenId) {
+  function safeTransferFrom(
+    address _from,
+    address _to,
+    uint256 _tokenId
+  )
+    public
+    canTransfer(_tokenId)
+  {
     safeTransferFrom(_from, _to, _tokenId, "");
   }
 
@@ -175,7 +182,15 @@ contract ERC721BasicToken is ERC721Basic {
   * @param _tokenId uint256 ID of the token to be transferred
   * @param _data bytes data to send along with a safe transfer check
   */
-  function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public canTransfer(_tokenId) {
+  function safeTransferFrom(
+    address _from,
+    address _to,
+    uint256 _tokenId,
+    bytes _data
+  )
+    public
+    canTransfer(_tokenId)
+  {
     transferFrom(_from, _to, _tokenId);
     require(checkAndCallSafeTransfer(_from, _to, _tokenId, _data));
   }
@@ -260,7 +275,15 @@ contract ERC721BasicToken is ERC721Basic {
   * @param _data bytes optional data to send along with the call
   * @return whether the call correctly returned the expected magic value
   */
-  function checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool) {
+  function checkAndCallSafeTransfer(
+    address _from,
+    address _to,
+    uint256 _tokenId,
+    bytes _data
+  )
+    internal
+    returns (bool)
+  {
     if (!_to.isContract()) {
       return true;
     }

+ 1 - 0
contracts/token/ERC721/ERC721Holder.sol

@@ -2,6 +2,7 @@ pragma solidity ^0.4.18;
 
 import "./ERC721Receiver.sol";
 
+
 contract ERC721Holder is ERC721Receiver {
   function onERC721Received(address, uint256, bytes) public returns(bytes4) {
     return ERC721_RECEIVED;

+ 3 - 2
contracts/token/ERC721/ERC721Receiver.sol

@@ -1,5 +1,6 @@
 pragma solidity ^0.4.18;
 
+
 /**
  * @title ERC721 token receiver interface
  * @dev Interface for any contract that wants to support safeTransfers
@@ -11,7 +12,7 @@ contract ERC721Receiver {
    *  Equals to `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`,
    *  which can be also obtained as `ERC721Receiver(0).onERC721Received.selector`
    */
-  bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba; 
+  bytes4 constant ERC721_RECEIVED = 0xf0b9e5ba;
 
   /**
    * @notice Handle the receipt of an NFT
@@ -20,7 +21,7 @@ contract ERC721Receiver {
    *  transfer. This function MUST use 50,000 gas or less. Return of other
    *  than the magic value MUST result in the transaction being reverted.
    *  Note: the contract address is always the message sender.
-   * @param _from The sending address 
+   * @param _from The sending address
    * @param _tokenId The NFT identifier which is being transfered
    * @param _data Additional data with no specified format
    * @return `bytes4(keccak256("onERC721Received(address,uint256,bytes)"))`

+ 13 - 13
contracts/token/ERC721/ERC721Token.sol

@@ -30,7 +30,7 @@ contract ERC721Token is ERC721, ERC721BasicToken {
   // Mapping from token id to position in the allTokens array
   mapping(uint256 => uint256) internal allTokensIndex;
 
-  // Optional mapping for token URIs 
+  // Optional mapping for token URIs
   mapping(uint256 => string) internal tokenURIs;
 
   /**
@@ -67,17 +67,6 @@ contract ERC721Token is ERC721, ERC721BasicToken {
     return tokenURIs[_tokenId];
   }
 
-  /**
-  * @dev Internal function to set the token URI for a given token
-  * @dev Reverts if the token ID does not exist
-  * @param _tokenId uint256 ID of the token to set its URI
-  * @param _uri string URI to assign
-  */
-  function _setTokenURI(uint256 _tokenId, string _uri) internal {
-    require(exists(_tokenId));
-    tokenURIs[_tokenId] = _uri;
-  }
-
   /**
   * @dev Gets the token ID at a given index of the tokens list of the requested owner
   * @param _owner address owning the tokens list to be accessed
@@ -108,6 +97,17 @@ contract ERC721Token is ERC721, ERC721BasicToken {
     return allTokens[_index];
   }
 
+  /**
+  * @dev Internal function to set the token URI for a given token
+  * @dev Reverts if the token ID does not exist
+  * @param _tokenId uint256 ID of the token to set its URI
+  * @param _uri string URI to assign
+  */
+  function _setTokenURI(uint256 _tokenId, string _uri) internal {
+    require(exists(_tokenId));
+    tokenURIs[_tokenId] = _uri;
+  }
+
   /**
   * @dev Internal function to add a token ID to the list of a given address
   * @param _to address representing the new owner of the given token ID
@@ -151,7 +151,7 @@ contract ERC721Token is ERC721, ERC721BasicToken {
   */
   function _mint(address _to, uint256 _tokenId) internal {
     super._mint(_to, _tokenId);
-    
+
     allTokensIndex[_tokenId] = allTokens.length;
     allTokens.push(_tokenId);
   }

+ 8 - 1
contracts/token/ERC827/ERC827.sol

@@ -15,6 +15,13 @@ contract ERC827 is ERC20 {
 
   function approve( address _spender, uint256 _value, bytes _data ) public returns (bool);
   function transfer( address _to, uint256 _value, bytes _data ) public returns (bool);
-  function transferFrom( address _from, address _to, uint256 _value, bytes _data ) public returns (bool);
+  function transferFrom(
+    address _from,
+    address _to,
+    uint256 _value,
+    bytes _data
+  )
+    public
+    returns (bool);
 
 }

+ 9 - 1
contracts/token/ERC827/ERC827Token.sol

@@ -3,6 +3,7 @@ pragma solidity ^0.4.13;
 import "./ERC827.sol";
 import "../ERC20/StandardToken.sol";
 
+
 /**
    @title ERC827, an extension of ERC20 token standard
 
@@ -70,7 +71,14 @@ contract ERC827Token is ERC827, StandardToken {
 
      @return true if the call function was executed successfully
    */
-  function transferFrom(address _from, address _to, uint256 _value, bytes _data) public returns (bool) {
+  function transferFrom(
+    address _from,
+    address _to,
+    uint256 _value,
+    bytes _data
+  )
+    public returns (bool)
+  {
     require(_to != address(this));
 
     super.transferFrom(_from, _to, _value);