Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace constant with view/pure
  • Loading branch information
eternauta1337 committed Nov 22, 2017
commit 815d9e1f457f57cfbb1b4e889f2255c9a517f661
Empty file removed .node-xmlhttprequest-sync-22450
Empty file.
2 changes: 1 addition & 1 deletion contracts/DayLimit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/ECRecovery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/MerkleProof.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions contracts/crowdsale/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/crowdsale/Crowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/RefundableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions contracts/math/Math.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 4 additions & 4 deletions contracts/math/SafeMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/BasicToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC20Basic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion contracts/token/StandardToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/token/TokenVesting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ 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]);
}

/**
* @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]);

Expand Down