diff options
Diffstat (limited to 'test/compilationTests/zeppelin')
13 files changed, 30 insertions, 30 deletions
diff --git a/test/compilationTests/zeppelin/DayLimit.sol b/test/compilationTests/zeppelin/DayLimit.sol index 0bcb341a..e55076b7 100644 --- a/test/compilationTests/zeppelin/DayLimit.sol +++ b/test/compilationTests/zeppelin/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/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol index afae79b7..d4066812 100644 --- a/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol @@ -18,14 +18,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/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol index d798f41d..1f148a74 100644 --- a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol @@ -92,7 +92,7 @@ contract Crowdsale { } // @return true if the transaction can buy tokens - function validPurchase() internal constant returns (bool) { + function validPurchase() internal view returns (bool) { uint256 current = block.number; bool withinPeriod = current >= startBlock && current <= endBlock; bool nonZeroPurchase = msg.value != 0; @@ -100,7 +100,7 @@ contract Crowdsale { } // @return true if crowdsale event has ended - function hasEnded() public constant returns (bool) { + function hasEnded() public view returns (bool) { return block.number > endBlock; } diff --git a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol index 5e798d45..bb6b5e17 100644 --- a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol @@ -52,7 +52,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/test/compilationTests/zeppelin/math/Math.sol b/test/compilationTests/zeppelin/math/Math.sol index 3d016c0a..9997998a 100644 --- a/test/compilationTests/zeppelin/math/Math.sol +++ b/test/compilationTests/zeppelin/math/Math.sol @@ -6,19 +6,19 @@ pragma solidity ^0.4.11; */ 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/test/compilationTests/zeppelin/math/SafeMath.sol b/test/compilationTests/zeppelin/math/SafeMath.sol index dc05ba28..a98635e2 100644 --- a/test/compilationTests/zeppelin/math/SafeMath.sol +++ b/test/compilationTests/zeppelin/math/SafeMath.sol @@ -6,25 +6,25 @@ pragma solidity ^0.4.11; * @dev Math operations with safety checks that throw on error */ library SafeMath { - function mul(uint256 a, uint256 b) internal returns (uint256) { + function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } - function div(uint256 a, uint256 b) internal 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 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 returns (uint256) { + function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; diff --git a/test/compilationTests/zeppelin/ownership/Shareable.sol b/test/compilationTests/zeppelin/ownership/Shareable.sol index f8059650..c954052b 100644 --- a/test/compilationTests/zeppelin/ownership/Shareable.sol +++ b/test/compilationTests/zeppelin/ownership/Shareable.sol @@ -96,7 +96,7 @@ contract Shareable { * @param ownerIndex uint256 The index of the owner * @return The address of the owner */ - function getOwner(uint256 ownerIndex) external constant returns (address) { + function getOwner(uint256 ownerIndex) external view returns (address) { return address(owners[ownerIndex + 1]); } @@ -105,7 +105,7 @@ contract Shareable { * @param _addr address The address which you want to check. * @return True if the address is an owner and fase otherwise. */ - function isOwner(address _addr) constant returns (bool) { + function isOwner(address _addr) view returns (bool) { return ownerIndex[_addr] > 0; } @@ -115,7 +115,7 @@ contract Shareable { * @param _owner The owner address. * @return True if the owner has confirmed and false otherwise. */ - function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) { + function hasConfirmed(bytes32 _operation, address _owner) view returns (bool) { PendingState memory pending = pendings[_operation]; uint256 index = ownerIndex[_owner]; diff --git a/test/compilationTests/zeppelin/token/BasicToken.sol b/test/compilationTests/zeppelin/token/BasicToken.sol index 831f706e..8a3d8ead 100644 --- a/test/compilationTests/zeppelin/token/BasicToken.sol +++ b/test/compilationTests/zeppelin/token/BasicToken.sol @@ -30,7 +30,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) constant returns (uint256 balance) { + function balanceOf(address _owner) view returns (uint256 balance) { return balances[_owner]; } diff --git a/test/compilationTests/zeppelin/token/ERC20.sol b/test/compilationTests/zeppelin/token/ERC20.sol index 1045ac35..ae5aa624 100644 --- a/test/compilationTests/zeppelin/token/ERC20.sol +++ b/test/compilationTests/zeppelin/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) constant returns (uint256); + function allowance(address owner, address spender) view returns (uint256); function transferFrom(address from, address to, uint256 value); function approve(address spender, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); diff --git a/test/compilationTests/zeppelin/token/ERC20Basic.sol b/test/compilationTests/zeppelin/token/ERC20Basic.sol index 0e98779e..94fb7bcf 100644 --- a/test/compilationTests/zeppelin/token/ERC20Basic.sol +++ b/test/compilationTests/zeppelin/token/ERC20Basic.sol @@ -8,7 +8,7 @@ pragma solidity ^0.4.11; */ contract ERC20Basic { uint256 public totalSupply; - function balanceOf(address who) constant returns (uint256); + function balanceOf(address who) view returns (uint256); function transfer(address to, uint256 value); event Transfer(address indexed from, address indexed to, uint256 value); } diff --git a/test/compilationTests/zeppelin/token/LimitedTransferToken.sol b/test/compilationTests/zeppelin/token/LimitedTransferToken.sol index ee5032c9..0ccd60b2 100644 --- a/test/compilationTests/zeppelin/token/LimitedTransferToken.sol +++ b/test/compilationTests/zeppelin/token/LimitedTransferToken.sol @@ -10,7 +10,7 @@ import "./ERC20.sol"; * 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) { + * function transferableTokens(address holder, uint64 time) view public returns (uint256) { * return min256(unlockedTokens, super.transferableTokens(holder, time)); * } * A working example is VestedToken.sol: @@ -51,7 +51,7 @@ contract LimitedTransferToken is ERC20 { * @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) { + function transferableTokens(address holder, uint64 time) view public returns (uint256) { return balanceOf(holder); } } diff --git a/test/compilationTests/zeppelin/token/StandardToken.sol b/test/compilationTests/zeppelin/token/StandardToken.sol index ab9f582e..900a9102 100644 --- a/test/compilationTests/zeppelin/token/StandardToken.sol +++ b/test/compilationTests/zeppelin/token/StandardToken.sol @@ -58,7 +58,7 @@ contract StandardToken is ERC20, BasicToken { * @param _spender address The address which will spend the funds. * @return A uint256 specifing the amount of tokens still avaible for the spender. */ - function allowance(address _owner, address _spender) constant returns (uint256 remaining) { + function allowance(address _owner, address _spender) view returns (uint256 remaining) { return allowed[_owner][_spender]; } diff --git a/test/compilationTests/zeppelin/token/VestedToken.sol b/test/compilationTests/zeppelin/token/VestedToken.sol index e9929018..3953612d 100644 --- a/test/compilationTests/zeppelin/token/VestedToken.sol +++ b/test/compilationTests/zeppelin/token/VestedToken.sol @@ -106,7 +106,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param time uint64 The specific time. * @return An uint256 representing a holder's total amount of transferable tokens. */ - function transferableTokens(address holder, uint64 time) constant public returns (uint256) { + function transferableTokens(address holder, uint64 time) view public returns (uint256) { uint256 grantIndex = tokenGrantsCount(holder); if (grantIndex == 0) return balanceOf(holder); // shortcut for holder without grants @@ -130,7 +130,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param _holder The holder of the grants. * @return A uint256 representing the total amount of grants. */ - function tokenGrantsCount(address _holder) constant returns (uint256 index) { + function tokenGrantsCount(address _holder) view returns (uint256 index) { return grants[_holder].length; } @@ -163,7 +163,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { uint256 time, uint256 start, uint256 cliff, - uint256 vesting) constant returns (uint256) + uint256 vesting) view returns (uint256) { // Shortcuts for before cliff and after vesting cases. if (time < cliff) return 0; @@ -192,7 +192,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @return Returns all the values that represent a TokenGrant(address, value, start, cliff, * revokability, burnsOnRevoke, and vesting) plus the vested value at the current time. */ - function tokenGrant(address _holder, uint256 _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { + function tokenGrant(address _holder, uint256 _grantId) view returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { TokenGrant grant = grants[_holder][_grantId]; granter = grant.granter; @@ -212,7 +212,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param time The time to be checked * @return An uint256 representing the amount of vested tokens of a specific grant at a specific time. */ - function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) { + function vestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) { return calculateVestedTokens( grant.value, uint256(time), @@ -229,7 +229,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @return An uint256 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) { + function nonVestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) { return grant.value.sub(vestedTokens(grant, time)); } @@ -238,7 +238,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @param holder address The address of the holder * @return An uint256 representing the date of the last transferable tokens. */ - function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) { + function lastTokenIsTransferableDate(address holder) view public returns (uint64 date) { date = uint64(now); uint256 grantIndex = grants[holder].length; for (uint256 i = 0; i < grantIndex; i++) { |