diff --git a/.node-xmlhttprequest-sync-22450 b/.node-xmlhttprequest-sync-22450 deleted file mode 100644 index e69de29bb..000000000 diff --git a/contracts/DayLimit.sol b/contracts/DayLimit.sol index 1334d3f57..9964bd536 100644 --- a/contracts/DayLimit.sol +++ b/contracts/DayLimit.sol @@ -59,7 +59,7 @@ contract DayLimit { * @dev Private function to determine today's index * @return uint256 of today's index. */ - function today() private constant returns (uint256) { + function today() private view returns (uint256) { return now / 1 days; } diff --git a/contracts/ECRecovery.sol b/contracts/ECRecovery.sol index 4c156cace..3876ca6e8 100644 --- a/contracts/ECRecovery.sol +++ b/contracts/ECRecovery.sol @@ -14,7 +14,7 @@ library ECRecovery { * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param sig bytes signature, the signature is generated using web3.eth.sign() */ - function recover(bytes32 hash, bytes sig) public constant returns (address) { + function recover(bytes32 hash, bytes sig) public pure returns (address) { bytes32 r; bytes32 s; uint8 v; diff --git a/contracts/MerkleProof.sol b/contracts/MerkleProof.sol index 6e31654f7..e638c8e9d 100644 --- a/contracts/MerkleProof.sol +++ b/contracts/MerkleProof.sol @@ -13,7 +13,7 @@ library MerkleProof { * @param _root Merkle root * @param _leaf Leaf of Merkle tree */ - function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) constant returns (bool) { + function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf) pure returns (bool) { // Check if proof length is a multiple of 32 if (_proof.length % 32 != 0) return false; diff --git a/contracts/crowdsale/CappedCrowdsale.sol b/contracts/crowdsale/CappedCrowdsale.sol index f81d80e39..972c1fc1b 100644 --- a/contracts/crowdsale/CappedCrowdsale.sol +++ b/contracts/crowdsale/CappedCrowdsale.sol @@ -19,14 +19,14 @@ contract CappedCrowdsale is Crowdsale { // overriding Crowdsale#validPurchase to add extra cap logic // @return true if investors can buy at the moment - function validPurchase() internal constant returns (bool) { + function validPurchase() internal view returns (bool) { bool withinCap = weiRaised.add(msg.value) <= cap; return super.validPurchase() && withinCap; } // overriding Crowdsale#hasEnded to add cap logic // @return true if crowdsale event has ended - function hasEnded() public constant returns (bool) { + function hasEnded() public view returns (bool) { bool capReached = weiRaised >= cap; return super.hasEnded() || capReached; } diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 72c0abe9d..27ccac3f0 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -91,14 +91,14 @@ contract Crowdsale { } // @return true if the transaction can buy tokens - function validPurchase() internal constant returns (bool) { + function validPurchase() internal view returns (bool) { bool withinPeriod = now >= startTime && now <= endTime; bool nonZeroPurchase = msg.value != 0; return withinPeriod && nonZeroPurchase; } // @return true if crowdsale event has ended - function hasEnded() public constant returns (bool) { + function hasEnded() public view returns (bool) { return now > endTime; } diff --git a/contracts/crowdsale/RefundableCrowdsale.sol b/contracts/crowdsale/RefundableCrowdsale.sol index 6846df944..c468fcf34 100644 --- a/contracts/crowdsale/RefundableCrowdsale.sol +++ b/contracts/crowdsale/RefundableCrowdsale.sol @@ -53,7 +53,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { super.finalization(); } - function goalReached() public constant returns (bool) { + function goalReached() public view returns (bool) { return weiRaised >= goal; } diff --git a/contracts/math/Math.sol b/contracts/math/Math.sol index e22f67eaf..5d09ee6ff 100644 --- a/contracts/math/Math.sol +++ b/contracts/math/Math.sol @@ -6,19 +6,19 @@ pragma solidity ^0.4.18; */ library Math { - function max64(uint64 a, uint64 b) internal constant returns (uint64) { + function max64(uint64 a, uint64 b) internal pure returns (uint64) { return a >= b ? a : b; } - function min64(uint64 a, uint64 b) internal constant returns (uint64) { + function min64(uint64 a, uint64 b) internal pure returns (uint64) { return a < b ? a : b; } - function max256(uint256 a, uint256 b) internal constant returns (uint256) { + function max256(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } - function min256(uint256 a, uint256 b) internal constant returns (uint256) { + function min256(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } } diff --git a/contracts/math/SafeMath.sol b/contracts/math/SafeMath.sol index d138b79cc..234daf656 100644 --- a/contracts/math/SafeMath.sol +++ b/contracts/math/SafeMath.sol @@ -6,7 +6,7 @@ pragma solidity ^0.4.18; * @dev Math operations with safety checks that throw on error */ library SafeMath { - function mul(uint256 a, uint256 b) internal constant returns (uint256) { + function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } @@ -15,19 +15,19 @@ library SafeMath { return c; } - function div(uint256 a, uint256 b) internal constant returns (uint256) { + function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } - function sub(uint256 a, uint256 b) internal constant returns (uint256) { + function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } - function add(uint256 a, uint256 b) internal constant returns (uint256) { + function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; diff --git a/contracts/token/BasicToken.sol b/contracts/token/BasicToken.sol index ed5bcd5e3..0bd7603fb 100644 --- a/contracts/token/BasicToken.sol +++ b/contracts/token/BasicToken.sol @@ -35,7 +35,7 @@ contract BasicToken is ERC20Basic { * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ - function balanceOf(address _owner) public constant returns (uint256 balance) { + function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } diff --git a/contracts/token/ERC20.sol b/contracts/token/ERC20.sol index 9a18538f4..28ffc0165 100644 --- a/contracts/token/ERC20.sol +++ b/contracts/token/ERC20.sol @@ -9,7 +9,7 @@ import './ERC20Basic.sol'; * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { - function allowance(address owner, address spender) public constant returns (uint256); + function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); diff --git a/contracts/token/ERC20Basic.sol b/contracts/token/ERC20Basic.sol index 5aa992546..c972edac6 100644 --- a/contracts/token/ERC20Basic.sol +++ b/contracts/token/ERC20Basic.sol @@ -8,7 +8,7 @@ pragma solidity ^0.4.18; */ contract ERC20Basic { uint256 public totalSupply; - function balanceOf(address who) public constant returns (uint256); + function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index 8556a718b..343d36e1f 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -57,7 +57,7 @@ contract StandardToken is ERC20, BasicToken { * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ - function allowance(address _owner, address _spender) public constant returns (uint256) { + function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; } diff --git a/contracts/token/TokenVesting.sol b/contracts/token/TokenVesting.sol index b021a6b8f..14373d15b 100644 --- a/contracts/token/TokenVesting.sol +++ b/contracts/token/TokenVesting.sol @@ -91,7 +91,7 @@ contract TokenVesting is Ownable { * @dev Calculates the amount that has already vested but hasn't been released yet. * @param token ERC20 token which is being vested */ - function releasableAmount(ERC20Basic token) public constant returns (uint256) { + function releasableAmount(ERC20Basic token) public view returns (uint256) { return vestedAmount(token).sub(released[token]); } @@ -99,7 +99,7 @@ contract TokenVesting is Ownable { * @dev Calculates the amount that has already vested. * @param token ERC20 token which is being vested */ - function vestedAmount(ERC20Basic token) public constant returns (uint256) { + function vestedAmount(ERC20Basic token) public view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]);