diff options
Diffstat (limited to 'test/compilationTests')
59 files changed, 372 insertions, 372 deletions
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol index 6b10f17e..35f6208b 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol @@ -33,49 +33,49 @@ contract MultiSigWallet { modifier onlyWallet() { if (msg.sender != address(this)) - throw; + revert(); _; } modifier ownerDoesNotExist(address owner) { if (isOwner[owner]) - throw; + revert(); _; } modifier ownerExists(address owner) { if (!isOwner[owner]) - throw; + revert(); _; } modifier transactionExists(uint transactionId) { if (transactions[transactionId].destination == address(0)) - throw; + revert(); _; } modifier confirmed(uint transactionId, address owner) { if (!confirmations[transactionId][owner]) - throw; + revert(); _; } modifier notConfirmed(uint transactionId, address owner) { if (confirmations[transactionId][owner]) - throw; + revert(); _; } modifier notExecuted(uint transactionId) { if (transactions[transactionId].executed) - throw; + revert(); _; } modifier notNull(address _address) { if (_address == address(0)) - throw; + revert(); _; } @@ -84,7 +84,7 @@ contract MultiSigWallet { || _required > ownerCount || _required == 0 || ownerCount == 0) - throw; + revert(); _; } @@ -103,13 +103,13 @@ contract MultiSigWallet { /// @dev Contract constructor sets initial owners and required number of confirmations. /// @param _owners List of initial owners. /// @param _required Number of required confirmations. - constructor(address[] _owners, uint _required) + constructor(address[] memory _owners, uint _required) public validRequirement(_owners.length, _required) { for (uint i=0; i<_owners.length; i++) { if (isOwner[_owners[i]] || _owners[i] == address(0)) - throw; + revert(); isOwner[_owners[i]] = true; } owners = _owners; @@ -185,7 +185,7 @@ contract MultiSigWallet { /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. - function submitTransaction(address destination, uint value, bytes data) + function submitTransaction(address destination, uint value, bytes memory data) public returns (uint transactionId) { @@ -225,7 +225,7 @@ contract MultiSigWallet { notExecuted(transactionId) { if (isConfirmed(transactionId)) { - Transaction tx = transactions[transactionId]; + Transaction storage tx = transactions[transactionId]; tx.executed = true; if (tx.destination.call.value(tx.value)(tx.data)) emit Execution(transactionId); @@ -261,7 +261,7 @@ contract MultiSigWallet { /// @param value Transaction ether value. /// @param data Transaction data payload. /// @return Returns transaction ID. - function addTransaction(address destination, uint value, bytes data) + function addTransaction(address destination, uint value, bytes memory data) internal notNull(destination) returns (uint transactionId) @@ -313,7 +313,7 @@ contract MultiSigWallet { function getOwners() public view - returns (address[]) + returns (address[] memory) { return owners; } @@ -324,7 +324,7 @@ contract MultiSigWallet { function getConfirmations(uint transactionId) public view - returns (address[] _confirmations) + returns (address[] memory _confirmations) { address[] memory confirmationsTemp = new address[](owners.length); uint count = 0; @@ -348,7 +348,7 @@ contract MultiSigWallet { function getTransactionIds(uint from, uint to, bool pending, bool executed) public view - returns (uint[] _transactionIds) + returns (uint[] memory _transactionIds) { uint[] memory transactionIdsTemp = new uint[](transactionCount); uint count = 0; diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol index cb58ab1c..16219aa2 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol @@ -11,7 +11,7 @@ contract MultiSigWalletFactory is Factory { /// @param _owners List of initial owners. /// @param _required Number of required confirmations. /// @return Returns wallet address. - function create(address[] _owners, uint _required) + function create(address[] memory _owners, uint _required) public returns (address wallet) { diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol index 3a68f662..69e94fd5 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol @@ -19,7 +19,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { /// @param _owners List of initial owners. /// @param _required Number of required confirmations. /// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. - constructor(address[] _owners, uint _required, uint _dailyLimit) + constructor(address[] memory _owners, uint _required, uint _dailyLimit) public MultiSigWallet(_owners, _required) { @@ -42,7 +42,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet { public notExecuted(transactionId) { - Transaction tx = transactions[transactionId]; + Transaction storage tx = transactions[transactionId]; bool confirmed = isConfirmed(transactionId); if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) { tx.executed = true; diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol index 8a2efa32..e4cfc031 100644 --- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol +++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol @@ -12,7 +12,7 @@ contract MultiSigWalletWithDailyLimitFactory is Factory { /// @param _required Number of required confirmations. /// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis. /// @return Returns wallet address. - function create(address[] _owners, uint _required, uint _dailyLimit) + function create(address[] memory _owners, uint _required, uint _dailyLimit) public returns (address wallet) { diff --git a/test/compilationTests/MultiSigWallet/TestToken.sol b/test/compilationTests/MultiSigWallet/TestToken.sol index df195c58..a100b449 100644 --- a/test/compilationTests/MultiSigWallet/TestToken.sol +++ b/test/compilationTests/MultiSigWallet/TestToken.sol @@ -27,7 +27,7 @@ contract TestToken { returns (bool success) { if (balances[msg.sender] < _value) { - throw; + revert(); } balances[msg.sender] -= _value; balances[_to] += _value; @@ -40,7 +40,7 @@ contract TestToken { returns (bool success) { if (balances[_from] < _value || allowed[_from][msg.sender] < _value) { - throw; + revert(); } balances[_to] += _value; balances[_from] -= _value; diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index b6d8e035..2f60e0fe 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -49,8 +49,8 @@ contract ico is safeMath { mapping (address => mapping(uint256 => interest_s)) public interestDB; uint256 public totalMint; uint256 public totalPremiumMint; - - constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] genesisAddr, uint256[] genesisValue) { + + constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public { /* Installation function. @@ -231,7 +231,7 @@ contract ico is safeMath { require( ! aborted ); require( token(tokenAddr).mint(foundationAddress, token(tokenAddr).totalSupply() * 96 / 100) ); require( premium(premiumAddr).mint(foundationAddress, totalMint / 5000 - totalPremiumMint) ); - require( foundationAddress.send(this.balance) ); + require( foundationAddress.send(address(this).balance) ); require( token(tokenAddr).closeIco() ); require( premium(premiumAddr).closeIco() ); } @@ -277,22 +277,22 @@ contract ico is safeMath { function () external payable { /* - Callback function. Simply calls the buy function as a beneficiary and there is no affilate address. + Callback function. Simply calls the buy function as a beneficiary and there is no affiliate address. If they call the contract without any function then this process will be taken place. */ require( isICO() ); require( buy(msg.sender, address(0x00)) ); } - - function buy(address beneficiaryAddress, address affilateAddress) payable returns (bool success) { + + function buy(address beneficiaryAddress, address affilateAddress) public payable returns (bool success) { /* Buying a token If there is not at least 0.2 ether balance on the beneficiaryAddress then the amount of the ether which was intended for the purchase will be reduced by 0.2 and that will be sent to the address of the beneficiary. From the remaining amount calculate the reward with the help of the getIcoReward function. - Only that affilate address is valid which has some token on it’s account. - If there is a valid affilate address then calculate and credit the reward as well in the following way: - With more than 1e12 token contract credit 5% reward based on the calculation that how many tokens did they buy when he was added as an affilate. + Only that affiliate address is valid which has some token on it’s account. + If there is a valid affiliate address then calculate and credit the reward as well in the following way: + With more than 1e12 token contract credit 5% reward based on the calculation that how many tokens did they buy when he was added as an affiliate. More than 1e11 token: 4% More than 1e10 token: 3% More than 1e9 token: 2% below 1% @@ -345,7 +345,7 @@ contract ico is safeMath { /* Crediting the premium token - @owner The corion token balance of this address will be set based on the calculation which shows that how many times can be the amount of the purchased tokens devided by 5000. So after each 5000 token we give 1 premium token. + @owner The corion token balance of this address will be set based on the calculation which shows that how many times can be the amount of the purchased tokens divided by 5000. So after each 5000 token we give 1 premium token. */ uint256 _reward = (brought[owner].cor / 5e9) - brought[owner].corp; if ( _reward > 0 ) { @@ -372,5 +372,5 @@ contract ico is safeMath { return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed ); } - event EICO(address indexed Address, uint256 indexed value, address Affilate, uint256 AffilateValue); + event EICO(address indexed Address, uint256 indexed value, address Affiliate, uint256 AffilateValue); } diff --git a/test/compilationTests/corion/module.sol b/test/compilationTests/corion/module.sol index 362283ef..e0084ea5 100644 --- a/test/compilationTests/corion/module.sol +++ b/test/compilationTests/corion/module.sol @@ -95,8 +95,8 @@ contract module { if ( _balance > 0 ) { require( abstractModuleHandler(moduleHandlerAddress).transfer(address(this), newModuleAddress, _balance, false) ); } - if ( this.balance > 0 ) { - require( newModuleAddress.send(this.balance) ); + if ( address(this).balance > 0 ) { + require( newModuleAddress.send(address(this).balance) ); } moduleStatus = status.Disconnected; } @@ -131,7 +131,7 @@ contract module { /* Check self for ready for functions or not. - @success Function call was successfull or not + @success Function call was successful or not @active Ready for functions or not */ return (true, moduleStatus == status.Connected && block.number >= disabledUntil); diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index b3d03c2a..ce53114b 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -34,10 +34,10 @@ contract moduleHandler is multiOwner, announcementTypes { modules_s[] public modules; address public foundationAddress; uint256 debugModeUntil = block.number + 1000000; - - - constructor(address[] newOwners) multiOwner(newOwners) {} - function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) { + + + constructor(address[] memory newOwners) multiOwner(newOwners) public {} + function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public { /* Loading modulest to ModuleHandler. @@ -60,10 +60,10 @@ contract moduleHandler is multiOwner, announcementTypes { addModule( modules_s(Schelling, keccak256('Schelling'), false, true), ! forReplace); addModule( modules_s(Provider, keccak256('Provider'), true, true), ! forReplace); } - function addModule(modules_s input, bool call) internal { + function addModule(modules_s memory input, bool call) internal { /* Inside function for registration of the modules in the database. - If the call is false, wont happen any direct call. + If the call is false, won't happen any direct call. @input _Structure of module. @call Is connect to the module or not. @@ -81,14 +81,14 @@ contract moduleHandler is multiOwner, announcementTypes { } modules[id] = input; } - function getModuleAddressByName(string name) public view returns( bool success, bool found, address addr ) { + function getModuleAddressByName(string memory name) public view returns( bool success, bool found, address addr ) { /* Search by name for module. The result is an Ethereum address. @name Name of module. @addr Address of module. @found Is there any result. - @success Was the transaction succesfull or not. + @success Was the transaction successful or not. */ (bool _success, bool _found, uint256 _id) = getModuleIDByName(name); if ( _success && _found ) { return (true, true, modules[_id].addr); } @@ -109,7 +109,7 @@ contract moduleHandler is multiOwner, announcementTypes { } return (true, false, 0); } - function getModuleIDByName(string name) public view returns( bool success, bool found, uint256 id ) { + function getModuleIDByName(string memory name) public view returns( bool success, bool found, uint256 id ) { /* Search by name for module. The result is an index array. @@ -177,7 +177,7 @@ contract moduleHandler is multiOwner, announcementTypes { require( abstractModule(modules[_id].addr).replaceModule(newModule) ); return true; } - + function newModule(string name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) { /* Adding new module to the database. Can be called only by the Publisher contract. @@ -204,7 +204,7 @@ contract moduleHandler is multiOwner, announcementTypes { Deleting module from the database. Can be called only by the Publisher contract. @name Name of module to delete. - @bool Was the function successfull? + @bool Was the function successful? @callCallback Call the replaceable module to confirm replacement or not. */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); @@ -245,7 +245,7 @@ contract moduleHandler is multiOwner, announcementTypes { @from from who. @to to who. @value amount. - @bool Was the function successfull? + @bool Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found && modules[_id].name == keccak256('Token') ); @@ -264,7 +264,7 @@ contract moduleHandler is multiOwner, announcementTypes { @roundID Number of Schelling round. @reward Coin emission in this Schelling round. - @bool Was the function successfull? + @bool Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found && modules[_id].name == keccak256('Schelling') ); @@ -283,7 +283,7 @@ contract moduleHandler is multiOwner, announcementTypes { Every module will be informed about the ModuleHandler replacement. @newHandler Address of the new ModuleHandler. - @bool Was the function successfull? + @bool Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success ); @@ -304,7 +304,7 @@ contract moduleHandler is multiOwner, announcementTypes { @owner address @value balance. - @success was the function successfull? + @success was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByName('Token'); require( _success && _found ); @@ -315,7 +315,7 @@ contract moduleHandler is multiOwner, announcementTypes { Query of the whole token amount. @value amount. - @success was the function successfull? + @success was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByName('Token'); require( _success && _found ); @@ -326,7 +326,7 @@ contract moduleHandler is multiOwner, announcementTypes { Query of ICO state @ico Is ICO in progress?. - @success was the function successfull? + @success was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByName('Token'); require( _success && _found ); @@ -337,7 +337,7 @@ contract moduleHandler is multiOwner, announcementTypes { Query of number of the actual Schelling round. @round Schelling round. - @success was the function successfull? + @success was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByName('Schelling'); require( _success && _found ); @@ -350,7 +350,7 @@ contract moduleHandler is multiOwner, announcementTypes { @to Place of new token @value Token amount - @success Was the function successfull? + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found && modules[_id].name == keccak256('Provider') ); @@ -367,7 +367,7 @@ contract moduleHandler is multiOwner, announcementTypes { @to To who. @value Token amount. @fee Transaction fee will be charged or not? - @success Was the function successfull? + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found ); @@ -382,7 +382,7 @@ contract moduleHandler is multiOwner, announcementTypes { @from From who. @value Token amount. - @success Was the function successfull? + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found && modules[_id].name == keccak256('Provider') ); @@ -397,7 +397,7 @@ contract moduleHandler is multiOwner, announcementTypes { @from From who. @value Token amount. - @success Was the function successfull? + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success && _found && modules[_id].name == keccak256('Schelling') ); @@ -413,7 +413,7 @@ contract moduleHandler is multiOwner, announcementTypes { @moduleName Module name which will be configured @aType Type of variable (announcementType). @value New value - @success Was the function successfull? + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); require( _success ); @@ -431,7 +431,7 @@ contract moduleHandler is multiOwner, announcementTypes { function freezing(bool forever) external { /* Freezing CORION Platform. Can be called only by the owner. - Freez can not be recalled! + Freeze can not be recalled! @forever Is it forever or not? */ diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol index 78f7109c..ecc51ac3 100644 --- a/test/compilationTests/corion/multiOwner.sol +++ b/test/compilationTests/corion/multiOwner.sol @@ -12,7 +12,7 @@ contract multiOwner is safeMath { /* Constructor */ - constructor(address[] newOwners) { + constructor(address[] memory newOwners) public { for ( uint256 a=0 ; a<newOwners.length ; a++ ) { _addOwner(newOwners[a]); } @@ -41,7 +41,7 @@ contract multiOwner is safeMath { function ownersForChange() public view returns (uint256 owners) { return ownerCount * 75 / 100; } - function calcDoHash(string job, bytes32 data) public pure returns (bytes32 hash) { + function calcDoHash(string memory job, bytes32 data) public pure returns (bytes32 hash) { return keccak256(abi.encodePacked(job, data)); } function validDoHash(bytes32 doHash) public view returns (bool valid) { diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol index 695dd344..45fe7666 100644 --- a/test/compilationTests/corion/premium.sol +++ b/test/compilationTests/corion/premium.sol @@ -39,8 +39,8 @@ contract premium is module, safeMath { bool public isICO; mapping(address => bool) public genesis; - - constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] genesisAddr, uint256[] genesisValue) { + + constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public { /* Setup function. If an ICOaddress is defined then the balance of the genesis addresses will be set as well. @@ -118,7 +118,7 @@ contract premium is module, safeMath { @extraData Extra data to be received by the receiver @nonce Transaction count - @sucess Was the Function successful? + @success Was the Function successful? */ _approve(spender, amount, nonce); require( thirdPartyPContractAbstract(spender).approvedCorionPremiumToken(msg.sender, amount, extraData) ); @@ -139,8 +139,8 @@ contract premium is module, safeMath { require( db.setAllowance(msg.sender, spender, amount, nonce) ); emit Approval(msg.sender, spender, amount); } - - function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) { + + function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used @@ -246,7 +246,7 @@ contract premium is module, safeMath { return true; } - function transferToContract(address from, address to, uint256 amount, bytes extraData) internal { + function transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal { /* Inner function in order to transact a contract. @@ -318,8 +318,8 @@ contract premium is module, safeMath { } return _codeLength > 0; } - - function balanceOf(address owner) view returns (uint256 value) { + + function balanceOf(address owner) public view returns (uint256 value) { /* Token balance query @@ -328,8 +328,8 @@ contract premium is module, safeMath { */ return db.balanceOf(owner); } - - function totalSupply() view returns (uint256 value) { + + function totalSupply() public view returns (uint256 value) { /* Total token quantity query diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 16546809..7d1e04e3 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -18,7 +18,7 @@ contract provider is module, safeMath, announcementTypes { } function transferEvent(address from, address to, uint256 value) external returns (bool success) { /* - Transaction completed. This function is ony available for the modulehandler. + Transaction completed. This function is only available for the modulehandler. It should be checked if the sender or the acceptor does not connect to the provider or it is not a provider itself if so than the change should be recorded. @from From whom? @@ -35,7 +35,7 @@ contract provider is module, safeMath, announcementTypes { /* New schelling round. This function is only available for the moduleHandler. We are recording the new schelling round and we are storing the whole current quantity of the tokens. - We generate a reward quantity of tokens directed to the providers address. The collected interest will be tranfered from this contract. + We generate a reward quantity of tokens directed to the providers address. The collected interest will be transferred from this contract. @roundID Number of the schelling round. @reward token emission @@ -118,7 +118,7 @@ contract provider is module, safeMath, announcementTypes { uint256 private currentSchellingRound = 1; - constructor(address _moduleHandler) { + constructor(address _moduleHandler) public { /* Install function. @@ -228,7 +228,7 @@ contract provider is module, safeMath, announcementTypes { @website Provider’s website @country Provider’s country @info Provider’s short introduction. - @rate Rate of the emission what is going to be transfered to the client by the provider. + @rate Rate of the emission what is going to be transferred to the client by the provider. @isForRent is for Rent or not? @admin The admin’s address */ @@ -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 view returns (string name, string website, string country, string info, uint256 create) { + function getProviderInfo(address addr, uint256 height) public view returns (string memory name, string memory website, string memory country, string memory info, uint256 create) { /* for the infos of the provider. In case the height is unknown then the system will use the last known height. @@ -328,7 +328,7 @@ contract provider is module, safeMath, announcementTypes { @addr Address of the provider @height Height - @rate The rate of the emission which will be transfered to the client. + @rate The rate of the emission which will be transferred to the client. @isForRent Rent or not. @clientsCount Number of the clients. @priv Private or not? @@ -356,7 +356,7 @@ contract provider is module, safeMath, announcementTypes { } function closeProvider() isReady external { /* - Closing and inactivate the provider. + Closing and deactivating the provider. It is only possible to close that active provider which is owned by the sender itself after calling the whole share of the emission. Whom were connected to the provider those clients will have to disconnect after they’ve called their share of emission which was not called before. */ @@ -373,7 +373,7 @@ contract provider is module, safeMath, announcementTypes { /* Permition of the user to be able to connect to the provider. This can only be invited by the provider’s admin. - With this kind of call only 100 address can be permited. + With this kind of call only 100 address can be permitted. @addr Array of the addresses for whom the connection is allowed. */ @@ -391,7 +391,7 @@ contract provider is module, safeMath, announcementTypes { /* Disable of the user not to be able to connect to the provider. It is can called only for the admin of the provider. - With this kind of call only 100 address can be permited. + With this kind of call only 100 address can be permitted. @addr Array of the addresses for whom the connection is allowed. */ @@ -411,7 +411,7 @@ contract provider is module, safeMath, announcementTypes { Providers can not connect to other providers. If is a client at any provider, then it is not possible to connect to other provider one. It is only possible to connect to valid and active providers. - If is an active provider then the client can only connect, if address is permited at the provider (Whitelist). + If is an active provider then the client can only connect, if address is permitted at the provider (Whitelist). At private providers, the number of the client is restricted. If it reaches the limit no further clients are allowed to connect. This process has a transaction fee based on the senders whole token quantity. @@ -487,12 +487,12 @@ contract provider is module, safeMath, announcementTypes { /* Polling the share from the token emission token emission for clients and for providers. - It is optionaly possible to give an address of a beneficiary for whom we can transfer the accumulated amount. In case we don’t enter any address then the amount will be transfered to the caller’s address. + It is optionally possible to give an address of a beneficiary for whom we can transfer the accumulated amount. In case we don’t enter any address then the amount will be transferred to the caller’s address. As the interest should be checked at each schelling round in order to get the share from that so to avoid the overflow of the gas the number of the check-rounds should be limited. - Opcionalisan megadhato az ellenorzes koreinek szama. It is possible to enter optionaly the number of the check-rounds. If it is 0 then it is automatic. + Opcionalisan megadhato az ellenorzes koreinek szama. It is possible to enter optionally the number of the check-rounds. If it is 0 then it is automatic. Provider variable should only be entered if the real owner of the provider is not the caller’s address. In case the client/provider was far behind then it is possible that this function should be called several times to check the total generated schelling rounds and to collect the share. - If is neighter a client nor a provider then the function is not available. + If is neither a client nor a provider then the function is not available. The tokens will be sent to the beneficiary from the address of the provider without any transaction fees. @beneficiary Address of the beneficiary @@ -514,7 +514,7 @@ contract provider is module, safeMath, announcementTypes { } else if ( clients[msg.sender].providerAddress != address(0x00) ) { clientReward = getClientReward(_limit); } else { - throw; + revert(); } if ( clientReward > 0 ) { require( moduleHandler(moduleHandlerAddress).transfer(address(this), _beneficiary, clientReward, false) ); @@ -784,7 +784,7 @@ contract provider is module, safeMath, announcementTypes { /* Inner function to check the ICO status. - @isICO Is the ICO in proccess or not? + @isICO Is the ICO in process or not? */ (bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO(); require( _success ); diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol index f7d8fdea..575b99a8 100644 --- a/test/compilationTests/corion/publisher.sol +++ b/test/compilationTests/corion/publisher.sol @@ -60,8 +60,8 @@ contract publisher is announcementTypes, module, safeMath { uint256 announcementsLength = 1;
mapping (address => uint256[]) public opponents;
-
- constructor(address moduleHandler) {
+
+ constructor(address moduleHandler) public {
/*
Installation function. The installer will be registered in the admin list automatically
@@ -70,7 +70,7 @@ contract publisher is announcementTypes, module, safeMath { super.registerModuleHandler(moduleHandler);
}
- 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) {
+ function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string memory Announcement, string memory Link, bool Opposited, string memory _str, uint256 _uint, address _addr) {
/*
Announcement data query
@@ -264,7 +264,7 @@ contract publisher is announcementTypes, module, safeMath { function checkICO() internal returns (bool isICO) {
/*
Inner function to check the ICO status.
- @bool Is the ICO in proccess or not?
+ @bool Is the ICO in process or not?
*/
(bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
require( _success );
diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol index 74f8af9d..3905e300 100644 --- a/test/compilationTests/corion/schelling.sol +++ b/test/compilationTests/corion/schelling.sol @@ -45,7 +45,7 @@ contract schellingDB is safeMath, schellingVars { /* Constructor */ - constructor() { + constructor() public { rounds.length = 2; rounds[0].blockHeight = block.number; currentSchellingRound = 1; @@ -54,7 +54,7 @@ contract schellingDB is safeMath, schellingVars { Funds */ mapping(address => uint256) private funds; - function getFunds(address _owner) view returns(bool, uint256) { + function getFunds(address _owner) public 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) view returns(bool, uint256, uint256, uint256, uint256, bool) { + function getRound(uint256 _id) public 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() view returns(bool, uint256) { + function getCurrentRound() public view returns(bool, uint256) { return (true, rounds.length-1); } /* Voter */ mapping(address => _voter) private voter; - function getVoter(address _owner) view returns(bool success, uint256 roundID, + function getVoter(address _owner) public 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) view returns(bool, uint256) { + function getSchellingExpansion(uint256 _id) public 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() view returns(bool, uint256) { + function getCurrentSchellingRound() public view returns(bool, uint256) { return (true, currentSchellingRound); } } @@ -147,7 +147,7 @@ contract schelling is module, announcementTypes, schellingVars { @from From who @to To who @value Amount - @bool Was the transaction succesfull? + @bool Was the transaction successful? */ require( super.isModuleHandler(msg.sender) ); if ( to == address(this) ) { @@ -174,7 +174,7 @@ contract schelling is module, announcementTypes, schellingVars { function setFunds(address addr, uint256 amount) internal { require( db.setFunds(addr, amount) ); } - function setVoter(address owner, _voter voter) internal { + function setVoter(address owner, _voter memory voter) internal { require( db.setVoter(owner, voter.roundID, voter.hash, @@ -182,13 +182,13 @@ contract schelling is module, announcementTypes, schellingVars { voter.voteResult, voter.rewards ) ); - } - function getVoter(address addr) internal view returns (_voter) { + } + function getVoter(address addr) internal view returns (_voter memory) { (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); } - function setRound(uint256 id, _rounds round) internal { + function setRound(uint256 id, _rounds memory round) internal { require( db.setRound(id, round.totalAboveWeight, round.totalBelowWeight, @@ -197,8 +197,8 @@ contract schelling is module, announcementTypes, schellingVars { round.voted ) ); } - function pushRound(_rounds round) internal returns (uint256) { - (bool a, uint256 b) = db.pushRound( + function pushRound(_rounds memory round) internal returns (uint256) { + (bool a, uint256 b) = db.pushRound( round.totalAboveWeight, round.totalBelowWeight, round.reward, @@ -208,7 +208,7 @@ contract schelling is module, announcementTypes, schellingVars { require( a ); return b; } - function getRound(uint256 id) internal returns (_rounds) { + function getRound(uint256 id) internal returns (_rounds memory) { (bool a, uint256 b, uint256 c, uint256 d, uint256 e, bool f) = db.getRound(id); require( a ); return _rounds(b, c, d, e, f); @@ -246,8 +246,8 @@ contract schelling is module, announcementTypes, schellingVars { bytes1 public aboveChar = 0x31; bytes1 public belowChar = 0x30; schellingDB private db; - - constructor(address _moduleHandler, address _db, bool _forReplace) { + + constructor(address _moduleHandler, address _db, bool _forReplace) public { /* Installation function. @@ -389,7 +389,7 @@ contract schelling is module, announcementTypes, schellingVars { } delete voter.status; delete voter.roundID; - } else { throw; } + } else { revert(); } setVoter(msg.sender, voter); setFunds(msg.sender, funds); @@ -442,14 +442,14 @@ contract schelling is module, announcementTypes, schellingVars { if ( ! round.voted ) { newRound.reward = round.reward; } - uint256 aboves; + uint256 above; for ( uint256 a=currentRound ; a>=currentRound-interestCheckRounds ; a-- ) { if (a == 0) { break; } prevRound = getRound(a); - if ( prevRound.totalAboveWeight > prevRound.totalBelowWeight ) { aboves++; } + if ( prevRound.totalAboveWeight > prevRound.totalBelowWeight ) { above++; } } uint256 expansion; - if ( aboves >= interestCheckAboves ) { + if ( above >= interestCheckAboves ) { expansion = getTotalSupply() * interestRate / interestRateM / 100; } @@ -529,7 +529,7 @@ contract schelling is module, announcementTypes, schellingVars { return belowW; } } - function isWinner(_rounds round, bool aboveVote) internal returns (bool) { + function isWinner(_rounds memory round, bool aboveVote) internal returns (bool) { /* Inside function for calculating the result of the game. diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index fecbce3d..6c8f6f24 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -47,8 +47,8 @@ contract token is safeMath, module, announcementTypes { bool public isICO = true; mapping(address => bool) public genesis; - - constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] genesisAddr, uint256[] genesisValue) payable { + + constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable { /* Installation function @@ -73,7 +73,7 @@ contract token is safeMath, module, announcementTypes { if ( ! forReplace ) { require( db.replaceOwner(this) ); assert( genesisAddr.length == genesisValue.length ); - require( this.balance >= genesisAddr.length * 0.2 ether ); + require( address(this).balance >= genesisAddr.length * 0.2 ether ); for ( uint256 a=0 ; a<genesisAddr.length ; a++ ) { genesis[genesisAddr[a]] = true; require( db.increase(genesisAddr[a], genesisValue[a]) ); @@ -154,8 +154,8 @@ contract token is safeMath, module, announcementTypes { require( db.setAllowance(msg.sender, spender, amount, nonce) ); emit Approval(msg.sender, spender, amount); } - - function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) { + + function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used @@ -288,7 +288,7 @@ contract token is safeMath, module, announcementTypes { return true; } - function _transferToContract(address from, address to, uint256 amount, bytes extraData) internal { + function _transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal { /* Internal function to start transactions to a contract @@ -471,8 +471,8 @@ contract token is safeMath, module, announcementTypes { } return _codeLength > 0; } - - function balanceOf(address owner) view returns (uint256 value) { + + function balanceOf(address owner) public view returns (uint256 value) { /* Token balance query @@ -482,8 +482,8 @@ contract token is safeMath, module, announcementTypes { */ return db.balanceOf(owner); } - - function totalSupply() view returns (uint256 value) { + + function totalSupply() public view returns (uint256 value) { /* Total token quantity query diff --git a/test/compilationTests/corion/tokenDB.sol b/test/compilationTests/corion/tokenDB.sol index 40304a54..484135ca 100644 --- a/test/compilationTests/corion/tokenDB.sol +++ b/test/compilationTests/corion/tokenDB.sol @@ -60,8 +60,8 @@ contract tokenDB is safeMath, ownedDB { allowance[owner][spender].nonce = nonce;
return true;
}
-
- function getAllowance(address owner, address spender) view returns(bool success, uint256 remaining, uint256 nonce) {
+
+ function getAllowance(address owner, address spender) public view returns(bool success, uint256 remaining, uint256 nonce) {
/*
Get allowance from the database.
diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol index 177f61df..5b1a550c 100644 --- a/test/compilationTests/gnosis/Events/Event.sol +++ b/test/compilationTests/gnosis/Events/Event.sol @@ -101,7 +101,7 @@ contract Event { function getOutcomeTokens() public view - returns (OutcomeToken[]) + returns (OutcomeToken[] memory) { return outcomeTokens; } @@ -111,7 +111,7 @@ contract Event { function getOutcomeTokenDistribution(address owner) public view - returns (uint[] outcomeTokenDistribution) + returns (uint[] memory outcomeTokenDistribution) { outcomeTokenDistribution = new uint[](outcomeTokens.length); for (uint8 i = 0; i < outcomeTokenDistribution.length; i++) diff --git a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol index cf4fcd7d..4ad285eb 100644 --- a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol +++ b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol @@ -108,7 +108,7 @@ contract LMSRMarketMaker is MarketMaker { /// @param netOutcomeTokensSold Net outcome tokens sold by market /// @param funding Initial funding for market /// @return Cost level - function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) + function calcCostLevel(int logN, int[] memory netOutcomeTokensSold, uint funding) private view returns(int costLevel) @@ -129,7 +129,7 @@ contract LMSRMarketMaker is MarketMaker { /// @param funding Initial funding for market /// @param outcomeIndex Index of exponential term to extract (for use by marginal price function) /// @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) + function sumExpOffset(int logN, int[] memory netOutcomeTokensSold, uint funding, uint8 outcomeIndex) private view returns (uint sum, int offset, uint outcomeExpTerm) @@ -171,7 +171,7 @@ contract LMSRMarketMaker is MarketMaker { function getNetOutcomeTokensSold(Market market) private view - returns (int[] quantities) + returns (int[] memory quantities) { quantities = new int[](market.eventContract().getOutcomeCount()); for (uint8 i = 0; i < quantities.length; i++) diff --git a/test/compilationTests/gnosis/Migrations.sol b/test/compilationTests/gnosis/Migrations.sol index c7d09bd2..f1a3ea9d 100644 --- a/test/compilationTests/gnosis/Migrations.sol +++ b/test/compilationTests/gnosis/Migrations.sol @@ -8,15 +8,15 @@ contract Migrations { if (msg.sender == owner) _; } - constructor() { + constructor() public { owner = msg.sender; } - function setCompleted(uint completed) restricted { + function setCompleted(uint completed) public restricted { last_completed_migration = completed; } - function upgrade(address new_address) restricted { + function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); upgraded.setCompleted(last_completed_migration); } diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol index de182a61..e175dfdb 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol @@ -34,7 +34,7 @@ contract CentralizedOracle is Oracle { */ /// @dev Constructor sets owner address and IPFS hash /// @param _ipfsHash Hash identifying off chain event description - constructor(address _owner, bytes _ipfsHash) + constructor(address _owner, bytes memory _ipfsHash) public { // Description hash cannot be null diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol index ca4e37d2..be632070 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol @@ -17,7 +17,7 @@ contract CentralizedOracleFactory { /// @dev Creates a new centralized oracle contract /// @param ipfsHash Hash identifying off chain event description /// @return Oracle contract - function createCentralizedOracle(bytes ipfsHash) + function createCentralizedOracle(bytes memory ipfsHash) public returns (CentralizedOracle centralizedOracle) { diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol index d8097370..4dc1760d 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol @@ -16,7 +16,7 @@ contract MajorityOracle is Oracle { */ /// @dev Allows to create an oracle for a majority vote based on other oracles /// @param _oracles List of oracles taking part in the majority vote - constructor(Oracle[] _oracles) + constructor(Oracle[] memory _oracles) public { // At least 2 oracles should be defined diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol index 3c02fef4..dbbccc4c 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol @@ -17,7 +17,7 @@ contract MajorityOracleFactory { /// @dev Creates a new majority oracle contract /// @param oracles List of oracles taking part in the majority vote /// @return Oracle contract - function createMajorityOracle(Oracle[] oracles) + function createMajorityOracle(Oracle[] memory oracles) public returns (MajorityOracle majorityOracle) { diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 93456c33..47edcba4 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -176,7 +176,7 @@ library Math { /// @dev Returns maximum of an array /// @param nums Numbers to look through /// @return Maximum number - function max(int[] nums) + function max(int[] memory nums) public pure returns (int max) diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol index 378f7b73..856fb1a5 100644 --- a/test/compilationTests/milestonetracker/MilestoneTracker.sol +++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol @@ -22,7 +22,7 @@ pragma solidity ^0.4.6; /// @dev This contract tracks the -/// is rules the relation betwen a donor and a recipient +/// is rules the relation between a donor and a recipient /// in order to guaranty to the donor that the job will be done and to guaranty /// to the recipient that he will be paid @@ -83,14 +83,14 @@ contract MilestoneTracker { /// @dev The following modifiers only allow specific roles to call functions /// with these modifiers - modifier onlyRecipient { if (msg.sender != recipient) throw; _; } - modifier onlyArbitrator { if (msg.sender != arbitrator) throw; _; } - modifier onlyDonor { if (msg.sender != donor) throw; _; } + modifier onlyRecipient { if (msg.sender != recipient) revert(); _; } + modifier onlyArbitrator { if (msg.sender != arbitrator) revert(); _; } + modifier onlyDonor { if (msg.sender != donor) revert(); _; } /// @dev The following modifiers prevent functions from being called if the /// campaign has been canceled or if new milestones are being proposed - modifier campaignNotCanceled { if (campaignCanceled) throw; _; } - modifier notChanging { if (changingMilestones) throw; _; } + modifier campaignNotCanceled { if (campaignCanceled) revert(); _; } + modifier notChanging { if (changingMilestones) revert(); _; } // @dev Events to make the payment movements easy to find on the blockchain event NewMilestoneListProposed(); @@ -112,7 +112,7 @@ contract MilestoneTracker { address _arbitrator, address _donor, address _recipient - ) { + ) public { arbitrator = _arbitrator; donor = _donor; recipient = _recipient; @@ -124,7 +124,7 @@ contract MilestoneTracker { ///////// /// @return The number of milestones ever created even if they were canceled - function numberOfMilestones() view returns (uint) { + function numberOfMilestones() public view returns (uint) { return milestones.length; } @@ -135,19 +135,19 @@ contract MilestoneTracker { /// @notice `onlyArbitrator` Reassigns the arbitrator to a new address /// @param _newArbitrator The new arbitrator - function changeArbitrator(address _newArbitrator) onlyArbitrator { + function changeArbitrator(address _newArbitrator) public onlyArbitrator { arbitrator = _newArbitrator; } /// @notice `onlyDonor` Reassigns the `donor` to a new address /// @param _newDonor The new donor - function changeDonor(address _newDonor) onlyDonor { + function changeDonor(address _newDonor) public onlyDonor { donor = _newDonor; } /// @notice `onlyRecipient` Reassigns the `recipient` to a new address /// @param _newRecipient The new recipient - function changeRecipient(address _newRecipient) onlyRecipient { + function changeRecipient(address _newRecipient) public onlyRecipient { recipient = _newRecipient; } @@ -175,8 +175,8 @@ contract MilestoneTracker { /// uint reviewTime /// address paymentSource, /// bytes payData, - function proposeMilestones(bytes _newMilestones - ) onlyRecipient campaignNotCanceled { + function proposeMilestones(bytes memory _newMilestones + ) public onlyRecipient campaignNotCanceled { proposedMilestones = _newMilestones; changingMilestones = true; emit NewMilestoneListProposed(); @@ -189,7 +189,7 @@ contract MilestoneTracker { /// @notice `onlyRecipient` Cancels the proposed milestones and reactivates /// the previous set of milestones - function unproposeMilestones() onlyRecipient campaignNotCanceled { + function unproposeMilestones() public onlyRecipient campaignNotCanceled { delete proposedMilestones; changingMilestones = false; emit NewMilestoneListUnproposed(); @@ -200,12 +200,12 @@ contract MilestoneTracker { /// bytecode; this confirms that the `donor` knows the set of milestones /// they are approving function acceptProposedMilestones(bytes32 _hashProposals - ) onlyDonor campaignNotCanceled { + ) public onlyDonor campaignNotCanceled { uint i; - if (!changingMilestones) throw; - if (keccak256(proposedMilestones) != _hashProposals) throw; + if (!changingMilestones) revert(); + if (keccak256(proposedMilestones) != _hashProposals) revert(); // Cancel all the unfinished milestones for (i=0; i<milestones.length; i++) { @@ -218,7 +218,7 @@ contract MilestoneTracker { RLP.RLPItem memory itmProposals = mProposedMilestones.toRLPItem(true); - if (!itmProposals.isList()) throw; + if (!itmProposals.isList()) revert(); RLP.Iterator memory itrProposals = itmProposals.iterator(); @@ -227,9 +227,9 @@ contract MilestoneTracker { RLP.RLPItem memory itmProposal = itrProposals.next(); - Milestone milestone = milestones[milestones.length ++]; + Milestone storage milestone = milestones[milestones.length ++]; - if (!itmProposal.isList()) throw; + if (!itmProposal.isList()) revert(); RLP.Iterator memory itrProposal = itmProposal.iterator(); @@ -256,16 +256,16 @@ contract MilestoneTracker { /// ready for review /// @param _idMilestone ID of the milestone that has been completed function markMilestoneComplete(uint _idMilestone) - campaignNotCanceled notChanging + public campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ( (msg.sender != milestone.milestoneLeadLink) &&(msg.sender != recipient)) - throw; - if (milestone.status != MilestoneStatus.AcceptedAndInProgress) throw; - if (now < milestone.minCompletionDate) throw; - if (now > milestone.maxCompletionDate) throw; + revert(); + if (milestone.status != MilestoneStatus.AcceptedAndInProgress) revert(); + if (now < milestone.minCompletionDate) revert(); + if (now > milestone.maxCompletionDate) revert(); milestone.status = MilestoneStatus.Completed; milestone.doneTime = now; emit ProposalStatusChanged(_idMilestone, milestone.status); @@ -274,12 +274,12 @@ contract MilestoneTracker { /// @notice `onlyReviewer` Approves a specific milestone /// @param _idMilestone ID of the milestone that is approved function approveCompletedMilestone(uint _idMilestone) - campaignNotCanceled notChanging + public campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ((msg.sender != milestone.reviewer) || - (milestone.status != MilestoneStatus.Completed)) throw; + (milestone.status != MilestoneStatus.Completed)) revert(); authorizePayment(_idMilestone); } @@ -289,12 +289,12 @@ contract MilestoneTracker { /// state /// @param _idMilestone ID of the milestone that is being rejected function rejectMilestone(uint _idMilestone) - campaignNotCanceled notChanging + public campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ((msg.sender != milestone.reviewer) || - (milestone.status != MilestoneStatus.Completed)) throw; + (milestone.status != MilestoneStatus.Completed)) revert(); milestone.status = MilestoneStatus.AcceptedAndInProgress; emit ProposalStatusChanged(_idMilestone, milestone.status); @@ -305,15 +305,15 @@ contract MilestoneTracker { /// `reviewTime` has elapsed /// @param _idMilestone ID of the milestone to be paid out function requestMilestonePayment(uint _idMilestone - ) campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + ) public campaignNotCanceled notChanging { + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ( (msg.sender != milestone.milestoneLeadLink) &&(msg.sender != recipient)) - throw; + revert(); if ((milestone.status != MilestoneStatus.Completed) || (now < milestone.doneTime + milestone.reviewTime)) - throw; + revert(); authorizePayment(_idMilestone); } @@ -321,13 +321,13 @@ contract MilestoneTracker { /// @notice `onlyRecipient` Cancels a previously accepted milestone /// @param _idMilestone ID of the milestone to be canceled function cancelMilestone(uint _idMilestone) - onlyRecipient campaignNotCanceled notChanging + public onlyRecipient campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ((milestone.status != MilestoneStatus.AcceptedAndInProgress) && (milestone.status != MilestoneStatus.Completed)) - throw; + revert(); milestone.status = MilestoneStatus.Canceled; emit ProposalStatusChanged(_idMilestone, milestone.status); @@ -337,31 +337,31 @@ contract MilestoneTracker { /// has not been paid or canceled /// @param _idMilestone ID of the milestone to be paid out function arbitrateApproveMilestone(uint _idMilestone - ) onlyArbitrator campaignNotCanceled notChanging { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + ) public onlyArbitrator campaignNotCanceled notChanging { + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; if ((milestone.status != MilestoneStatus.AcceptedAndInProgress) && (milestone.status != MilestoneStatus.Completed)) - throw; + revert(); authorizePayment(_idMilestone); } /// @notice `onlyArbitrator` Cancels the entire campaign voiding all /// milestones. - function arbitrateCancelCampaign() onlyArbitrator campaignNotCanceled { + function arbitrateCancelCampaign() public onlyArbitrator campaignNotCanceled { campaignCanceled = true; emit CampaignCanceled(); } // @dev This internal function is executed when the milestone is paid out function authorizePayment(uint _idMilestone) internal { - if (_idMilestone >= milestones.length) throw; - Milestone milestone = milestones[_idMilestone]; + if (_idMilestone >= milestones.length) revert(); + Milestone storage milestone = milestones[_idMilestone]; // Recheck again to not pay twice - if (milestone.status == MilestoneStatus.AuthorizedForPayment) throw; + if (milestone.status == MilestoneStatus.AuthorizedForPayment) revert(); milestone.status = MilestoneStatus.AuthorizedForPayment; if (!milestone.paymentSource.call.value(0)(milestone.payData)) - throw; + revert(); emit ProposalStatusChanged(_idMilestone, milestone.status); } } diff --git a/test/compilationTests/milestonetracker/RLP.sol b/test/compilationTests/milestonetracker/RLP.sol index e96bb332..e261bf23 100644 --- a/test/compilationTests/milestonetracker/RLP.sol +++ b/test/compilationTests/milestonetracker/RLP.sol @@ -39,13 +39,13 @@ library RLP { self._unsafe_nextPtr = ptr + itemLength; } else - throw; + revert(); } function next(Iterator memory self, bool strict) internal view returns (RLPItem memory subItem) { subItem = next(self); if(strict && !_validate(subItem)) - throw; + revert(); return; } @@ -80,11 +80,11 @@ library RLP { if(strict) { uint len = self.length; if(_payloadOffset(item) > len) - throw; + revert(); if(_itemLength(item._unsafe_memPtr) != len) - throw; + revert(); if(!_validate(item)) - throw; + revert(); } return item; } @@ -160,7 +160,7 @@ library RLP { /// @return An 'Iterator' over the item. function iterator(RLPItem memory self) internal view returns (Iterator memory it) { if (!isList(self)) - throw; + revert(); uint ptr = self._unsafe_memPtr + _payloadOffset(self); it._unsafe_item = self; it._unsafe_nextPtr = ptr; @@ -183,7 +183,7 @@ library RLP { /// @return The decoded string. function toData(RLPItem memory self) internal returns (bytes memory bts) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); bts = new bytes(len); _copyToBytes(rStartPos, bts, len); @@ -195,7 +195,7 @@ library RLP { /// @return Array of RLPItems. function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) { if(!isList(self)) - throw; + revert(); uint numItems = items(self); list = new RLPItem[](numItems); Iterator memory it = iterator(self); @@ -212,7 +212,7 @@ library RLP { /// @return The decoded string. function toAscii(RLPItem memory self) internal returns (string memory str) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); bytes memory bts = new bytes(len); _copyToBytes(rStartPos, bts, len); @@ -225,10 +225,10 @@ library RLP { /// @return The decoded string. function toUint(RLPItem memory self) internal view returns (uint data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len > 32 || len == 0) - throw; + revert(); assembly { data := div(mload(rStartPos), exp(256, sub(32, len))) } @@ -240,16 +240,16 @@ library RLP { /// @return The decoded string. function toBool(RLPItem memory self) internal view returns (bool data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 1) - throw; + revert(); uint temp; assembly { temp := byte(0, mload(rStartPos)) } if (temp > 1) - throw; + revert(); return temp == 1 ? true : false; } @@ -259,10 +259,10 @@ library RLP { /// @return The decoded string. function toByte(RLPItem memory self) internal view returns (byte data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 1) - throw; + revert(); uint8 temp; assembly { temp := byte(0, mload(rStartPos)) @@ -292,10 +292,10 @@ library RLP { /// @return The decoded string. function toAddress(RLPItem memory self) internal view returns (address data) { if(!isData(self)) - throw; + revert(); (uint rStartPos, uint len) = _decode(self); if (len != 20) - throw; + revert(); assembly { data := div(mload(rStartPos), exp(256, 12)) } @@ -350,7 +350,7 @@ library RLP { // Get start position and length of the data. function _decode(RLPItem memory self) private view returns (uint memPtr, uint len) { if(!isData(self)) - throw; + revert(); uint b0; uint start = self._unsafe_memPtr; assembly { diff --git a/test/compilationTests/stringutils/strings.sol b/test/compilationTests/stringutils/strings.sol index fc46ec5a..390fb5d9 100644 --- a/test/compilationTests/stringutils/strings.sol +++ b/test/compilationTests/stringutils/strings.sol @@ -63,7 +63,7 @@ library strings { * @param self The string to make a slice from. * @return A newly allocated slice containing the entire string. */ - function toSlice(string self) internal returns (slice) { + function toSlice(string memory self) internal returns (slice memory) { uint ptr; assembly { ptr := add(self, 0x20) @@ -109,7 +109,7 @@ library strings { * @return A new slice containing the value of the input argument up to the * first null. */ - function toSliceB32(bytes32 self) internal returns (slice ret) { + function toSliceB32(bytes32 self) internal returns (slice memory ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) @@ -125,7 +125,7 @@ library strings { * @param self The slice to copy. * @return A new slice containing the same data as `self`. */ - function copy(slice self) internal returns (slice) { + function copy(slice memory self) internal returns (slice memory) { return slice(self._len, self._ptr); } @@ -134,7 +134,7 @@ library strings { * @param self The slice to copy. * @return A newly allocated string containing the slice's text. */ - function toString(slice self) internal returns (string) { + function toString(slice memory self) internal returns (string memory) { string memory ret = new string(self._len); uint retptr; assembly { retptr := add(ret, 32) } @@ -151,7 +151,7 @@ library strings { * @param self The slice to operate on. * @return The length of the slice in runes. */ - function len(slice self) internal returns (uint) { + function len(slice memory self) internal returns (uint) { // Starting at ptr-31 means the LSB will be the byte we care about uint ptr = self._ptr - 31; uint end = ptr + self._len; @@ -181,7 +181,7 @@ library strings { * @param self The slice to operate on. * @return True if the slice is empty, False otherwise. */ - function empty(slice self) internal returns (bool) { + function empty(slice memory self) internal returns (bool) { return self._len == 0; } @@ -194,7 +194,7 @@ library strings { * @param other The second slice to compare. * @return The result of the comparison. */ - function compare(slice self, slice other) internal returns (int) { + function compare(slice memory self, slice memory other) internal returns (int) { uint shortest = self._len; if (other._len < self._len) shortest = other._len; @@ -227,7 +227,7 @@ library strings { * @param self The second slice to compare. * @return True if the slices are equal, false otherwise. */ - function equals(slice self, slice other) internal returns (bool) { + function equals(slice memory self, slice memory other) internal returns (bool) { return compare(self, other) == 0; } @@ -238,7 +238,7 @@ library strings { * @param rune The slice that will contain the first rune. * @return `rune`. */ - function nextRune(slice self, slice rune) internal returns (slice) { + function nextRune(slice memory self, slice memory rune) internal returns (slice memory) { rune._ptr = self._ptr; if (self._len == 0) { @@ -280,7 +280,7 @@ library strings { * @param self The slice to operate on. * @return A slice containing only the first rune from `self`. */ - function nextRune(slice self) internal returns (slice ret) { + function nextRune(slice memory self) internal returns (slice memory ret) { nextRune(self, ret); } @@ -289,7 +289,7 @@ library strings { * @param self The slice to operate on. * @return The number of the first codepoint in the slice. */ - function ord(slice self) internal returns (uint ret) { + function ord(slice memory self) internal returns (uint ret) { if (self._len == 0) { return 0; } @@ -338,7 +338,7 @@ library strings { * @param self The slice to hash. * @return The hash of the slice. */ - function keccak(slice self) internal returns (bytes32 ret) { + function keccak(slice memory self) internal returns (bytes32 ret) { assembly { ret := keccak256(mload(add(self, 32)), mload(self)) } @@ -350,7 +350,7 @@ library strings { * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ - function startsWith(slice self, slice needle) internal returns (bool) { + function startsWith(slice memory self, slice memory needle) internal returns (bool) { if (self._len < needle._len) { return false; } @@ -376,7 +376,7 @@ library strings { * @param needle The slice to search for. * @return `self` */ - function beyond(slice self, slice needle) internal returns (slice) { + function beyond(slice memory self, slice memory needle) internal returns (slice memory) { if (self._len < needle._len) { return self; } @@ -405,7 +405,7 @@ library strings { * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ - function endsWith(slice self, slice needle) internal returns (bool) { + function endsWith(slice memory self, slice memory needle) internal returns (bool) { if (self._len < needle._len) { return false; } @@ -433,7 +433,7 @@ library strings { * @param needle The slice to search for. * @return `self` */ - function until(slice self, slice needle) internal returns (slice) { + function until(slice memory self, slice memory needle) internal returns (slice memory) { if (self._len < needle._len) { return self; } @@ -542,7 +542,7 @@ library strings { * @param needle The text to search for. * @return `self`. */ - function find(slice self, slice needle) internal returns (slice) { + function find(slice memory self, slice memory needle) internal returns (slice memory) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); self._len -= ptr - self._ptr; self._ptr = ptr; @@ -557,7 +557,7 @@ library strings { * @param needle The text to search for. * @return `self`. */ - function rfind(slice self, slice needle) internal returns (slice) { + function rfind(slice memory self, slice memory needle) internal returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); self._len = ptr - self._ptr; return self; @@ -573,7 +573,7 @@ library strings { * @param token An output parameter to which the first token is written. * @return `token`. */ - function split(slice self, slice needle, slice token) internal returns (slice) { + function split(slice memory self, slice memory needle, slice memory token) internal returns (slice memory) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = self._ptr; token._len = ptr - self._ptr; @@ -596,7 +596,7 @@ library strings { * @param needle The text to search for in `self`. * @return The part of `self` up to the first occurrence of `delim`. */ - function split(slice self, slice needle) internal returns (slice token) { + function split(slice memory self, slice memory needle) internal returns (slice memory token) { split(self, needle, token); } @@ -610,7 +610,7 @@ library strings { * @param token An output parameter to which the first token is written. * @return `token`. */ - function rsplit(slice self, slice needle, slice token) internal returns (slice) { + function rsplit(slice memory self, slice memory needle, slice memory token) internal returns (slice memory) { uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); @@ -632,7 +632,7 @@ library strings { * @param needle The text to search for in `self`. * @return The part of `self` after the last occurrence of `delim`. */ - function rsplit(slice self, slice needle) internal returns (slice token) { + function rsplit(slice memory self, slice memory needle) internal returns (slice memory token) { rsplit(self, needle, token); } @@ -642,7 +642,7 @@ library strings { * @param needle The text to search for in `self`. * @return The number of occurrences of `needle` found in `self`. */ - function count(slice self, slice needle) internal returns (uint count) { + function count(slice memory self, slice memory needle) internal returns (uint count) { uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { count++; @@ -656,7 +656,7 @@ library strings { * @param needle The text to search for in `self`. * @return True if `needle` is found in `self`, false otherwise. */ - function contains(slice self, slice needle) internal returns (bool) { + function contains(slice memory self, slice memory needle) internal returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; } @@ -667,7 +667,7 @@ library strings { * @param other The second slice to concatenate. * @return The concatenation of the two strings. */ - function concat(slice self, slice other) internal returns (string) { + function concat(slice memory self, slice memory other) internal returns (string memory) { string memory ret = new string(self._len + other._len); uint retptr; assembly { retptr := add(ret, 32) } @@ -684,7 +684,7 @@ library strings { * @return A newly allocated string containing all the slices in `parts`, * joined with `self`. */ - function join(slice self, slice[] parts) internal returns (string) { + function join(slice memory self, slice[] memory parts) internal returns (string memory) { if (parts.length == 0) return ""; diff --git a/test/compilationTests/zeppelin/Bounty.sol b/test/compilationTests/zeppelin/Bounty.sol index 8be16a54..55e64071 100644 --- a/test/compilationTests/zeppelin/Bounty.sol +++ b/test/compilationTests/zeppelin/Bounty.sol @@ -16,11 +16,11 @@ contract Bounty is PullPayment, Destructible { event TargetCreated(address createdAddress); /** - * @dev Fallback function allowing the contract to recieve funds, if they haven't already been claimed. + * @dev Fallback function allowing the contract to receive funds, if they haven't already been claimed. */ function() external payable { if (claimed) { - throw; + revert(); } } @@ -29,7 +29,7 @@ contract Bounty is PullPayment, Destructible { * msg.sender as a researcher * @return A target contract */ - function createTarget() returns(Target) { + function createTarget() public returns(Target) { Target target = Target(deployContract()); researchers[target] = msg.sender; emit TargetCreated(target); @@ -46,16 +46,16 @@ contract Bounty is PullPayment, Destructible { * @dev Sends the contract funds to the researcher that proved the contract is broken. * @param target contract */ - function claim(Target target) { + function claim(Target target) public { address researcher = researchers[target]; if (researcher == address(0)) { - throw; + revert(); } // Check Target contract invariants if (target.checkInvariant()) { - throw; + revert(); } - asyncSend(researcher, this.balance); + asyncSend(researcher, address(this).balance); claimed = true; } @@ -74,5 +74,5 @@ contract Target { * In order to win the bounty, security researchers will try to cause this broken state. * @return True if all invariant values are correct, false otherwise. */ - function checkInvariant() returns(bool); + function checkInvariant() public returns(bool); } diff --git a/test/compilationTests/zeppelin/DayLimit.sol b/test/compilationTests/zeppelin/DayLimit.sol index e55076b7..bc576c89 100644 --- a/test/compilationTests/zeppelin/DayLimit.sol +++ b/test/compilationTests/zeppelin/DayLimit.sol @@ -15,7 +15,7 @@ contract DayLimit { * @dev Constructor that sets the passed value as a dailyLimit. * @param _limit uint256 to represent the daily limit. */ - constructor(uint256 _limit) { + constructor(uint256 _limit) public { dailyLimit = _limit; lastDay = today(); } @@ -68,7 +68,7 @@ contract DayLimit { */ modifier limitedDaily(uint256 _value) { if (!underLimit(_value)) { - throw; + revert(); } _; } diff --git a/test/compilationTests/zeppelin/LimitBalance.sol b/test/compilationTests/zeppelin/LimitBalance.sol index 40edd014..8bf4b253 100644 --- a/test/compilationTests/zeppelin/LimitBalance.sol +++ b/test/compilationTests/zeppelin/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. */ - constructor(uint256 _limit) { + constructor(uint256 _limit) public { limit = _limit; } @@ -23,8 +23,8 @@ contract LimitBalance { * @dev Checks if limit was reached. Case true, it throws. */ modifier limitedPayable() { - if (this.balance > limit) { - throw; + if (address(this).balance > limit) { + revert(); } _; diff --git a/test/compilationTests/zeppelin/MultisigWallet.sol b/test/compilationTests/zeppelin/MultisigWallet.sol index 96624d3a..3793428d 100644 --- a/test/compilationTests/zeppelin/MultisigWallet.sol +++ b/test/compilationTests/zeppelin/MultisigWallet.sol @@ -25,19 +25,19 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { * @param _owners A list of owners. * @param _required The amount required for a transaction to be approved. */ - constructor(address[] _owners, uint256 _required, uint256 _daylimit) + constructor(address[] memory _owners, uint256 _required, uint256 _daylimit) Shareable(_owners, _required) - DayLimit(_daylimit) { } + DayLimit(_daylimit) public { } - /** - * @dev destroys the contract sending everything to `_to`. + /** + * @dev destroys the contract sending everything to `_to`. */ function destroy(address _to) onlymanyowners(keccak256(msg.data)) external { selfdestruct(_to); } - /** - * @dev Fallback function, receives value and emits a deposit event. + /** + * @dev Fallback function, receives value and emits a deposit event. */ function() external payable { // just being sent some cash? @@ -46,10 +46,10 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { } /** - * @dev Outside-visible transaction entry point. Executes transaction immediately if below daily - * spending limit. If not, goes into multisig process. We provide a hash on return to allow the - * sender to provide shortcuts for the other confirmations (allowing them to avoid replicating - * the _to, _value, and _data arguments). They still get the option of using them if they want, + * @dev Outside-visible transaction entry point. Executes transaction immediately if below daily + * spending limit. If not, goes into multisig process. We provide a hash on return to allow the + * sender to provide shortcuts for the other confirmations (allowing them to avoid replicating + * the _to, _value, and _data arguments). They still get the option of using them if they want, * anyways. * @param _to The receiver address * @param _value The value to send @@ -61,7 +61,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { emit SingleTransact(msg.sender, _value, _to, _data); // yes - just execute the call. if (!_to.call.value(_value)(_data)) { - throw; + revert(); } return 0; } @@ -76,14 +76,14 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { } /** - * @dev Confirm a transaction by providing just the hash. We use the previous transactions map, + * @dev Confirm a transaction by providing just the hash. We use the previous transactions map, * txs, in order to determine the body of the transaction from the hash provided. * @param _h The transaction hash to approve. */ - function confirm(bytes32 _h) onlymanyowners(_h) returns (bool) { + function confirm(bytes32 _h) onlymanyowners(_h) public returns (bool) { if (txs[_h].to != address(0)) { if (!txs[_h].to.call.value(txs[_h].value)(txs[_h].data)) { - throw; + revert(); } emit MultiTransact(msg.sender, _h, txs[_h].value, txs[_h].to, txs[_h].data); delete txs[_h]; @@ -91,15 +91,15 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { } } - /** - * @dev Updates the daily limit value. + /** + * @dev Updates the daily limit value. * @param _newLimit uint256 to represent the new limit. */ function setDailyLimit(uint256 _newLimit) onlymanyowners(keccak256(msg.data)) external { _setDailyLimit(_newLimit); } - /** + /** * @dev Resets the value spent to enable more spending */ function resetSpentToday() onlymanyowners(keccak256(msg.data)) external { @@ -108,7 +108,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit { // INTERNAL METHODS - /** + /** * @dev Clears the list of transactions pending approval. */ function clearPending() internal { diff --git a/test/compilationTests/zeppelin/ReentrancyGuard.sol b/test/compilationTests/zeppelin/ReentrancyGuard.sol index ca8b643b..7805ec07 100644 --- a/test/compilationTests/zeppelin/ReentrancyGuard.sol +++ b/test/compilationTests/zeppelin/ReentrancyGuard.sol @@ -1,7 +1,7 @@ pragma solidity ^0.4.11; /** - * @title Helps contracts guard agains rentrancy attacks. + * @title Helps contracts guard against rentrancy attacks. * @author Remco Bloemen <remco@2π.com> * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. @@ -27,7 +27,7 @@ contract ReentrancyGuard { _; rentrancy_lock = false; } else { - throw; + revert(); } } diff --git a/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol index d4066812..98c8c3d4 100644 --- a/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/CappedCrowdsale.sol @@ -12,7 +12,7 @@ contract CappedCrowdsale is Crowdsale { uint256 public cap; - constructor(uint256 _cap) { + constructor(uint256 _cap) public { cap = _cap; } diff --git a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol index 1f148a74..51eeb7b8 100644 --- a/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/Crowdsale.sol @@ -4,11 +4,11 @@ import '../token/MintableToken.sol'; import '../math/SafeMath.sol'; /** - * @title Crowdsale + * @title Crowdsale * @dev Crowdsale is a base contract for managing a token crowdsale. * Crowdsales have a start and end block, where investors can make * token purchases and the crowdsale will assign them tokens based - * on a token per ETH rate. Funds collected are forwarded to a wallet + * on a token per ETH rate. Funds collected are forwarded to a wallet * as they arrive. */ contract Crowdsale { @@ -36,11 +36,11 @@ contract Crowdsale { * @param beneficiary who got the tokens * @param value weis paid for purchase * @param amount amount of tokens purchased - */ + */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); - constructor(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address _wallet) { + constructor(uint256 _startBlock, uint256 _endBlock, uint256 _rate, address _wallet) public { require(_startBlock >= block.number); require(_endBlock >= _startBlock); require(_rate > 0); @@ -53,7 +53,7 @@ contract Crowdsale { wallet = _wallet; } - // creates the token to be sold. + // creates the token to be sold. // override this method to have crowdsale of a specific mintable token. function createTokenContract() internal returns (MintableToken) { return new MintableToken(); @@ -66,7 +66,7 @@ contract Crowdsale { } // low level token purchase function - function buyTokens(address beneficiary) payable { + function buyTokens(address beneficiary) public payable { require(beneficiary != address(0x0)); require(validPurchase()); diff --git a/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol index 7965a66d..da4e3b7f 100644 --- a/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol @@ -18,7 +18,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable { // should be called after crowdsale ends, to do // some extra finalization work - function finalize() onlyOwner { + function finalize() public onlyOwner { require(!isFinalized); require(hasEnded()); diff --git a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol index 0be45ec4..b7db8ef2 100644 --- a/test/compilationTests/zeppelin/crowdsale/RefundVault.sol +++ b/test/compilationTests/zeppelin/crowdsale/RefundVault.sol @@ -22,31 +22,31 @@ contract RefundVault is Ownable { event RefundsEnabled(); event Refunded(address indexed beneficiary, uint256 weiAmount); - constructor(address _wallet) { + constructor(address _wallet) public { require(_wallet != address(0x0)); wallet = _wallet; state = State.Active; } - function deposit(address investor) onlyOwner payable { + function deposit(address investor) public onlyOwner payable { require(state == State.Active); deposited[investor] = deposited[investor].add(msg.value); } - function close() onlyOwner { + function close() public onlyOwner { require(state == State.Active); state = State.Closed; emit Closed(); - wallet.transfer(this.balance); + wallet.transfer(address(this).balance); } - function enableRefunds() onlyOwner { + function enableRefunds() public onlyOwner { require(state == State.Active); state = State.Refunding; emit RefundsEnabled(); } - function refund(address investor) { + function refund(address investor) public { require(state == State.Refunding); uint256 depositedValue = deposited[investor]; deposited[investor] = 0; diff --git a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol index bb6b5e17..94e3af99 100644 --- a/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/RefundableCrowdsale.sol @@ -21,7 +21,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { // refund vault used to hold funds while crowdsale is running RefundVault public vault; - constructor(uint256 _goal) { + constructor(uint256 _goal) public { vault = new RefundVault(wallet); goal = _goal; } @@ -34,7 +34,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { } // if crowdsale is unsuccessful, investors can claim refunds here - function claimRefund() { + function claimRefund() public { require(isFinalized); require(!goalReached()); diff --git a/test/compilationTests/zeppelin/lifecycle/Destructible.sol b/test/compilationTests/zeppelin/lifecycle/Destructible.sol index 00492590..5b0e9f58 100644 --- a/test/compilationTests/zeppelin/lifecycle/Destructible.sol +++ b/test/compilationTests/zeppelin/lifecycle/Destructible.sol @@ -10,16 +10,16 @@ import "../ownership/Ownable.sol"; */ contract Destructible is Ownable { - constructor() payable { } + constructor() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ - function destroy() onlyOwner { + function destroy() public onlyOwner { selfdestruct(owner); } - function destroyAndSend(address _recipient) onlyOwner { + function destroyAndSend(address _recipient) public onlyOwner { selfdestruct(_recipient); } } diff --git a/test/compilationTests/zeppelin/lifecycle/Migrations.sol b/test/compilationTests/zeppelin/lifecycle/Migrations.sol index d5b05308..4ca95d36 100644 --- a/test/compilationTests/zeppelin/lifecycle/Migrations.sol +++ b/test/compilationTests/zeppelin/lifecycle/Migrations.sol @@ -10,11 +10,11 @@ import '../ownership/Ownable.sol'; contract Migrations is Ownable { uint256 public lastCompletedMigration; - function setCompleted(uint256 completed) onlyOwner { + function setCompleted(uint256 completed) public onlyOwner { lastCompletedMigration = completed; } - function upgrade(address newAddress) onlyOwner { + function upgrade(address newAddress) public onlyOwner { Migrations upgraded = Migrations(newAddress); upgraded.setCompleted(lastCompletedMigration); } diff --git a/test/compilationTests/zeppelin/lifecycle/Pausable.sol b/test/compilationTests/zeppelin/lifecycle/Pausable.sol index 10b0fcd8..0c48f2f6 100644 --- a/test/compilationTests/zeppelin/lifecycle/Pausable.sol +++ b/test/compilationTests/zeppelin/lifecycle/Pausable.sol @@ -19,7 +19,7 @@ contract Pausable is Ownable { * @dev modifier to allow actions only when the contract IS paused */ modifier whenNotPaused() { - if (paused) throw; + if (paused) revert(); _; } @@ -27,14 +27,14 @@ contract Pausable is Ownable { * @dev modifier to allow actions only when the contract IS NOT paused */ modifier whenPaused { - if (!paused) throw; + if (!paused) revert(); _; } /** * @dev called by the owner to pause, triggers stopped state */ - function pause() onlyOwner whenNotPaused returns (bool) { + function pause() public onlyOwner whenNotPaused returns (bool) { paused = true; emit Pause(); return true; @@ -43,7 +43,7 @@ contract Pausable is Ownable { /** * @dev called by the owner to unpause, returns to normal state */ - function unpause() onlyOwner whenPaused returns (bool) { + function unpause() public onlyOwner whenPaused returns (bool) { paused = false; emit Unpause(); return true; diff --git a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol index f88a55aa..51f6b68e 100644 --- a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol +++ b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol @@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol"; */ contract TokenDestructible is Ownable { - constructor() payable { } + constructor() public payable { } /** * @notice Terminate contract and refund to owner @@ -21,7 +21,7 @@ contract TokenDestructible is Ownable { * @notice The called token contracts could try to re-enter this contract. Only supply token contracts you trust. */ - function destroy(address[] tokens) onlyOwner { + function destroy(address[] memory tokens) public onlyOwner { // Transfer tokens to owner for(uint256 i = 0; i < tokens.length; i++) { diff --git a/test/compilationTests/zeppelin/ownership/Claimable.sol b/test/compilationTests/zeppelin/ownership/Claimable.sol index 14d0ac6a..d7b48a29 100644 --- a/test/compilationTests/zeppelin/ownership/Claimable.sol +++ b/test/compilationTests/zeppelin/ownership/Claimable.sol @@ -17,7 +17,7 @@ contract Claimable is Ownable { */ modifier onlyPendingOwner() { if (msg.sender != pendingOwner) { - throw; + revert(); } _; } @@ -26,14 +26,14 @@ contract Claimable is Ownable { * @dev Allows the current owner to set the pendingOwner address. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) onlyOwner { + function transferOwnership(address newOwner) public onlyOwner { pendingOwner = newOwner; } /** * @dev Allows the pendingOwner address to finalize the transfer. */ - function claimOwnership() onlyPendingOwner { + function claimOwnership() public onlyPendingOwner { owner = pendingOwner; pendingOwner = address(0x0); } diff --git a/test/compilationTests/zeppelin/ownership/Contactable.sol b/test/compilationTests/zeppelin/ownership/Contactable.sol index 0db3ee07..5f781e13 100644 --- a/test/compilationTests/zeppelin/ownership/Contactable.sol +++ b/test/compilationTests/zeppelin/ownership/Contactable.sol @@ -15,7 +15,7 @@ contract Contactable is Ownable{ * @dev Allows the owner to set a string with their contact information. * @param info The contact information to attach to the contract. */ - function setContactInformation(string info) onlyOwner{ + function setContactInformation(string memory info) public onlyOwner{ contactInformation = info; } } diff --git a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol index 93177dc6..540a2ce0 100644 --- a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol +++ b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol @@ -20,9 +20,9 @@ contract DelayedClaimable is Claimable { * @param _start The earliest time ownership can be claimed. * @param _end The latest time ownership can be claimed. */ - function setLimits(uint256 _start, uint256 _end) onlyOwner { + function setLimits(uint256 _start, uint256 _end) public onlyOwner { if (_start > _end) - throw; + revert(); end = _end; start = _start; } @@ -32,9 +32,9 @@ contract DelayedClaimable is Claimable { * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within * the specified start and end time. */ - function claimOwnership() onlyPendingOwner { + function claimOwnership() public onlyPendingOwner { if ((block.number > end) || (block.number < start)) - throw; + revert(); owner = pendingOwner; pendingOwner = address(0x0); end = 0; diff --git a/test/compilationTests/zeppelin/ownership/HasNoEther.sol b/test/compilationTests/zeppelin/ownership/HasNoEther.sol index 8f9edc03..75d90841 100644 --- a/test/compilationTests/zeppelin/ownership/HasNoEther.sol +++ b/test/compilationTests/zeppelin/ownership/HasNoEther.sol @@ -21,9 +21,9 @@ 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. */ - constructor() payable { + constructor() public payable { if(msg.value > 0) { - throw; + revert(); } } @@ -37,8 +37,8 @@ contract HasNoEther is Ownable { * @dev Transfer all Ether held by the contract to the owner. */ function reclaimEther() external onlyOwner { - if(!owner.send(this.balance)) { - throw; + if(!owner.send(address(this).balance)) { + revert(); } } } diff --git a/test/compilationTests/zeppelin/ownership/HasNoTokens.sol b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol index d1dc4b3e..df4284f1 100644 --- a/test/compilationTests/zeppelin/ownership/HasNoTokens.sol +++ b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol @@ -19,7 +19,7 @@ contract HasNoTokens is Ownable { * @param data_ Bytes The data passed from the caller. */ function tokenFallback(address from_, uint256 value_, bytes data_) external { - throw; + revert(); } /** diff --git a/test/compilationTests/zeppelin/ownership/Multisig.sol b/test/compilationTests/zeppelin/ownership/Multisig.sol index 76c78411..25531d8d 100644 --- a/test/compilationTests/zeppelin/ownership/Multisig.sol +++ b/test/compilationTests/zeppelin/ownership/Multisig.sol @@ -24,5 +24,5 @@ contract Multisig { // TODO: document function changeOwner(address _from, address _to) external; function execute(address _to, uint256 _value, bytes _data) external returns (bytes32); - function confirm(bytes32 _h) returns (bool); + function confirm(bytes32 _h) public returns (bool); } diff --git a/test/compilationTests/zeppelin/ownership/Ownable.sol b/test/compilationTests/zeppelin/ownership/Ownable.sol index 0a2257d6..a862cb74 100644 --- a/test/compilationTests/zeppelin/ownership/Ownable.sol +++ b/test/compilationTests/zeppelin/ownership/Ownable.sol @@ -14,7 +14,7 @@ contract Ownable { * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ - constructor() { + constructor() public { owner = msg.sender; } @@ -24,7 +24,7 @@ contract Ownable { */ modifier onlyOwner() { if (msg.sender != owner) { - throw; + revert(); } _; } @@ -34,7 +34,7 @@ contract Ownable { * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ - function transferOwnership(address newOwner) onlyOwner { + function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { owner = newOwner; } diff --git a/test/compilationTests/zeppelin/ownership/Shareable.sol b/test/compilationTests/zeppelin/ownership/Shareable.sol index c954052b..0c8d16a5 100644 --- a/test/compilationTests/zeppelin/ownership/Shareable.sol +++ b/test/compilationTests/zeppelin/ownership/Shareable.sol @@ -37,7 +37,7 @@ contract Shareable { // simple single-sig function modifier. modifier onlyOwner { if (!isOwner(msg.sender)) { - throw; + revert(); } _; } @@ -59,7 +59,7 @@ contract Shareable { * @param _owners A list of owners. * @param _required The amount required for a transaction to be approved. */ - constructor(address[] _owners, uint256 _required) { + constructor(address[] memory _owners, uint256 _required) public { owners[1] = msg.sender; ownerIndex[msg.sender] = 1; for (uint256 i = 0; i < _owners.length; ++i) { @@ -68,7 +68,7 @@ contract Shareable { } required = _required; if (required > owners.length) { - throw; + revert(); } } @@ -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) view returns (bool) { + function isOwner(address _addr) public 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) view returns (bool) { + function hasConfirmed(bytes32 _operation, address _owner) public view returns (bool) { PendingState memory pending = pendings[_operation]; uint256 index = ownerIndex[_owner]; @@ -139,7 +139,7 @@ contract Shareable { uint256 index = ownerIndex[msg.sender]; // make sure they're an owner if (index == 0) { - throw; + revert(); } PendingState memory pending = pendings[_operation]; diff --git a/test/compilationTests/zeppelin/payment/PullPayment.sol b/test/compilationTests/zeppelin/payment/PullPayment.sol index ba710b53..bac1d019 100644 --- a/test/compilationTests/zeppelin/payment/PullPayment.sol +++ b/test/compilationTests/zeppelin/payment/PullPayment.sol @@ -28,23 +28,23 @@ contract PullPayment { /** * @dev withdraw accumulated balance, called by payee. */ - function withdrawPayments() { + function withdrawPayments() public { address payee = msg.sender; uint256 payment = payments[payee]; if (payment == 0) { - throw; + revert(); } - if (this.balance < payment) { - throw; + if (address(this).balance < payment) { + revert(); } totalPayments = totalPayments.sub(payment); payments[payee] = 0; if (!payee.send(payment)) { - throw; + revert(); } } } diff --git a/test/compilationTests/zeppelin/token/BasicToken.sol b/test/compilationTests/zeppelin/token/BasicToken.sol index 8a3d8ead..bc085f85 100644 --- a/test/compilationTests/zeppelin/token/BasicToken.sol +++ b/test/compilationTests/zeppelin/token/BasicToken.sol @@ -19,7 +19,7 @@ contract BasicToken is ERC20Basic { * @param _to The address to transfer to. * @param _value The amount to be transferred. */ - function transfer(address _to, uint256 _value) { + function transfer(address _to, uint256 _value) public { balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); @@ -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) view returns (uint256 balance) { + function balanceOf(address _owner) public view returns (uint256 balance) { return balances[_owner]; } diff --git a/test/compilationTests/zeppelin/token/ERC20.sol b/test/compilationTests/zeppelin/token/ERC20.sol index ae5aa624..5b5dc748 100644 --- a/test/compilationTests/zeppelin/token/ERC20.sol +++ b/test/compilationTests/zeppelin/token/ERC20.sol @@ -9,8 +9,8 @@ import './ERC20Basic.sol'; * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { - function allowance(address owner, address spender) view returns (uint256); - function transferFrom(address from, address to, uint256 value); - function approve(address spender, uint256 value); + function allowance(address owner, address spender) public view returns (uint256); + function transferFrom(address from, address to, uint256 value) public; + function approve(address spender, uint256 value) public; 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 94fb7bcf..fbe33134 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) view returns (uint256); - function transfer(address to, uint256 value); + function balanceOf(address who) public view returns (uint256); + function transfer(address to, uint256 value) public; 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 0ccd60b2..3ce928f6 100644 --- a/test/compilationTests/zeppelin/token/LimitedTransferToken.sol +++ b/test/compilationTests/zeppelin/token/LimitedTransferToken.sol @@ -23,26 +23,26 @@ contract LimitedTransferToken is ERC20 { * @dev Checks whether it can transfer or otherwise throws. */ modifier canTransfer(address _sender, uint256 _value) { - if (_value > transferableTokens(_sender, uint64(now))) throw; + if (_value > transferableTokens(_sender, uint64(now))) revert(); _; } /** * @dev Checks modifier and allows transfer if tokens are not locked. - * @param _to The address that will recieve the tokens. + * @param _to The address that will receive the tokens. * @param _value The amount of tokens to be transferred. */ - function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) { + function transfer(address _to, uint256 _value) canTransfer(msg.sender, _value) public { super.transfer(_to, _value); } /** * @dev Checks modifier and allows transfer if tokens are not locked. * @param _from The address that will send the tokens. - * @param _to The address that will recieve the tokens. + * @param _to The address that will receive the tokens. * @param _value The amount of tokens to be transferred. */ - function transferFrom(address _from, address _to, uint256 _value) canTransfer(_from, _value) { + function transferFrom(address _from, address _to, uint256 _value) public canTransfer(_from, _value) { super.transferFrom(_from, _to, _value); } diff --git a/test/compilationTests/zeppelin/token/MintableToken.sol b/test/compilationTests/zeppelin/token/MintableToken.sol index 45926afb..24b8c807 100644 --- a/test/compilationTests/zeppelin/token/MintableToken.sol +++ b/test/compilationTests/zeppelin/token/MintableToken.sol @@ -21,17 +21,17 @@ contract MintableToken is StandardToken, Ownable { modifier canMint() { - if(mintingFinished) throw; + if(mintingFinished) revert(); _; } /** * @dev Function to mint tokens - * @param _to The address that will recieve the minted tokens. + * @param _to The address that will receive the minted tokens. * @param _amount The amount of tokens to mint. * @return A boolean that indicates if the operation was successful. */ - function mint(address _to, uint256 _amount) onlyOwner canMint returns (bool) { + function mint(address _to, uint256 _amount) public onlyOwner canMint returns (bool) { totalSupply = totalSupply.add(_amount); balances[_to] = balances[_to].add(_amount); emit Mint(_to, _amount); @@ -42,7 +42,7 @@ contract MintableToken is StandardToken, Ownable { * @dev Function to stop minting new tokens. * @return True if the operation was successful. */ - function finishMinting() onlyOwner returns (bool) { + function finishMinting() public onlyOwner returns (bool) { mintingFinished = true; emit MintFinished(); return true; diff --git a/test/compilationTests/zeppelin/token/PausableToken.sol b/test/compilationTests/zeppelin/token/PausableToken.sol index 8ee114e1..66f80b80 100644 --- a/test/compilationTests/zeppelin/token/PausableToken.sol +++ b/test/compilationTests/zeppelin/token/PausableToken.sol @@ -11,11 +11,11 @@ import '../lifecycle/Pausable.sol'; contract PausableToken is StandardToken, Pausable { - function transfer(address _to, uint _value) whenNotPaused { + function transfer(address _to, uint _value) public whenNotPaused { super.transfer(_to, _value); } - function transferFrom(address _from, address _to, uint _value) whenNotPaused { + function transferFrom(address _from, address _to, uint _value) public whenNotPaused { super.transferFrom(_from, _to, _value); } } diff --git a/test/compilationTests/zeppelin/token/SimpleToken.sol b/test/compilationTests/zeppelin/token/SimpleToken.sol index a4ba9eb3..6c3f5740 100644 --- a/test/compilationTests/zeppelin/token/SimpleToken.sol +++ b/test/compilationTests/zeppelin/token/SimpleToken.sol @@ -18,9 +18,9 @@ contract SimpleToken is StandardToken { uint256 public INITIAL_SUPPLY = 10000; /** - * @dev Contructor that gives msg.sender all of existing tokens. + * @dev Constructor that gives msg.sender all of existing tokens. */ - constructor() { + constructor() public { totalSupply = INITIAL_SUPPLY; balances[msg.sender] = INITIAL_SUPPLY; } diff --git a/test/compilationTests/zeppelin/token/StandardToken.sol b/test/compilationTests/zeppelin/token/StandardToken.sol index 900a9102..56f4a5f3 100644 --- a/test/compilationTests/zeppelin/token/StandardToken.sol +++ b/test/compilationTests/zeppelin/token/StandardToken.sol @@ -21,13 +21,13 @@ contract StandardToken is ERC20, BasicToken { * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to - * @param _value uint256 the amout of tokens to be transfered + * @param _value uint256 the amount of tokens to be transferred */ - function transferFrom(address _from, address _to, uint256 _value) { + function transferFrom(address _from, address _to, uint256 _value) public { uint256 _allowance = allowed[_from][msg.sender]; // Check is not needed because sub(_allowance, _value) will already throw if this condition is not met - // if (_value > _allowance) throw; + // if (_value > _allowance) revert(); balances[_to] = balances[_to].add(_value); balances[_from] = balances[_from].sub(_value); @@ -40,13 +40,13 @@ contract StandardToken is ERC20, BasicToken { * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ - function approve(address _spender, uint256 _value) { + function approve(address _spender, uint256 _value) public { // To change the approve amount you first have to reduce the addresses` // allowance to zero by calling `approve(_spender, 0)` if it is not // already 0 to mitigate the race condition described here: // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 - if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) throw; + if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert(); allowed[msg.sender][_spender] = _value; emit Approval(msg.sender, _spender, _value); @@ -56,9 +56,9 @@ contract StandardToken is ERC20, BasicToken { * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. - * @return A uint256 specifing the amount of tokens still avaible for the spender. + * @return A uint256 specifying the amount of tokens still available for the spender. */ - function allowance(address _owner, address _spender) view returns (uint256 remaining) { + function allowance(address _owner, address _spender) public view returns (uint256 remaining) { return allowed[_owner][_spender]; } diff --git a/test/compilationTests/zeppelin/token/TokenTimelock.sol b/test/compilationTests/zeppelin/token/TokenTimelock.sol index e9f998ba..fa1af025 100644 --- a/test/compilationTests/zeppelin/token/TokenTimelock.sol +++ b/test/compilationTests/zeppelin/token/TokenTimelock.sol @@ -19,7 +19,7 @@ contract TokenTimelock { // timestamp when token release is enabled uint releaseTime; - constructor(ERC20Basic _token, address _beneficiary, uint _releaseTime) { + constructor(ERC20Basic _token, address _beneficiary, uint _releaseTime) public { require(_releaseTime > now); token = _token; beneficiary = _beneficiary; @@ -29,7 +29,7 @@ contract TokenTimelock { /** * @dev beneficiary claims tokens held by time lock */ - function claim() { + function claim() public { require(msg.sender == beneficiary); require(now >= releaseTime); diff --git a/test/compilationTests/zeppelin/token/VestedToken.sol b/test/compilationTests/zeppelin/token/VestedToken.sol index 3953612d..ca13b638 100644 --- a/test/compilationTests/zeppelin/token/VestedToken.sol +++ b/test/compilationTests/zeppelin/token/VestedToken.sol @@ -46,10 +46,10 @@ contract VestedToken is StandardToken, LimitedTransferToken { // Check for date inconsistencies that may cause unexpected behavior if (_cliff < _start || _vesting < _cliff) { - throw; + revert(); } - if (tokenGrantsCount(_to) > MAX_GRANTS_PER_ADDRESS) throw; // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting). + if (tokenGrantsCount(_to) > MAX_GRANTS_PER_ADDRESS) revert(); // To prevent a user being spammed and have his balance locked (out of gas attack when calculating vesting). uint256 count = grants[_to].push( TokenGrant( @@ -69,19 +69,19 @@ contract VestedToken is StandardToken, LimitedTransferToken { } /** - * @dev Revoke the grant of tokens of a specifed address. + * @dev Revoke the grant of tokens of a specified address. * @param _holder The address which will have its tokens revoked. * @param _grantId The id of the token grant. */ function revokeTokenGrant(address _holder, uint256 _grantId) public { - TokenGrant grant = grants[_holder][_grantId]; + TokenGrant storage grant = grants[_holder][_grantId]; if (!grant.revokable) { // Check if grant was revokable - throw; + revert(); } if (grant.granter != msg.sender) { // Only granter can revoke it - throw; + revert(); } address receiver = grant.burnsOnRevoke ? 0xdead : msg.sender; @@ -130,18 +130,18 @@ 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) view returns (uint256 index) { + function tokenGrantsCount(address _holder) public view returns (uint256 index) { return grants[_holder].length; } /** - * @dev Calculate amount of vested tokens at a specifc time. - * @param tokens uint256 The amount of tokens grantted. + * @dev Calculate amount of vested tokens at a specific time. + * @param tokens uint256 The amount of tokens granted. * @param time uint64 The time to be checked - * @param start uint64 A time representing the begining of the grant + * @param start uint64 A time representing the beginning of the grant * @param cliff uint64 The cliff period. * @param vesting uint64 The vesting period. - * @return An uint256 representing the amount of vested tokensof a specif grant. + * @return An uint256 representing the amount of vested tokens of a specific grant. * transferableTokens * | _/-------- vestedTokens rect * | _/ @@ -163,7 +163,7 @@ contract VestedToken is StandardToken, LimitedTransferToken { uint256 time, uint256 start, uint256 cliff, - uint256 vesting) view returns (uint256) + uint256 vesting) public view returns (uint256) { // Shortcuts for before cliff and after vesting cases. if (time < cliff) return 0; @@ -186,14 +186,14 @@ contract VestedToken is StandardToken, LimitedTransferToken { } /** - * @dev Get all information about a specifc grant. + * @dev Get all information about a specific grant. * @param _holder The address which will have its tokens revoked. * @param _grantId The id of the token grant. * @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) view returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { - TokenGrant grant = grants[_holder][_grantId]; + function tokenGrant(address _holder, uint256 _grantId) public view returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) { + TokenGrant storage grant = grants[_holder][_grantId]; granter = grant.granter; value = grant.value; @@ -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 view returns (uint256) { + function vestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) { return calculateVestedTokens( grant.value, uint256(time), @@ -226,10 +226,10 @@ contract VestedToken is StandardToken, LimitedTransferToken { * @dev Calculate the amount of non vested tokens at a specific time. * @param grant TokenGrant The grant to be checked. * @param time uint64 The time to be checked - * @return An uint256 representing the amount of non vested tokens of a specifc grant on the + * @return An uint256 representing the amount of non vested tokens of a specific grant on the * passed time frame. */ - function nonVestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) { + function nonVestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) { return grant.value.sub(vestedTokens(grant, time)); } |