diff --git a/contracts/Bounty.sol b/contracts/Bounty.sol index 1d00ca917da..ff12f487dc2 100644 --- a/contracts/Bounty.sol +++ b/contracts/Bounty.sol @@ -18,7 +18,7 @@ contract Bounty is PullPayment, Destructible { /** * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. */ - function() payable { + function() public payable { require(!claimed); } diff --git a/contracts/DayLimit.sol b/contracts/DayLimit.sol index 6efe8b6617d..fe01fc3e570 100644 --- a/contracts/DayLimit.sol +++ b/contracts/DayLimit.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; /** * @title DayLimit @@ -15,7 +15,7 @@ contract DayLimit { * @dev Constructor that sets the passed value as a dailyLimit. * @param _limit uint256 to represent the daily limit. */ - function DayLimit(uint256 _limit) { + function DayLimit(uint256 _limit) public { dailyLimit = _limit; lastDay = today(); } @@ -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 de32838a1fd..c926b5ef647 100644 --- a/contracts/ECRecovery.sol +++ b/contracts/ECRecovery.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; /** @@ -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/LimitBalance.sol b/contracts/LimitBalance.sol index 32ec46d1fcb..358568c17f4 100644 --- a/contracts/LimitBalance.sol +++ b/contracts/LimitBalance.sol @@ -15,7 +15,7 @@ contract LimitBalance { * @dev Constructor that sets the passed value as a limit. * @param _limit uint256 to represent the limit. */ - function LimitBalance(uint256 _limit) { + function LimitBalance(uint256 _limit) public { limit = _limit; } diff --git a/contracts/MerkleProof.sol b/contracts/MerkleProof.sol index 1703ee4eaea..86c6217057e 100644 --- a/contracts/MerkleProof.sol +++ b/contracts/MerkleProof.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; /* * @title MerkleProof @@ -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 public 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 a9c54ac905a..2ff124a19b7 100644 --- a/contracts/crowdsale/CappedCrowdsale.sol +++ b/contracts/crowdsale/CappedCrowdsale.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; import '../math/SafeMath.sol'; import './Crowdsale.sol'; @@ -12,21 +12,21 @@ contract CappedCrowdsale is Crowdsale { uint256 public cap; - function CappedCrowdsale(uint256 _cap) { + function CappedCrowdsale(uint256 _cap) public { require(_cap > 0); cap = _cap; } // 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 26ed8df8521..8ef64f4cc3d 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; import '../token/MintableToken.sol'; import '../math/SafeMath.sol'; @@ -40,7 +40,7 @@ contract Crowdsale { event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); - function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) { + function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) public { require(_startTime >= now); require(_endTime >= _startTime); require(_rate > 0); @@ -61,7 +61,7 @@ contract Crowdsale { // fallback function can be used to buy tokens - function () payable { + function () public payable { buyTokens(msg.sender); } @@ -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/RefundVault.sol b/contracts/crowdsale/RefundVault.sol index fb721d17a4a..c2448705a15 100644 --- a/contracts/crowdsale/RefundVault.sol +++ b/contracts/crowdsale/RefundVault.sol @@ -22,7 +22,7 @@ contract RefundVault is Ownable { event RefundsEnabled(); event Refunded(address indexed beneficiary, uint256 weiAmount); - function RefundVault(address _wallet) { + function RefundVault(address _wallet) public { require(_wallet != address(0)); wallet = _wallet; state = State.Active; diff --git a/contracts/crowdsale/RefundableCrowdsale.sol b/contracts/crowdsale/RefundableCrowdsale.sol index f04f643ebff..ef409fa3595 100644 --- a/contracts/crowdsale/RefundableCrowdsale.sol +++ b/contracts/crowdsale/RefundableCrowdsale.sol @@ -21,7 +21,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { // refund vault used to hold funds while crowdsale is running RefundVault public vault; - function RefundableCrowdsale(uint256 _goal) { + function RefundableCrowdsale(uint256 _goal) public { require(_goal > 0); vault = new RefundVault(wallet); goal = _goal; @@ -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/examples/SampleCrowdsale.sol b/contracts/examples/SampleCrowdsale.sol index 0adc487b60b..d44a4cea0b3 100644 --- a/contracts/examples/SampleCrowdsale.sol +++ b/contracts/examples/SampleCrowdsale.sol @@ -35,6 +35,7 @@ contract SampleCrowdsale is CappedCrowdsale, RefundableCrowdsale { FinalizableCrowdsale() RefundableCrowdsale(_goal) Crowdsale(_startTime, _endTime, _rate, _wallet) + public { //As goal needs to be met for a successful crowdsale //the value needs to less or equal than a cap which is limit for accepted funds diff --git a/contracts/examples/SimpleToken.sol b/contracts/examples/SimpleToken.sol index f0ad644db27..3a17655153f 100644 --- a/contracts/examples/SimpleToken.sol +++ b/contracts/examples/SimpleToken.sol @@ -21,7 +21,7 @@ contract SimpleToken is StandardToken { /** * @dev Constructor that gives msg.sender all of existing tokens. */ - function SimpleToken() { + function SimpleToken() public { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } diff --git a/contracts/lifecycle/Destructible.sol b/contracts/lifecycle/Destructible.sol index 9c24474b790..67ffd1ae64f 100644 --- a/contracts/lifecycle/Destructible.sol +++ b/contracts/lifecycle/Destructible.sol @@ -10,7 +10,7 @@ import "../ownership/Ownable.sol"; */ contract Destructible is Ownable { - function Destructible() payable { } + function Destructible() payable public { } /** * @dev Transfers the current balance to the owner and terminates the contract. diff --git a/contracts/lifecycle/TokenDestructible.sol b/contracts/lifecycle/TokenDestructible.sol index e29d69b63a2..78d5e423a99 100644 --- a/contracts/lifecycle/TokenDestructible.sol +++ b/contracts/lifecycle/TokenDestructible.sol @@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol"; */ contract TokenDestructible is Ownable { - function TokenDestructible() payable { } + function TokenDestructible() public payable { } /** * @notice Terminate contract and refund to owner diff --git a/contracts/math/Math.sol b/contracts/math/Math.sol index 3d016c0acd5..0cd648b03a4 100644 --- a/contracts/math/Math.sol +++ b/contracts/math/Math.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; /** * @title Math @@ -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/contracts/math/SafeMath.sol b/contracts/math/SafeMath.sol index 05ad6ee171e..df2323e5578 100644 --- a/contracts/math/SafeMath.sol +++ b/contracts/math/SafeMath.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; /** @@ -6,7 +6,7 @@ pragma solidity ^0.4.11; * @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/ownership/HasNoEther.sol b/contracts/ownership/HasNoEther.sol index 63b4ef65c73..1661d12ee54 100644 --- a/contracts/ownership/HasNoEther.sol +++ b/contracts/ownership/HasNoEther.sol @@ -21,7 +21,7 @@ contract HasNoEther is Ownable { * constructor. By doing it this way we prevent a payable constructor from working. Alternatively * we could use assembly to access msg.value. */ - function HasNoEther() payable { + function HasNoEther() public payable { require(msg.value == 0); } diff --git a/contracts/ownership/Ownable.sol b/contracts/ownership/Ownable.sol index 307ecee46fb..ae2881dc3bd 100644 --- a/contracts/ownership/Ownable.sol +++ b/contracts/ownership/Ownable.sol @@ -17,7 +17,7 @@ contract Ownable { * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ - function Ownable() { + function Ownable() public { owner = msg.sender; } diff --git a/contracts/payment/SplitPayment.sol b/contracts/payment/SplitPayment.sol index c32ecba39f4..1acff8b515e 100644 --- a/contracts/payment/SplitPayment.sol +++ b/contracts/payment/SplitPayment.sol @@ -20,7 +20,7 @@ contract SplitPayment { /** * @dev Constructor */ - function SplitPayment(address[] _payees, uint256[] _shares) { + function SplitPayment(address[] _payees, uint256[] _shares) public { require(_payees.length == _shares.length); for (uint256 i = 0; i < _payees.length; i++) { diff --git a/contracts/token/BasicToken.sol b/contracts/token/BasicToken.sol index a45157f81f8..d0bd88a3bba 100644 --- a/contracts/token/BasicToken.sol +++ b/contracts/token/BasicToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; import './ERC20Basic.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/DetailedERC20.sol b/contracts/token/DetailedERC20.sol index c61cde2e975..db218014706 100644 --- a/contracts/token/DetailedERC20.sol +++ b/contracts/token/DetailedERC20.sol @@ -7,7 +7,7 @@ contract DetailedERC20 is ERC20 { string public symbol; uint8 public decimals; - function DetailedERC20(string _name, string _symbol, uint8 _decimals) { + function DetailedERC20(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index 7ab917c9571..1c230df8ed9 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; import './BasicToken.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 remaining) { + function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender]; } diff --git a/contracts/token/TokenTimelock.sol b/contracts/token/TokenTimelock.sol index f4255fbbf0b..3139d04fcad 100644 --- a/contracts/token/TokenTimelock.sol +++ b/contracts/token/TokenTimelock.sol @@ -21,7 +21,7 @@ contract TokenTimelock { // timestamp when token release is enabled uint64 public releaseTime; - function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) { + function TokenTimelock(ERC20Basic _token, address _beneficiary, uint64 _releaseTime) public { require(_releaseTime > now); token = _token; beneficiary = _beneficiary; diff --git a/contracts/token/TokenVesting.sol b/contracts/token/TokenVesting.sol index 7fb33b89678..0f6afd344a7 100644 --- a/contracts/token/TokenVesting.sol +++ b/contracts/token/TokenVesting.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.11; +pragma solidity ^0.4.17; import './ERC20Basic.sol'; import './SafeERC20.sol'; @@ -39,7 +39,7 @@ contract TokenVesting is Ownable { * @param _duration duration in seconds of the period in which the tokens will vest * @param _revocable whether the vesting is revocable or not */ - function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) { + function TokenVesting(address _beneficiary, uint256 _start, uint256 _cliff, uint256 _duration, bool _revocable) public { require(_beneficiary != address(0)); require(_cliff <= _duration); @@ -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]);