diff options
Diffstat (limited to 'test/compilationTests')
46 files changed, 170 insertions, 166 deletions
diff --git a/test/compilationTests/MultiSigWallet/Factory.sol b/test/compilationTests/MultiSigWallet/Factory.sol index f7a96cbd..f37d230f 100644 --- a/test/compilationTests/MultiSigWallet/Factory.sol +++ b/test/compilationTests/MultiSigWallet/Factory.sol @@ -10,7 +10,7 @@ contract Factory { /// @return Returns number of instantiations by creator. function getInstantiationCount(address creator) public - constant + view returns (uint) { return instantiations[creator].length; diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol index e534d09a..6b10f17e 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol @@ -241,7 +241,7 @@ contract MultiSigWallet { /// @return Confirmation status. function isConfirmed(uint transactionId) public - constant + view returns (bool) { uint count = 0; @@ -285,7 +285,7 @@ contract MultiSigWallet { /// @return Number of confirmations. function getConfirmationCount(uint transactionId) public - constant + view returns (uint count) { for (uint i=0; i<owners.length; i++) @@ -299,7 +299,7 @@ contract MultiSigWallet { /// @return Total number of transactions after filters are applied. function getTransactionCount(bool pending, bool executed) public - constant + view returns (uint count) { for (uint i=0; i<transactionCount; i++) @@ -312,7 +312,7 @@ contract MultiSigWallet { /// @return List of owner addresses. function getOwners() public - constant + view returns (address[]) { return owners; @@ -323,7 +323,7 @@ contract MultiSigWallet { /// @return Returns array of owner addresses. function getConfirmations(uint transactionId) public - constant + view returns (address[] _confirmations) { address[] memory confirmationsTemp = new address[](owners.length); @@ -347,7 +347,7 @@ contract MultiSigWallet { /// @return Returns array of transaction IDs. function getTransactionIds(uint from, uint to, bool pending, bool executed) public - constant + view returns (uint[] _transactionIds) { uint[] memory transactionIdsTemp = new uint[](transactionCount); diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol index 0ca9fa54..3a68f662 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol @@ -85,7 +85,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { /// @return Returns amount. function calcMaxWithdraw() public - constant + view returns (uint) { if (now > lastDay + 24 hours) diff --git a/test/compilationTests/MultiSigWallet/TestToken.sol b/test/compilationTests/MultiSigWallet/TestToken.sol index 69727cbd..df195c58 100644 --- a/test/compilationTests/MultiSigWallet/TestToken.sol +++ b/test/compilationTests/MultiSigWallet/TestToken.sol @@ -59,7 +59,7 @@ contract TestToken { } function allowance(address _owner, address _spender) - constant + view public returns (uint256 remaining) { @@ -67,7 +67,7 @@ contract TestToken { } function balanceOf(address _owner) - constant + view public returns (uint256 balance) { diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index 54305d41..b6d8e035 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -81,7 +81,7 @@ contract ico is safeMath { } } - function ICObonus() public constant returns(uint256 bonus) { + function ICObonus() public view returns(uint256 bonus) { /* Query of current bonus @@ -113,7 +113,7 @@ contract ico is safeMath { return true; } - function checkInterest(address addr) public constant returns(uint256 amount) { + function checkInterest(address addr) public view returns(uint256 amount) { /* Query of compound interest @@ -355,7 +355,7 @@ contract ico is safeMath { } } - function getIcoReward(uint256 value) public constant returns (uint256 reward) { + function getIcoReward(uint256 value) public view returns (uint256 reward) { /* Expected token volume at token purchase @@ -368,7 +368,7 @@ contract ico is safeMath { if ( reward < 5e6) { return 0; } } - function isICO() public constant returns (bool success) { + function isICO() public view returns (bool success) { return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed ); } diff --git a/test/compilationTests/corion/module.sol b/test/compilationTests/corion/module.sol index 5f13215f..362283ef 100644 --- a/test/compilationTests/corion/module.sol +++ b/test/compilationTests/corion/module.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.11; contract abstractModuleHandler { function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {} - function balanceOf(address owner) public constant returns (bool success, uint256 value) {} + function balanceOf(address owner) public view returns (bool success, uint256 value) {} } contract module { @@ -127,7 +127,7 @@ contract module { if ( moduleStatus != status.Connected ) { return false; } return addr == moduleHandlerAddress; } - function isActive() public constant returns (bool success, bool active) { + function isActive() public view returns (bool success, bool active) { /* Check self for ready for functions or not. diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index e77d9e09..b3d03c2a 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -16,7 +16,7 @@ contract abstractModule { function disconnectModule() external returns (bool success) {} function replaceModule(address addr) external returns (bool success) {} function disableModule(bool forever) external returns (bool success) {} - function isActive() public constant returns (bool success) {} + function isActive() public view returns (bool success) {} function replaceModuleHandler(address newHandler) external returns (bool success) {} function transferEvent(address from, address to, uint256 value) external returns (bool success) {} function newSchellingRoundEvent(uint256 roundID, uint256 reward) external returns (bool success) {} @@ -81,7 +81,7 @@ contract moduleHandler is multiOwner, announcementTypes { } modules[id] = input; } - function getModuleAddressByName(string name) public constant returns( bool success, bool found, address addr ) { + function getModuleAddressByName(string name) public view returns( bool success, bool found, address addr ) { /* Search by name for module. The result is an Ethereum address. @@ -94,7 +94,7 @@ contract moduleHandler is multiOwner, announcementTypes { if ( _success && _found ) { return (true, true, modules[_id].addr); } return (true, false, address(0x00)); } - function getModuleIDByHash(bytes32 hashOfName) public constant returns( bool success, bool found, uint256 id ) { + function getModuleIDByHash(bytes32 hashOfName) public view returns( bool success, bool found, uint256 id ) { /* Search by hash of name in the module array. The result is an index array. @@ -109,7 +109,7 @@ contract moduleHandler is multiOwner, announcementTypes { } return (true, false, 0); } - function getModuleIDByName(string name) public constant returns( bool success, bool found, uint256 id ) { + function getModuleIDByName(string name) public view returns( bool success, bool found, uint256 id ) { /* Search by name for module. The result is an index array. @@ -125,7 +125,7 @@ contract moduleHandler is multiOwner, announcementTypes { } return (true, false, 0); } - function getModuleIDByAddress(address addr) public constant returns( bool success, bool found, uint256 id ) { + function getModuleIDByAddress(address addr) public view returns( bool success, bool found, uint256 id ) { /* Search by ethereum address for module. The result is an index array. @@ -298,7 +298,7 @@ contract moduleHandler is multiOwner, announcementTypes { } return true; } - function balanceOf(address owner) public constant returns (bool success, uint256 value) { + function balanceOf(address owner) public view returns (bool success, uint256 value) { /* Query of token balance. @@ -310,7 +310,7 @@ contract moduleHandler is multiOwner, announcementTypes { require( _success && _found ); return (true, token(modules[_id].addr).balanceOf(owner)); } - function totalSupply() public constant returns (bool success, uint256 value) { + function totalSupply() public view returns (bool success, uint256 value) { /* Query of the whole token amount. @@ -321,7 +321,7 @@ contract moduleHandler is multiOwner, announcementTypes { require( _success && _found ); return (true, token(modules[_id].addr).totalSupply()); } - function isICO() public constant returns (bool success, bool ico) { + function isICO() public view returns (bool success, bool ico) { /* Query of ICO state @@ -332,7 +332,7 @@ contract moduleHandler is multiOwner, announcementTypes { require( _success && _found ); return (true, token(modules[_id].addr).isICO()); } - function getCurrentSchellingRoundID() public constant returns (bool success, uint256 round) { + function getCurrentSchellingRoundID() public view returns (bool success, uint256 round) { /* Query of number of the actual Schelling round. diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol index 2b8a46b9..78f7109c 100644 --- a/test/compilationTests/corion/multiOwner.sol +++ b/test/compilationTests/corion/multiOwner.sol @@ -38,13 +38,13 @@ contract multiOwner is safeMath { /* Constants */ - function ownersForChange() public constant returns (uint256 owners) { + function ownersForChange() public view returns (uint256 owners) { return ownerCount * 75 / 100; } - function calcDoHash(string job, bytes32 data) public constant returns (bytes32 hash) { + function calcDoHash(string job, bytes32 data) public pure returns (bytes32 hash) { return keccak256(abi.encodePacked(job, data)); } - function validDoHash(bytes32 doHash) public constant returns (bool valid) { + function validDoHash(bytes32 doHash) public view returns (bool valid) { return doDB[doHash].length > 0; } /* diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol index 5a80ecc6..695dd344 100644 --- a/test/compilationTests/corion/premium.sol +++ b/test/compilationTests/corion/premium.sol @@ -140,7 +140,7 @@ contract premium is module, safeMath { emit Approval(msg.sender, spender, amount); } - function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) { + function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used @@ -319,7 +319,7 @@ contract premium is module, safeMath { return _codeLength > 0; } - function balanceOf(address owner) constant returns (uint256 value) { + function balanceOf(address owner) view returns (uint256 value) { /* Token balance query @@ -329,7 +329,7 @@ contract premium is module, safeMath { return db.balanceOf(owner); } - function totalSupply() constant returns (uint256 value) { + function totalSupply() view returns (uint256 value) { /* Total token quantity query diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 0c1f69e5..16546809 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -147,7 +147,7 @@ contract provider is module, safeMath, announcementTypes { else { return false; } return true; } - function getUserDetails(address addr, uint256 schellingRound) public constant returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) { + function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) { /* Collecting the datas of the client. @@ -168,7 +168,7 @@ contract provider is module, safeMath, announcementTypes { value = clients[addr].supply[schellingRound]; } } - function rightForInterest(uint256 value, bool priv) internal returns (bool) { + function rightForInterest(uint256 value, bool priv) internal view returns (bool) { /* the share from the token emission. In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission. @@ -299,7 +299,7 @@ contract provider is module, safeMath, announcementTypes { providers[addr].data[currHeight].currentRate = rate; emit EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin); } - function getProviderInfo(address addr, uint256 height) public constant returns (string name, string website, string country, string info, uint256 create) { + function getProviderInfo(address addr, uint256 height) public view returns (string name, string website, string country, string info, uint256 create) { /* for the infos of the provider. In case the height is unknown then the system will use the last known height. @@ -321,7 +321,7 @@ contract provider is module, safeMath, announcementTypes { info = providers[addr].data[height].info; create = providers[addr].data[height].create; } - function getProviderDetails(address addr, uint256 height) public constant returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) { + function getProviderDetails(address addr, uint256 height) public view returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) { /* Asking for the datas of the provider. In case the height is unknown then the system will use the last known height. @@ -345,7 +345,7 @@ contract provider is module, safeMath, announcementTypes { getInterest = rightForInterest(getProviderCurrentSupply(addr), providers[addr].data[height].priv ); valid = providers[addr].data[height].valid; } - function getProviderCurrentSupply(address addr) internal returns (uint256) { + function getProviderCurrentSupply(address addr) internal view returns (uint256) { /* Inner function for polling the current height and the current quantity of the connected capital of the schelling round. @@ -469,7 +469,7 @@ contract provider is module, safeMath, announcementTypes { delete clients[msg.sender].providerConnected; emit EClientLost(msg.sender, provider, currHeight, bal); } - function checkReward(address addr) public constant returns (uint256 reward) { + function checkReward(address addr) public returns (uint256 reward) { /* Polling the share from the token emission for clients and for providers. diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol index 0e8f825f..f7d8fdea 100644 --- a/test/compilationTests/corion/publisher.sol +++ b/test/compilationTests/corion/publisher.sol @@ -70,7 +70,7 @@ contract publisher is announcementTypes, module, safeMath { super.registerModuleHandler(moduleHandler);
}
- function Announcements(uint256 id) public constant returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string Announcement, string Link, bool Opposited, string _str, uint256 _uint, address _addr) {
+ function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string Announcement, string Link, bool Opposited, string _str, uint256 _uint, address _addr) {
/*
Announcement data query
@@ -101,7 +101,7 @@ contract publisher is announcementTypes, module, safeMath { _addr = announcements[id]._addr;
}
- function checkOpposited(uint256 weight, bool oppositable) public constant returns (bool success) {
+ function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) {
/*
Veto check
diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol index f8c36fc5..74f8af9d 100644 --- a/test/compilationTests/corion/schelling.sol +++ b/test/compilationTests/corion/schelling.sol @@ -54,7 +54,7 @@ contract schellingDB is safeMath, schellingVars { Funds */ mapping(address => uint256) private funds; - function getFunds(address _owner) constant returns(bool, uint256) { + function getFunds(address _owner) view returns(bool, uint256) { return (true, funds[_owner]); } function setFunds(address _owner, uint256 _amount) isOwner external returns(bool) { @@ -65,7 +65,7 @@ contract schellingDB is safeMath, schellingVars { Rounds */ _rounds[] private rounds; - function getRound(uint256 _id) constant returns(bool, uint256, uint256, uint256, uint256, bool) { + function getRound(uint256 _id) view returns(bool, uint256, uint256, uint256, uint256, bool) { if ( rounds.length <= _id ) { return (false, 0, 0, 0, 0, false); } else { return (true, rounds[_id].totalAboveWeight, rounds[_id].totalBelowWeight, rounds[_id].reward, rounds[_id].blockHeight, rounds[_id].voted); } } @@ -76,14 +76,14 @@ contract schellingDB is safeMath, schellingVars { rounds[_id] = _rounds(_totalAboveWeight, _totalBelowWeight, _reward, _blockHeight, _voted); return true; } - function getCurrentRound() constant returns(bool, uint256) { + function getCurrentRound() view returns(bool, uint256) { return (true, rounds.length-1); } /* Voter */ mapping(address => _voter) private voter; - function getVoter(address _owner) constant returns(bool success, uint256 roundID, + function getVoter(address _owner) view returns(bool success, uint256 roundID, bytes32 hash, voterStatus status, bool voteResult, uint256 rewards) { roundID = voter[_owner].roundID; hash = voter[_owner].hash; @@ -106,7 +106,7 @@ contract schellingDB is safeMath, schellingVars { Schelling Token emission */ mapping(uint256 => uint256) private schellingExpansion; - function getSchellingExpansion(uint256 _id) constant returns(bool, uint256) { + function getSchellingExpansion(uint256 _id) view returns(bool, uint256) { return (true, schellingExpansion[_id]); } function setSchellingExpansion(uint256 _id, uint256 _expansion) isOwner external returns(bool) { @@ -121,7 +121,7 @@ contract schellingDB is safeMath, schellingVars { currentSchellingRound = _id; return true; } - function getCurrentSchellingRound() constant returns(bool, uint256) { + function getCurrentSchellingRound() view returns(bool, uint256) { return (true, currentSchellingRound); } } @@ -183,7 +183,7 @@ contract schelling is module, announcementTypes, schellingVars { voter.rewards ) ); } - function getVoter(address addr) internal returns (_voter) { + function getVoter(address addr) internal view returns (_voter) { (bool a, uint256 b, bytes32 c, schellingVars.voterStatus d, bool e, uint256 f) = db.getVoter(addr); require( a ); return _voter(b, c, d, e, f); @@ -221,7 +221,7 @@ contract schelling is module, announcementTypes, schellingVars { function setCurrentSchellingRound(uint256 id) internal { require( db.setCurrentSchellingRound(id) ); } - function getCurrentSchellingRound() internal returns(uint256) { + function getCurrentSchellingRound() internal view returns(uint256) { (bool a, uint256 b) = db.getCurrentSchellingRound(); require( a ); return b; @@ -229,7 +229,7 @@ contract schelling is module, announcementTypes, schellingVars { function setSchellingExpansion(uint256 id, uint256 amount) internal { require( db.setSchellingExpansion(id, amount) ); } - function getSchellingExpansion(uint256 id) internal returns(uint256) { + function getSchellingExpansion(uint256 id) internal view returns(uint256) { (bool a, uint256 b) = db.getSchellingExpansion(id); require( a ); return b; @@ -417,7 +417,7 @@ contract schelling is module, announcementTypes, schellingVars { setVoter(msg.sender, voter); } - function checkReward() public constant returns (uint256 reward) { + function checkReward() public view returns (uint256 reward) { /* Withdraw of the amount of the prize (it’s only information). @@ -496,7 +496,7 @@ contract schelling is module, announcementTypes, schellingVars { require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) ); } - function getCurrentSchellingRoundID() public constant returns (uint256) { + function getCurrentSchellingRoundID() public view returns (uint256) { /* Number of actual Schelling round. @@ -504,7 +504,7 @@ contract schelling is module, announcementTypes, schellingVars { */ return getCurrentSchellingRound(); } - function getSchellingRound(uint256 id) public constant returns (uint256 expansion) { + function getSchellingRound(uint256 id) public view returns (uint256 expansion) { /* Amount of token emission of the Schelling round. diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index 0709baca..fecbce3d 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -155,7 +155,7 @@ contract token is safeMath, module, announcementTypes { emit Approval(msg.sender, spender, amount); } - function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) { + function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used @@ -386,7 +386,7 @@ contract token is safeMath, module, announcementTypes { } } - function getTransactionFee(uint256 value) public constant returns (bool success, uint256 fee) { + function getTransactionFee(uint256 value) public view returns (bool success, uint256 fee) { /* Transaction fee query. @@ -472,7 +472,7 @@ contract token is safeMath, module, announcementTypes { return _codeLength > 0; } - function balanceOf(address owner) constant returns (uint256 value) { + function balanceOf(address owner) view returns (uint256 value) { /* Token balance query @@ -483,7 +483,7 @@ contract token is safeMath, module, announcementTypes { return db.balanceOf(owner); } - function totalSupply() constant returns (uint256 value) { + function totalSupply() view returns (uint256 value) { /* Total token quantity query diff --git a/test/compilationTests/corion/tokenDB.sol b/test/compilationTests/corion/tokenDB.sol index 6de1b6c3..40304a54 100644 --- a/test/compilationTests/corion/tokenDB.sol +++ b/test/compilationTests/corion/tokenDB.sol @@ -61,7 +61,7 @@ contract tokenDB is safeMath, ownedDB { return true;
}
- function getAllowance(address owner, address spender) constant returns(bool success, uint256 remaining, uint256 nonce) {
+ function getAllowance(address owner, address spender) view returns(bool success, uint256 remaining, uint256 nonce) {
/*
Get allowance from the database.
diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol index 0f5196e8..4815e315 100644 --- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol +++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol @@ -45,7 +45,7 @@ contract CategoricalEvent is Event { /// @return Event hash function getEventHash() public - constant + view returns (bytes32) { return keccak256(abi.encodePacked(collateralToken, oracle, outcomeTokens.length)); diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol index a6edb778..177f61df 100644 --- a/test/compilationTests/gnosis/Events/Event.sol +++ b/test/compilationTests/gnosis/Events/Event.sol @@ -90,7 +90,7 @@ contract Event { /// @return Outcome count function getOutcomeCount() public - constant + view returns (uint8) { return uint8(outcomeTokens.length); @@ -100,7 +100,7 @@ contract Event { /// @return Outcome tokens function getOutcomeTokens() public - constant + view returns (OutcomeToken[]) { return outcomeTokens; @@ -110,7 +110,7 @@ contract Event { /// @return Outcome token distribution function getOutcomeTokenDistribution(address owner) public - constant + view returns (uint[] outcomeTokenDistribution) { outcomeTokenDistribution = new uint[](outcomeTokens.length); @@ -120,7 +120,7 @@ contract Event { /// @dev Calculates and returns event hash /// @return Event hash - function getEventHash() public constant returns (bytes32); + function getEventHash() public view returns (bytes32); /// @dev Exchanges sender's winning outcome tokens for collateral tokens /// @return Sender's winnings diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol index d5cbef14..832c2ab1 100644 --- a/test/compilationTests/gnosis/Events/ScalarEvent.sol +++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol @@ -79,7 +79,7 @@ contract ScalarEvent is Event { /// @return Event hash function getEventHash() public - constant + view returns (bytes32) { return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound)); diff --git a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol index 344dd8d2..cf4fcd7d 100644 --- a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol +++ b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol @@ -24,7 +24,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Cost function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public - constant + view returns (uint cost) { require(market.eventContract().getOutcomeCount() > 1); @@ -59,7 +59,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Profit function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public - constant + view returns (uint profit) { require(market.eventContract().getOutcomeCount() > 1); @@ -85,7 +85,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Marginal price of an outcome as a fixed point number function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public - constant + view returns (uint price) { require(market.eventContract().getOutcomeCount() > 1); @@ -110,7 +110,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Cost level function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) private - constant + view returns(int costLevel) { // The cost function is C = b * log(sum(exp(q/b) for q in quantities)). @@ -131,7 +131,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex) private - constant + view returns (uint sum, int offset, uint outcomeExpTerm) { // Naive calculation of this causes an overflow @@ -170,7 +170,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Net outcome tokens sold by market function getNetOutcomeTokensSold(Market market) private - constant + view returns (int[] quantities) { quantities = new int[](market.eventContract().getOutcomeCount()); diff --git a/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol index 3162ce64..ef5942cd 100644 --- a/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol +++ b/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol @@ -8,7 +8,7 @@ contract MarketMaker { /* * Public functions */ - function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); - function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); - function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public constant returns (uint); + function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public view returns (uint); + function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public view returns (uint); + function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public view returns (uint); } diff --git a/test/compilationTests/gnosis/Markets/Market.sol b/test/compilationTests/gnosis/Markets/Market.sol index 635b14db..7bcecfe5 100644 --- a/test/compilationTests/gnosis/Markets/Market.sol +++ b/test/compilationTests/gnosis/Markets/Market.sol @@ -43,5 +43,5 @@ contract Market { function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) public returns (uint); function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint); function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint); - function calcMarketFee(uint outcomeTokenCost) public constant returns (uint); + function calcMarketFee(uint outcomeTokenCost) public view returns (uint); } diff --git a/test/compilationTests/gnosis/Markets/StandardMarket.sol b/test/compilationTests/gnosis/Markets/StandardMarket.sol index 84f30386..0a9f77db 100644 --- a/test/compilationTests/gnosis/Markets/StandardMarket.sol +++ b/test/compilationTests/gnosis/Markets/StandardMarket.sol @@ -186,7 +186,7 @@ contract StandardMarket is Market { /// @return Fee for trade function calcMarketFee(uint outcomeTokenCost) public - constant + view returns (uint) { return outcomeTokenCost * fee / FEE_RANGE; diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol index 362c514c..de182a61 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol @@ -72,7 +72,7 @@ contract CentralizedOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -82,7 +82,7 @@ contract CentralizedOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return outcome; diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol index 94fc70ca..3d801da1 100644 --- a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol @@ -44,7 +44,7 @@ contract DifficultyOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { // Difficulty is always bigger than 0 @@ -55,7 +55,7 @@ contract DifficultyOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return int(difficulty); diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol index 7105f247..cf851f5b 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol @@ -151,7 +151,7 @@ contract FutarchyOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -161,7 +161,7 @@ contract FutarchyOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return int(winningMarketIndex); diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol index 24cf9dea..d8097370 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol @@ -32,6 +32,7 @@ contract MajorityOracle is Oracle { /// @return Outcome function getStatusAndOutcome() public + view returns (bool outcomeSet, int outcome) { uint i; @@ -69,7 +70,7 @@ contract MajorityOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { (bool outcomeSet, ) = getStatusAndOutcome(); @@ -80,7 +81,7 @@ contract MajorityOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { (, int winningOutcome) = getStatusAndOutcome(); diff --git a/test/compilationTests/gnosis/Oracles/Oracle.sol b/test/compilationTests/gnosis/Oracles/Oracle.sol index cf96eb9f..450aff00 100644 --- a/test/compilationTests/gnosis/Oracles/Oracle.sol +++ b/test/compilationTests/gnosis/Oracles/Oracle.sol @@ -4,6 +4,6 @@ pragma solidity ^0.4.11; /// @title Abstract oracle contract - Functions to be implemented by oracles contract Oracle { - function isOutcomeSet() public constant returns (bool); - function getOutcome() public constant returns (int); + function isOutcomeSet() public view returns (bool); + function getOutcome() public view returns (int); } diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol index 121824ff..284f420e 100644 --- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol +++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol @@ -84,7 +84,7 @@ contract SignedMessageOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -94,7 +94,7 @@ contract SignedMessageOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return outcome; diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol index dd66c9ab..b7cc231c 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol @@ -144,6 +144,7 @@ contract UltimateOracle is Oracle { /// @return Is challenge period over? function isChallengePeriodOver() public + view returns (bool) { return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod; @@ -153,6 +154,7 @@ contract UltimateOracle is Oracle { /// @return Is front runner period over? function isFrontRunnerPeriodOver() public + view returns (bool) { return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod; @@ -162,6 +164,7 @@ contract UltimateOracle is Oracle { /// @return Is challenged? function isChallenged() public + view returns (bool) { return frontRunnerSetTimestamp != 0; @@ -171,7 +174,7 @@ contract UltimateOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isChallengePeriodOver() && !isChallenged() @@ -182,7 +185,7 @@ contract UltimateOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { if (isFrontRunnerPeriodOver()) diff --git a/test/compilationTests/gnosis/Tokens/StandardToken.sol b/test/compilationTests/gnosis/Tokens/StandardToken.sol index b7d0d37a..5fb20210 100644 --- a/test/compilationTests/gnosis/Tokens/StandardToken.sol +++ b/test/compilationTests/gnosis/Tokens/StandardToken.sol @@ -73,7 +73,7 @@ contract StandardToken is Token { /// @return Remaining allowance for spender function allowance(address owner, address spender) public - constant + view returns (uint) { return allowances[owner][spender]; @@ -84,7 +84,7 @@ contract StandardToken is Token { /// @return Balance of owner function balanceOf(address owner) public - constant + view returns (uint) { return balances[owner]; @@ -94,7 +94,7 @@ contract StandardToken is Token { /// @return Total supply function totalSupply() public - constant + view returns (uint) { return totalTokens; diff --git a/test/compilationTests/gnosis/Tokens/Token.sol b/test/compilationTests/gnosis/Tokens/Token.sol index 19bb618b..70ecdff7 100644 --- a/test/compilationTests/gnosis/Tokens/Token.sol +++ b/test/compilationTests/gnosis/Tokens/Token.sol @@ -17,7 +17,7 @@ contract Token { function transfer(address to, uint value) public returns (bool); function transferFrom(address from, address to, uint value) public returns (bool); function approve(address spender, uint value) public returns (bool); - function balanceOf(address owner) public constant returns (uint); - function allowance(address owner, address spender) public constant returns (uint); - function totalSupply() public constant returns (uint); + function balanceOf(address owner) public view returns (uint); + function allowance(address owner, address spender) public view returns (uint); + function totalSupply() public view returns (uint); } diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 95d95346..93456c33 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -22,7 +22,7 @@ library Math { /// @return e**x function exp(int x) public - constant + pure returns (uint) { // revert if x is > MAX_POWER, where @@ -107,7 +107,7 @@ library Math { /// @return ln(x) function ln(uint x) public - constant + pure returns (int) { require(x > 0); @@ -157,7 +157,7 @@ library Math { /// @return logarithmic value function floorLog2(uint x) public - constant + pure returns (int lo) { lo = -64; @@ -178,7 +178,7 @@ library Math { /// @return Maximum number function max(int[] nums) public - constant + pure returns (int max) { require(nums.length > 0); @@ -194,7 +194,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(uint a, uint b) public - constant + pure returns (bool) { return a + b >= a; @@ -206,7 +206,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(uint a, uint b) public - constant + pure returns (bool) { return a >= b; @@ -218,7 +218,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(uint a, uint b) public - constant + pure returns (bool) { return b == 0 || a * b / b == a; @@ -230,7 +230,7 @@ library Math { /// @return Sum function add(uint a, uint b) public - constant + pure returns (uint) { require(safeToAdd(a, b)); @@ -243,7 +243,7 @@ library Math { /// @return Difference function sub(uint a, uint b) public - constant + pure returns (uint) { require(safeToSub(a, b)); @@ -256,7 +256,7 @@ library Math { /// @return Product function mul(uint a, uint b) public - constant + pure returns (uint) { require(safeToMul(a, b)); @@ -269,7 +269,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a + b >= a) || (b < 0 && a + b < a); @@ -281,7 +281,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a - b <= a) || (b < 0 && a - b > a); @@ -293,7 +293,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(int a, int b) public - constant + pure returns (bool) { return (b == 0) || (a * b / b == a); @@ -305,7 +305,7 @@ library Math { /// @return Sum function add(int a, int b) public - constant + pure returns (int) { require(safeToAdd(a, b)); @@ -318,7 +318,7 @@ library Math { /// @return Difference function sub(int a, int b) public - constant + pure returns (int) { require(safeToSub(a, b)); @@ -331,7 +331,7 @@ library Math { /// @return Product function mul(int a, int b) public - constant + pure returns (int) { require(safeToMul(a, b)); diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index 56422169..378f7b73 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -124,7 +124,7 @@ contract MilestoneTracker { ///////// /// @return The number of milestones ever created even if they were canceled - function numberOfMilestones() constant returns (uint) { + function numberOfMilestones() view returns (uint) { return milestones.length; } diff --git a/test/compilationTests/milestonetracker/RLP.sol b/test/compilationTests/milestonetracker/RLP.sol index e71d567e..e96bb332 100644 --- a/test/compilationTests/milestonetracker/RLP.sol +++ b/test/compilationTests/milestonetracker/RLP.sol @@ -30,7 +30,7 @@ library RLP { /* Iterator */ - function next(Iterator memory self) internal constant returns (RLPItem memory subItem) { + function next(Iterator memory self) internal view returns (RLPItem memory subItem) { if(hasNext(self)) { uint ptr = self._unsafe_nextPtr; uint itemLength = _itemLength(ptr); @@ -42,14 +42,14 @@ library RLP { throw; } - function next(Iterator memory self, bool strict) internal constant returns (RLPItem memory subItem) { + function next(Iterator memory self, bool strict) internal view returns (RLPItem memory subItem) { subItem = next(self); if(strict && !_validate(subItem)) throw; return; } - function hasNext(Iterator memory self) internal constant returns (bool) { + function hasNext(Iterator memory self) internal view returns (bool) { RLPItem memory item = self._unsafe_item; return self._unsafe_nextPtr < item._unsafe_memPtr + item._unsafe_length; } @@ -59,7 +59,7 @@ library RLP { /// @dev Creates an RLPItem from an array of RLP encoded bytes. /// @param self The RLP encoded bytes. /// @return An RLPItem - function toRLPItem(bytes memory self) internal constant returns (RLPItem memory) { + function toRLPItem(bytes memory self) internal view returns (RLPItem memory) { uint len = self.length; if (len == 0) { return RLPItem(0, 0); @@ -75,7 +75,7 @@ library RLP { /// @param self The RLP encoded bytes. /// @param strict Will throw if the data is not RLP encoded. /// @return An RLPItem - function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) { + function toRLPItem(bytes memory self, bool strict) internal view returns (RLPItem memory) { RLPItem memory item = toRLPItem(self); if(strict) { uint len = self.length; @@ -92,14 +92,14 @@ library RLP { /// @dev Check if the RLP item is null. /// @param self The RLP item. /// @return 'true' if the item is null. - function isNull(RLPItem memory self) internal constant returns (bool ret) { + function isNull(RLPItem memory self) internal view returns (bool ret) { return self._unsafe_length == 0; } /// @dev Check if the RLP item is a list. /// @param self The RLP item. /// @return 'true' if the item is a list. - function isList(RLPItem memory self) internal constant returns (bool ret) { + function isList(RLPItem memory self) internal view returns (bool ret) { if (self._unsafe_length == 0) return false; uint memPtr = self._unsafe_memPtr; @@ -111,7 +111,7 @@ library RLP { /// @dev Check if the RLP item is data. /// @param self The RLP item. /// @return 'true' if the item is data. - function isData(RLPItem memory self) internal constant returns (bool ret) { + function isData(RLPItem memory self) internal view returns (bool ret) { if (self._unsafe_length == 0) return false; uint memPtr = self._unsafe_memPtr; @@ -123,7 +123,7 @@ library RLP { /// @dev Check if the RLP item is empty (string or list). /// @param self The RLP item. /// @return 'true' if the item is null. - function isEmpty(RLPItem memory self) internal constant returns (bool ret) { + function isEmpty(RLPItem memory self) internal view returns (bool ret) { if(isNull(self)) return false; uint b0; @@ -137,7 +137,7 @@ library RLP { /// @dev Get the number of items in an RLP encoded list. /// @param self The RLP item. /// @return The number of items. - function items(RLPItem memory self) internal constant returns (uint) { + function items(RLPItem memory self) internal view returns (uint) { if (!isList(self)) return 0; uint b0; @@ -158,7 +158,7 @@ library RLP { /// @dev Create an iterator. /// @param self The RLP item. /// @return An 'Iterator' over the item. - function iterator(RLPItem memory self) internal constant returns (Iterator memory it) { + function iterator(RLPItem memory self) internal view returns (Iterator memory it) { if (!isList(self)) throw; uint ptr = self._unsafe_memPtr + _payloadOffset(self); @@ -169,7 +169,7 @@ library RLP { /// @dev Return the RLP encoded bytes. /// @param self The RLPItem. /// @return The bytes. - function toBytes(RLPItem memory self) internal constant returns (bytes memory bts) { + function toBytes(RLPItem memory self) internal returns (bytes memory bts) { uint len = self._unsafe_length; if (len == 0) return; @@ -181,7 +181,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toData(RLPItem memory self) internal constant returns (bytes memory bts) { + function toData(RLPItem memory self) internal returns (bytes memory bts) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -193,7 +193,7 @@ library RLP { /// Warning: This is inefficient, as it requires that the list is read twice. /// @param self The RLP item. /// @return Array of RLPItems. - function toList(RLPItem memory self) internal constant returns (RLPItem[] memory list) { + function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) { if(!isList(self)) throw; uint numItems = items(self); @@ -210,7 +210,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toAscii(RLPItem memory self) internal constant returns (string memory str) { + function toAscii(RLPItem memory self) internal returns (string memory str) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -223,7 +223,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toUint(RLPItem memory self) internal constant returns (uint data) { + function toUint(RLPItem memory self) internal view returns (uint data) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -238,7 +238,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toBool(RLPItem memory self) internal constant returns (bool data) { + function toBool(RLPItem memory self) internal view returns (bool data) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -257,7 +257,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toByte(RLPItem memory self) internal constant returns (byte data) { + function toByte(RLPItem memory self) internal view returns (byte data) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -274,7 +274,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toInt(RLPItem memory self) internal constant returns (int data) { + function toInt(RLPItem memory self) internal view returns (int data) { return int(toUint(self)); } @@ -282,7 +282,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toBytes32(RLPItem memory self) internal constant returns (bytes32 data) { + function toBytes32(RLPItem memory self) internal view returns (bytes32 data) { return bytes32(toUint(self)); } @@ -290,7 +290,7 @@ library RLP { /// RLPItem is a list. /// @param self The RLPItem. /// @return The decoded string. - function toAddress(RLPItem memory self) internal constant returns (address data) { + function toAddress(RLPItem memory self) internal view returns (address data) { if(!isData(self)) throw; (uint rStartPos, uint len) = _decode(self); @@ -302,7 +302,7 @@ library RLP { } // Get the payload offset. - function _payloadOffset(RLPItem memory self) private constant returns (uint) { + function _payloadOffset(RLPItem memory self) private view returns (uint) { if(self._unsafe_length == 0) return 0; uint b0; @@ -320,7 +320,7 @@ library RLP { } // Get the full length of an RLP item. - function _itemLength(uint memPtr) private constant returns (uint len) { + function _itemLength(uint memPtr) private view returns (uint len) { uint b0; assembly { b0 := byte(0, mload(memPtr)) @@ -348,7 +348,7 @@ library RLP { } // Get start position and length of the data. - function _decode(RLPItem memory self) private constant returns (uint memPtr, uint len) { + function _decode(RLPItem memory self) private view returns (uint memPtr, uint len) { if(!isData(self)) throw; uint b0; @@ -376,7 +376,7 @@ library RLP { } // Assumes that enough memory has been allocated to store in target. - function _copyToBytes(uint btsPtr, bytes memory tgt, uint btsLen) private constant { + function _copyToBytes(uint btsPtr, bytes memory tgt, uint btsLen) private { // Exploiting the fact that 'tgt' was the last thing to be allocated, // we can write entire words, and just overwrite any excess. assembly { @@ -400,7 +400,7 @@ library RLP { } // Check that an RLP item is valid. - function _validate(RLPItem memory self) private constant returns (bool ret) { + function _validate(RLPItem memory self) private view returns (bool ret) { // Check that RLP is well-formed. uint b0; uint b1; 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++) { |