diff options
43 files changed, 792 insertions, 792 deletions
diff --git a/test/compilationTests/corion/announcementTypes.sol b/test/compilationTests/corion/announcementTypes.sol index f31d580e..94f4a9dc 100644 --- a/test/compilationTests/corion/announcementTypes.sol +++ b/test/compilationTests/corion/announcementTypes.sol @@ -1,35 +1,35 @@ -pragma solidity ^0.4.11;
-
-contract announcementTypes {
-
- enum announcementType {
- /*
- type of announcements
- */
- newModule,
- dropModule,
- replaceModule,
- replaceModuleHandler,
- question,
- transactionFeeRate,
- transactionFeeMin,
- transactionFeeMax,
- transactionFeeBurn,
- providerPublicFunds,
- providerPrivateFunds,
- providerPrivateClientLimit,
- providerPublicMinRate,
- providerPublicMaxRate,
- providerPrivateMinRate,
- providerPrivateMaxRate,
- providerGasProtect,
- providerInterestMinFunds,
- providerRentRate,
- schellingRoundBlockDelay,
- schellingCheckRounds,
- schellingCheckAboves,
- schellingRate,
- publisherMinAnnouncementDelay,
- publisherOppositeRate
- }
+pragma solidity ^0.4.11; + +contract announcementTypes { + + enum announcementType { + /* + type of announcements + */ + newModule, + dropModule, + replaceModule, + replaceModuleHandler, + question, + transactionFeeRate, + transactionFeeMin, + transactionFeeMax, + transactionFeeBurn, + providerPublicFunds, + providerPrivateFunds, + providerPrivateClientLimit, + providerPublicMinRate, + providerPublicMaxRate, + providerPrivateMinRate, + providerPrivateMaxRate, + providerGasProtect, + providerInterestMinFunds, + providerRentRate, + schellingRoundBlockDelay, + schellingCheckRounds, + schellingCheckAboves, + schellingRate, + publisherMinAnnouncementDelay, + publisherOppositeRate + } }
\ No newline at end of file diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol index 2f60e0fe..b1e0bf75 100644 --- a/test/compilationTests/corion/ico.sol +++ b/test/compilationTests/corion/ico.sol @@ -6,7 +6,7 @@ import "./premium.sol"; import "./moduleHandler.sol"; contract ico is safeMath { - + struct icoLevels_s { uint256 block; uint8 rate; @@ -24,9 +24,9 @@ contract ico is safeMath { uint256 cor; uint256 corp; } - + uint256 constant oneSegment = 40320; - + address public owner; address public tokenAddr; address public premiumAddr; @@ -53,7 +53,7 @@ contract ico is safeMath { constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public { /* Installation function. - + @foundation The ETC address of the foundation @priceSet The address which will be able to make changes on the rate later on. @exchangeRate The current ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000 @@ -80,11 +80,11 @@ contract ico is safeMath { interestDB[genesisAddr[a]][0].amount = genesisValue[a]; } } - + function ICObonus() public view returns(uint256 bonus) { /* Query of current bonus - + @bonus Bonus % */ for ( uint8 a=0 ; a<icoLevels.length ; a++ ) { @@ -93,32 +93,32 @@ contract ico is safeMath { } } } - + function setInterestDB(address addr, uint256 balance) external returns(bool success) { /* Setting interest database. It can be requested by Token contract only. - A database has to be built in order that after ICO closed everybody can get their compound interest on their capital accumulated - + A database has to be built in order that after ICO closed everybody can get their compound interest on their capital accumulated + @addr Sender @balance Quantity - + @success Was the process successful or not */ require( msg.sender == tokenAddr ); uint256 _num = (block.number - startBlock) / interestBlockDelay; interestDB[addr][_num].amount = balance; - if ( balance == 0 ) { + if ( balance == 0 ) { interestDB[addr][_num].empty = true; } return true; } - + function checkInterest(address addr) public view returns(uint256 amount) { /* Query of compound interest - + @addr Address - + @amount Amount of compound interest */ uint256 _lastBal; @@ -126,9 +126,9 @@ contract ico is safeMath { bool _empty; interest_s memory _idb; uint256 _to = (block.number - startBlock) / interestBlockDelay; - + if ( _to == 0 || aborted ) { return 0; } - + for ( uint256 r=0 ; r < _to ; r++ ) { if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; } _idb = interestDB[addr][r]; @@ -148,11 +148,11 @@ contract ico is safeMath { amount += _tamount; } } - + function getInterest(address beneficiary) external { /* Request of compound interest. This is deleted from the database after the ICO closed and following the query of the compound interest. - + @beneficiary Beneficiary who will receive the interest */ uint256 _lastBal; @@ -163,10 +163,10 @@ contract ico is safeMath { address _addr = beneficiary; uint256 _to = (block.number - startBlock) / interestBlockDelay; if ( _addr == address(0x00) ) { _addr = msg.sender; } - + require( block.number > icoDelay ); require( ! aborted ); - + for ( uint256 r=0 ; r < _to ; r++ ) { if ( r*interestBlockDelay+startBlock >= icoDelay ) { break; } _idb = interestDB[msg.sender][r]; @@ -186,17 +186,17 @@ contract ico is safeMath { _amount += _tamount; delete interestDB[msg.sender][r]; } - + require( _amount > 0 ); token(tokenAddr).mint(_addr, _amount); } - + function setICOEthPrice(uint256 value) external { /* - Setting of the ICO ETC USD rates which can only be calle by a pre-defined address. + Setting of the ICO ETC USD rates which can only be calle by a pre-defined address. After this function is completed till the call of the next function (which is at least an exchangeRateDelay array) this rate counts. With this process avoiding the sudden rate changes. - + @value The ETC/USD rate multiplied by 1e4. For example: 2.5 USD/ETC = 25000 */ require( isICO() ); @@ -205,18 +205,18 @@ contract ico is safeMath { icoExchangeRateSetBlock = block.number + exchangeRateDelay; icoExchangeRate = value; } - + function extendICO() external { /* Extend the period of the ICO with one segment. - + It is only possible during the ICO and only callable by the owner. */ require( isICO() ); require( msg.sender == owner ); icoDelay += oneSegment; } - + function closeICO() external { /* Closing the ICO. @@ -235,10 +235,10 @@ contract ico is safeMath { require( token(tokenAddr).closeIco() ); require( premium(premiumAddr).closeIco() ); } - + function abortICO() external { /* - Withdrawal of the ICO. + Withdrawal of the ICO. It is only possible during the ICO period. Only callable by the owner. After this process only the receiveFunds function will be available for the customers. @@ -247,12 +247,12 @@ contract ico is safeMath { require( msg.sender == owner ); aborted = true; } - + function connectTokens(address tokenContractAddr, address premiumContractAddr) external { /* Installation function which joins the two token contracts with this contract. Only callable by the owner - + @tokenContractAddr Address of the corion token contract. @premiumContractAddr Address of the corion premium token contract */ @@ -261,7 +261,7 @@ contract ico is safeMath { tokenAddr = tokenContractAddr; premiumAddr = premiumContractAddr; } - + function receiveFunds() external { /* Refund the amount which was purchased during the ICO period. @@ -274,7 +274,7 @@ contract ico is safeMath { delete brought[msg.sender]; require( msg.sender.send(_val) ); } - + function () external payable { /* Callback function. Simply calls the buy function as a beneficiary and there is no affiliate address. @@ -287,7 +287,7 @@ contract ico is safeMath { 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 affiliate address is valid which has some token on it’s account. @@ -327,7 +327,7 @@ contract ico is safeMath { rate = 4; } else if (extra >= 1e10) { rate = 3; - } else if (extra >= 1e9) { + } else if (extra >= 1e9) { rate = 2; } else { rate = 1; @@ -344,7 +344,7 @@ contract ico is safeMath { function checkPremium(address owner) internal { /* 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 divided by 5000. So after each 5000 token we give 1 premium token. */ uint256 _reward = (brought[owner].cor / 5e9) - brought[owner].corp; @@ -354,11 +354,11 @@ contract ico is safeMath { totalPremiumMint = safeAdd(totalPremiumMint, _reward); } } - + function getIcoReward(uint256 value) public view returns (uint256 reward) { /* Expected token volume at token purchase - + @value The amount of ether for the purchase @reward Amount of the token x = (value * 1e6 * USD_ETC_exchange rate / 1e4 / 1e18) * bonus percentage @@ -367,10 +367,10 @@ contract ico is safeMath { reward = (value * 1e6 * icoExchangeRate / icoExchangeRateM / 1 ether) * (ICObonus() + 100) / 100; if ( reward < 5e6) { return 0; } } - + function isICO() public view returns (bool success) { return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed ); } - + 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 e0084ea5..da4dd344 100644 --- a/test/compilationTests/corion/module.sol +++ b/test/compilationTests/corion/module.sol @@ -9,18 +9,18 @@ contract module { /* Module */ - + enum status { New, Connected, Disconnected, Disabled } - + status public moduleStatus; uint256 public disabledUntil; address public moduleHandlerAddress; - + function disableModule(bool forever) external onlyForModuleHandler returns (bool success) { _disableModule(forever); return true; @@ -29,13 +29,13 @@ contract module { /* Disable the module for one week, if the forever true then for forever. This function calls the Publisher module. - + @forever For forever or not */ if ( forever ) { moduleStatus = status.Disabled; } else { disabledUntil = block.number + 5760; } } - + function replaceModuleHandler(address newModuleHandlerAddress) external onlyForModuleHandler returns (bool success) { _replaceModuleHandler(newModuleHandlerAddress); return true; @@ -44,13 +44,13 @@ contract module { /* Replace the ModuleHandler address. This function calls the Publisher module. - + @newModuleHandlerAddress New module handler address */ require( moduleStatus == status.Connected ); moduleHandlerAddress = newModuleHandlerAddress; } - + function connectModule() external onlyForModuleHandler returns (bool success) { _connectModule(); return true; @@ -63,7 +63,7 @@ contract module { require( moduleStatus == status.New ); moduleStatus = status.Connected; } - + function disconnectModule() external onlyForModuleHandler returns (bool success) { _disconnectModule(); return true; @@ -76,7 +76,7 @@ contract module { require( moduleStatus != status.New && moduleStatus != status.Disconnected ); moduleStatus = status.Disconnected; } - + function replaceModule(address newModuleAddress) external onlyForModuleHandler returns (bool success) { _replaceModule(newModuleAddress); return true; @@ -86,7 +86,7 @@ contract module { Replace the module for an another new module. This function calls the Publisher module. We send every Token and ether to the new module. - + @newModuleAddress New module handler address */ require( moduleStatus != status.New && moduleStatus != status.Disconnected); @@ -100,14 +100,14 @@ contract module { } moduleStatus = status.Disconnected; } - + function transferEvent(address from, address to, uint256 value) external onlyForModuleHandler returns (bool success) { return true; } function newSchellingRoundEvent(uint256 roundID, uint256 reward) external onlyForModuleHandler returns (bool success) { return true; } - + function registerModuleHandler(address _moduleHandlerAddress) internal { /* Module constructor function for registering ModuleHandler address. @@ -118,9 +118,9 @@ contract module { /* Test for ModuleHandler address. If the module is not connected then returns always false. - + @addr Address to check - + @ret This is the module handler address or not */ if ( moduleHandlerAddress == address(0x00) ) { return true; } @@ -130,7 +130,7 @@ contract module { function isActive() public view returns (bool success, bool active) { /* Check self for ready for functions or not. - + @success Function call was successful or not @active Ready for functions or not */ diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol index ce53114b..5628f657 100644 --- a/test/compilationTests/corion/moduleHandler.sol +++ b/test/compilationTests/corion/moduleHandler.sol @@ -23,14 +23,14 @@ contract abstractModule { } contract moduleHandler is multiOwner, announcementTypes { - + struct modules_s { address addr; bytes32 name; bool schellingEvent; bool transferEvent; } - + modules_s[] public modules; address public foundationAddress; uint256 debugModeUntil = block.number + 1000000; @@ -40,10 +40,10 @@ contract moduleHandler is multiOwner, announcementTypes { function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public { /* Loading modulest to ModuleHandler. - + This module can be called only once and only by the owner, if every single module and its database are already put on the blockchain. If forReaplace is true, than the ModuleHandler will be replaced. Before the publishing of its replace, the new contract must be already on the blockchain. - + @foundation Address of foundation. @forReplace Is it for replace or not. If not, it will be connected to the module. @Token address of token. @@ -64,7 +64,7 @@ contract moduleHandler is multiOwner, announcementTypes { /* Inside function for registration of the modules in the database. If the call is false, won't happen any direct call. - + @input _Structure of module. @call Is connect to the module or not. */ @@ -84,7 +84,7 @@ contract moduleHandler is multiOwner, announcementTypes { 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. @@ -97,7 +97,7 @@ contract moduleHandler is multiOwner, announcementTypes { function getModuleIDByHash(bytes32 hashOfName) public view returns( bool success, bool found, uint256 id ) { /* Search by hash of name in the module array. The result is an index array. - + @name Name of module. @id Index of module. @found Was there any result or not. @@ -112,7 +112,7 @@ contract moduleHandler is multiOwner, announcementTypes { 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. - + @name Name of module. @id Index of module. @found Was there any result or not. @@ -128,7 +128,7 @@ contract moduleHandler is multiOwner, announcementTypes { function getModuleIDByAddress(address addr) public view returns( bool success, bool found, uint256 id ) { /* Search by ethereum address for module. The result is an index array. - + @name Name of module. @id Index of module. @found Was there any result or not. @@ -143,7 +143,7 @@ contract moduleHandler is multiOwner, announcementTypes { function replaceModule(string name, address addr, bool callCallback) external returns (bool success) { /* Module replace, can be called only by the Publisher contract. - + @name Name of module. @addr Address of module. @bool Was there any result or not. @@ -166,7 +166,7 @@ contract moduleHandler is multiOwner, announcementTypes { modules[_id].addr = addr; return true; } - + function callReplaceCallback(string moduleName, address newModule) external returns (bool success) { require( block.number < debugModeUntil ); if ( ! insertAndCheckDo(calcDoHash("callReplaceCallback", keccak256(abi.encodePacked(moduleName, newModule)))) ) { @@ -181,7 +181,7 @@ contract moduleHandler is multiOwner, announcementTypes { 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. - + @name Name of module. @addr Address of module. @schellingEvent Gets it new Schelling round notification? @@ -202,7 +202,7 @@ contract moduleHandler is multiOwner, announcementTypes { function dropModule(string name, bool callCallback) external returns (bool success) { /* Deleting module from the database. Can be called only by the Publisher contract. - + @name Name of module to delete. @bool Was the function successful? @callCallback Call the replaceable module to confirm replacement or not. @@ -223,7 +223,7 @@ contract moduleHandler is multiOwner, announcementTypes { delete modules[_id]; return true; } - + function callDisableCallback(string moduleName) external returns (bool success) { require( block.number < debugModeUntil ); if ( ! insertAndCheckDo(calcDoHash("callDisableCallback", keccak256(bytes(moduleName)))) ) { @@ -234,14 +234,14 @@ contract moduleHandler is multiOwner, announcementTypes { require( abstractModule(modules[_id].addr).disableModule(true) ); return true; } - + function broadcastTransfer(address from, address to, uint256 value) external returns (bool success) { /* Announcing transactions for the modules. - + Can be called only by the token module. Only the configured modules get notifications.( transferEvent ) - + @from from who. @to to who. @value amount. @@ -261,7 +261,7 @@ contract moduleHandler is multiOwner, announcementTypes { Announcing new Schelling round for the modules. Can be called only by the Schelling module. Only the configured modules get notifications( schellingEvent ). - + @roundID Number of Schelling round. @reward Coin emission in this Schelling round. @bool Was the function successful? @@ -278,10 +278,10 @@ contract moduleHandler is multiOwner, announcementTypes { function replaceModuleHandler(address newHandler) external returns (bool success) { /* Replacing ModuleHandler. - + Can be called only by the publisher. Every module will be informed about the ModuleHandler replacement. - + @newHandler Address of the new ModuleHandler. @bool Was the function successful? */ @@ -301,7 +301,7 @@ contract moduleHandler is multiOwner, announcementTypes { function balanceOf(address owner) public view returns (bool success, uint256 value) { /* Query of token balance. - + @owner address @value balance. @success was the function successful? @@ -313,7 +313,7 @@ contract moduleHandler is multiOwner, announcementTypes { function totalSupply() public view returns (bool success, uint256 value) { /* Query of the whole token amount. - + @value amount. @success was the function successful? */ @@ -324,7 +324,7 @@ contract moduleHandler is multiOwner, announcementTypes { function isICO() public view returns (bool success, bool ico) { /* Query of ICO state - + @ico Is ICO in progress?. @success was the function successful? */ @@ -335,7 +335,7 @@ contract moduleHandler is multiOwner, announcementTypes { function getCurrentSchellingRoundID() public view returns (bool success, uint256 round) { /* Query of number of the actual Schelling round. - + @round Schelling round. @success was the function successful? */ @@ -346,10 +346,10 @@ contract moduleHandler is multiOwner, announcementTypes { function mint(address to, uint256 value) external returns (bool success) { /* Token emission request. Can be called only by the provider. - + @to Place of new token @value Token amount - + @success Was the function successful? */ (bool _success, bool _found, uint256 _id) = getModuleIDByAddress(msg.sender); @@ -362,7 +362,7 @@ contract moduleHandler is multiOwner, announcementTypes { function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) { /* Token transaction request. Can be called only by a module. - + @from from who. @to To who. @value Token amount. @@ -379,7 +379,7 @@ contract moduleHandler is multiOwner, announcementTypes { function processTransactionFee(address from, uint256 value) external returns (bool success) { /* Token transaction fee. Can be called only by the provider. - + @from From who. @value Token amount. @success Was the function successful? @@ -394,7 +394,7 @@ contract moduleHandler is multiOwner, announcementTypes { function burn(address from, uint256 value) external returns (bool success) { /* Token burn. Can be called only by Schelling. - + @from From who. @value Token amount. @success Was the function successful? @@ -409,7 +409,7 @@ contract moduleHandler is multiOwner, announcementTypes { function configureModule(string moduleName, announcementType aType, uint256 value) external returns (bool success) { /* Changing configuration of a module. Can be called only by Publisher or while debug mode by owners. - + @moduleName Module name which will be configured @aType Type of variable (announcementType). @value New value @@ -432,14 +432,14 @@ contract moduleHandler is multiOwner, announcementTypes { /* Freezing CORION Platform. Can be called only by the owner. Freeze can not be recalled! - + @forever Is it forever or not? */ require( owners[msg.sender] ); if ( forever ) { if ( ! insertAndCheckDo(calcDoHash("freezing", keccak256(abi.encodePacked(forever)))) ) { return; - } + } } for ( uint256 a=0 ; a<modules.length ; a++ ) { require( abstractModule(modules[a].addr).disableModule(forever) ); diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol index ecc51ac3..efda554a 100644 --- a/test/compilationTests/corion/multiOwner.sol +++ b/test/compilationTests/corion/multiOwner.sol @@ -3,12 +3,12 @@ pragma solidity ^0.4.11; import "./safeMath.sol"; contract multiOwner is safeMath { - + mapping(address => bool) public owners; uint256 public ownerCount; mapping(bytes32 => address[]) public doDB; - + /* Constructor */ diff --git a/test/compilationTests/corion/owned.sol b/test/compilationTests/corion/owned.sol index 4a5ba673..f5a11c44 100644 --- a/test/compilationTests/corion/owned.sol +++ b/test/compilationTests/corion/owned.sol @@ -1,28 +1,28 @@ -pragma solidity ^0.4.11;
-
-contract ownedDB {
- address private owner;
-
- function replaceOwner(address newOwner) external returns(bool) {
- /*
- Owner replace.
-
- @newOwner Address of new owner.
- */
- require( isOwner() );
- owner = newOwner;
- return true;
- }
-
- function isOwner() internal returns(bool) {
- /*
- Check of owner address.
-
- @bool Owner has called the contract or not
- */
- if ( owner == address(0x00) ) {
- return true;
- }
- return owner == msg.sender;
- }
-}
+pragma solidity ^0.4.11; + +contract ownedDB { + address private owner; + + function replaceOwner(address newOwner) external returns(bool) { + /* + Owner replace. + + @newOwner Address of new owner. + */ + require( isOwner() ); + owner = newOwner; + return true; + } + + function isOwner() internal returns(bool) { + /* + Check of owner address. + + @bool Owner has called the contract or not + */ + if ( owner == address(0x00) ) { + return true; + } + return owner == msg.sender; + } +} diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol index 31b492f1..65895f33 100644 --- a/test/compilationTests/corion/premium.sol +++ b/test/compilationTests/corion/premium.sol @@ -20,7 +20,7 @@ contract premium is module, safeMath { } modifier isReady { (bool _success, bool _active) = super.isActive(); - require( _success && _active ); + require( _success && _active ); _; } /** @@ -29,22 +29,22 @@ contract premium is module, safeMath { * @author iFA @ Corion Platform * */ - + string public name = "Corion Premium"; string public symbol = "CORP"; uint8 public decimals = 0; - + address public icoAddr; tokenDB public db; bool public isICO; - + mapping(address => bool) public genesis; 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. - + @forReplace This address will be replaced with the old one or not. @moduleHandler Modulhandler’s address @dbAddress Address of database @@ -67,18 +67,18 @@ contract premium is module, safeMath { } } } - + function closeIco() external returns (bool success) { /* Finishing the ICO. Can be invited only by an ICO contract. - + @success If the function was successful. */ require( isICO ); isICO = false; return true; } - + /** * @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf. * @param spender The address of the account able to transfer the tokens @@ -88,18 +88,18 @@ contract premium is module, safeMath { */ function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) { /* - Authorize another address to use an exact amount of the principal’s balance. - + Authorize another address to use an exact amount of the principal’s balance. + @spender Address of authorised party @amount Token quantity @nonce Transaction count - + @success Was the Function successful? */ _approve(spender, amount, nonce); return true; } - + /** * @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data. * @param spender The address of the account able to transfer the tokens @@ -112,24 +112,24 @@ contract premium is module, safeMath { /* Authorize another address to use an exact amount of the principal’s balance. After the transaction the approvedCorionPremiumToken function of the address will be called with the given data. - + @spender Authorized address @amount Token quantity @extraData Extra data to be received by the receiver @nonce Transaction count - + @success Was the Function successful? */ _approve(spender, amount, nonce); require( thirdPartyPContractAbstract(spender).approvedCorionPremiumToken(msg.sender, amount, extraData) ); return true; } - + function _approve(address spender, uint256 amount, uint256 nonce) isReady internal { /* - Inner function to authorize another address to use an exact amount of the principal’s balance. + Inner function to authorize another address to use an exact amount of the principal’s balance. If the transaction count not match the authorise fails. - + @spender Address of authorised party @amount Token quantity @nonce Transaction count @@ -143,10 +143,10 @@ contract premium is module, safeMath { function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used - + @owner Authorising address @spender Authorised address - + @remaining Tokens to be spent @nonce Transaction count */ @@ -154,7 +154,7 @@ contract premium is module, safeMath { require( _success ); return (_remaining, _nonce); } - + /** * @notice Send `amount` Corion tokens to `to` from `msg.sender` * @param to The address of the recipient @@ -166,10 +166,10 @@ contract premium is module, safeMath { Launch a transaction where the token is sent from the sender’s address to the receiver’s address. Transaction fee is going to be added as well. If the receiver is not a natural address but also a person then she/he will be invited as well. - + @to For who @amount Amount - + @success Was the function successful? */ bytes memory _data; @@ -181,7 +181,7 @@ contract premium is module, safeMath { emit Transfer(msg.sender, to, amount, _data); return true; } - + /** * @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from` * @param from The address holding the tokens being transferred @@ -194,11 +194,11 @@ contract premium is module, safeMath { Launch a transaction where we transfer from a given address to another one. It can only be called by an address which was allowed before. Transaction fee will be charged too. If the receiver is not a natural address but also a person then she/he will be invited as well - + @from From who? @to For who? @amount Amount - + @success If the function was successful. */ if ( from != msg.sender ) { @@ -218,7 +218,7 @@ contract premium is module, safeMath { emit Transfer(from, to, amount, _data); return true; } - + /** * @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data * @param to The contract address of the recipient @@ -230,11 +230,11 @@ contract premium is module, safeMath { /* Launch a transaction where we transfer from a given address to another one. After thetransaction the approvedCorionPremiumToken function of the receiver’s address is going to be called with the given data. - + @to For who? @amount Amount @extraData Extra data that will be given to the receiver - + @success If the function was successful. */ if ( isContract(to) ) { @@ -245,11 +245,11 @@ contract premium is module, safeMath { emit Transfer(msg.sender, to, amount, extraData); return true; } - + function transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal { /* Inner function in order to transact a contract. - + @to For who? @amount Amount @extraData Extra data that will be given to the receiver @@ -262,13 +262,13 @@ contract premium is module, safeMath { _transfer(to, from, _back); } } - + function _transfer(address from, address to, uint256 amount) isReady internal { /* Inner function to launch a transaction. During the ICO transactions are only possible from the genesis address. 0xa636a97578d26a3b76b060bbc18226d954cf3757 address is blacklisted. - + @from From how? @to For who? @amount Amount @@ -278,38 +278,38 @@ contract premium is module, safeMath { require( db.decrease(from, amount) ); require( db.increase(to, amount) ); } - + function mint(address owner, uint256 value) external returns (bool success) { /* Generating tokens. It can be called only by ICO contract. - + @owner Address @value Amount. - + @success Was the Function successful? */ require( msg.sender == icoAddr || isICO ); _mint(owner, value); return true; } - + function _mint(address owner, uint256 value) isReady internal { /* Inner function to create a token. - + @owner Address of crediting the token. @value Amount */ require( db.increase(owner, value) ); emit Mint(owner, value); } - + function isContract(address addr) internal returns (bool success) { /* Inner function in order to check if the given address is a natural address or a contract. - + @addr The address which is needed to be checked. - + @success Is the address crontact or not */ uint256 _codeLength; @@ -322,7 +322,7 @@ contract premium is module, safeMath { function balanceOf(address owner) public view returns (uint256 value) { /* Token balance query - + @owner Address @value Balance of address */ @@ -332,12 +332,12 @@ contract premium is module, safeMath { function totalSupply() public view returns (uint256 value) { /* Total token quantity query - + @value Total token quantity */ return db.totalSupply(); } - + event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value); event Mint(address indexed addr, uint256 indexed value); event Burn(address indexed addr, uint256 indexed value); diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol index 7d1e04e3..a4ee4a48 100644 --- a/test/compilationTests/corion/provider.sol +++ b/test/compilationTests/corion/provider.sol @@ -20,7 +20,7 @@ contract provider is module, safeMath, announcementTypes { /* 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? @to For who? @value amount @@ -36,9 +36,9 @@ 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 transferred from this contract. - + @roundID Number of the schelling round. - @reward token emission + @reward token emission @bool Was the function successful? */ require( super.isModuleHandler(msg.sender) ); @@ -50,7 +50,7 @@ contract provider is module, safeMath, announcementTypes { } modifier isReady { (bool _success, bool _active) = super.isActive(); - require( _success && _active ); + require( _success && _active ); _; } /* @@ -98,13 +98,13 @@ contract provider is module, safeMath, announcementTypes { uint256 currentHeight; } mapping(address => _providers) private providers; - + struct _globalFunds { uint256 reward; uint256 supply; } mapping(uint256 => _globalFunds) private globalFunds; - + struct _client{ address providerAddress; uint256 providerHeight; @@ -115,13 +115,13 @@ contract provider is module, safeMath, announcementTypes { uint256 paidUpTo; } mapping(address => _client) private clients; - + uint256 private currentSchellingRound = 1; constructor(address _moduleHandler) public { /* Install function. - + @_moduleHandler Address of the moduleHandler. */ super.registerModuleHandler(_moduleHandler); @@ -129,7 +129,7 @@ contract provider is module, safeMath, announcementTypes { function configure(announcementType a, uint256 b) external returns(bool) { /* Configuration of the provider. Can be invited just by the moduleHandler. - + @a Type of the setting @b value */ @@ -150,7 +150,7 @@ contract provider is module, safeMath, announcementTypes { function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) { /* Collecting the datas of the client. - + @addr Address of the client. @schellingRound Number of the schelling round. If it is not defined then the current one. @ProviderAddress Address of the provider the one where connected to @@ -173,9 +173,9 @@ contract provider is module, safeMath, announcementTypes { the share from the token emission. In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission. The provider’s account counts as a capital for the emission as well. - + @value amount of the connected capital - @priv Is the provider private or not? + @priv Is the provider private or not? @bool Gets the share from the token emission. */ if ( priv ) { @@ -187,8 +187,8 @@ contract provider is module, safeMath, announcementTypes { /* It checks if the provider has enough connected captital to be able to get from the token emission. In case the provider is not able to get the share from the token emission then the connected capital will not count to the value of the globalFunds, to the current schelling round. - - @oldValue old + + @oldValue old @newValue new @priv Is the provider private? */ @@ -205,12 +205,12 @@ contract provider is module, safeMath, announcementTypes { function checkCorrectRate(bool priv, uint8 rate) internal returns(bool) { /* Inner function which checks if the amount of interest what is given by the provider is fits to the criteria. - + @priv Is the provider private or not? @rate Percentage/rate of the interest @bool Correct or not? */ - return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) || + return ( ! priv && ( rate >= publicMinRate && rate <= publicMaxRate ) ) || ( priv && ( rate >= privateMinRate && rate <= privateMaxRate ) ); } function createProvider(bool priv, string name, string website, string country, string info, uint8 rate, bool isForRent, address admin) isReady external { @@ -222,7 +222,7 @@ contract provider is module, safeMath, announcementTypes { For opening, has to have enough capital. All the functions of the provider except of the closing are going to be handled by the admin. The provider can be start as a rent as well, in this case the isForRent has to be true/correct. In case it runs as a rent the 20% of the profit will belong to the leser and the rest goes to the admin. - + @priv Privat szolgaltato e. Is private provider? @name Provider’s name. @website Provider’s website @@ -241,7 +241,7 @@ contract provider is module, safeMath, announcementTypes { require( getTokenBalance(msg.sender) >= minFundsForPublic ); } require( checkCorrectRate(priv, rate) ); - + providers[msg.sender].currentHeight++; uint256 currHeight = providers[msg.sender].currentHeight; providers[msg.sender].data[currHeight].valid = true; @@ -276,10 +276,10 @@ contract provider is module, safeMath, announcementTypes { This can only be invited by the provider’s admin. The emission rate is only valid for the next schelling round for this one it is not. The admin can only be changed by the address of the provider. - + @addr Address of the provider. @website Website. - @admin The new address of the admin. If we do not want to set it then we should enter 0X00. + @admin The new address of the admin. If we do not want to set it then we should enter 0X00. @country Country @info Short intro. @rate Rate of the emission what will be given to the client. @@ -303,7 +303,7 @@ contract provider is module, safeMath, announcementTypes { /* for the infos of the provider. In case the height is unknown then the system will use the last known height. - + @addr Addr of the provider @height Height @name Name of the provider. @@ -348,7 +348,7 @@ contract provider is module, safeMath, announcementTypes { function getProviderCurrentSupply(address addr) internal view returns (uint256) { /* Inner function for polling the current height and the current quantity of the connected capital of the schelling round. - + @addr Provider’s address. @uint256 Amount of the connected capital */ @@ -363,7 +363,7 @@ contract provider is module, safeMath, announcementTypes { uint256 currHeight = providers[msg.sender].currentHeight; require( providers[msg.sender].data[currHeight].valid ); require( providers[msg.sender].data[currHeight].paidUpTo == currentSchellingRound ); - + providers[msg.sender].data[currHeight].valid = false; providers[msg.sender].data[currHeight].close = currentSchellingRound; setRightForInterest(getProviderCurrentSupply(msg.sender), 0, providers[msg.sender].data[currHeight].priv); @@ -373,8 +373,8 @@ 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 permitted. - + With this kind of call only 100 address can be permitted. + @addr Array of the addresses for whom the connection is allowed. */ uint256 currHeight = providers[provider].currentHeight; @@ -382,7 +382,7 @@ contract provider is module, safeMath, announcementTypes { require( providers[provider].data[currHeight].priv ); require( providers[provider].data[currHeight].admin == msg.sender ); require( addr.length <= 100 ); - + for ( uint256 a=0 ; a<addr.length ; a++ ) { providers[provider].data[currHeight].allowedUsers[addr[a]] = true; } @@ -391,8 +391,8 @@ 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 permitted. - + With this kind of call only 100 address can be permitted. + @addr Array of the addresses for whom the connection is allowed. */ uint256 currHeight = providers[provider].currentHeight; @@ -400,7 +400,7 @@ contract provider is module, safeMath, announcementTypes { require( providers[provider].data[currHeight].priv ); require( providers[provider].data[currHeight].admin == msg.sender ); require( addr.length <= 100 ); - + for ( uint256 a=0 ; a<addr.length ; a++ ) { delete providers[provider].data[currHeight].allowedUsers[addr[a]]; } @@ -414,7 +414,7 @@ contract provider is module, safeMath, announcementTypes { 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. - + @provider Address of the provider. */ uint256 currHeight = providers[provider].currentHeight; @@ -427,7 +427,7 @@ contract provider is module, safeMath, announcementTypes { } uint256 bal = getTokenBalance(msg.sender); require( moduleHandler(moduleHandlerAddress).processTransactionFee(msg.sender, bal) ); - + checkFloatingSupply(provider, currHeight, false, bal); providers[provider].data[currHeight].clientsCount++; clients[msg.sender].providerAddress = provider; @@ -455,7 +455,7 @@ contract provider is module, safeMath, announcementTypes { } else { require( clients[msg.sender].paidUpTo == currentSchellingRound ); } - + uint256 bal = getTokenBalance(msg.sender); if ( ! providerHasClosed ) { providers[provider].data[currHeight].clientsCount--; @@ -472,7 +472,7 @@ contract provider is module, safeMath, announcementTypes { function checkReward(address addr) public returns (uint256 reward) { /* Polling the share from the token emission for clients and for providers. - + @addr The address want to check. @reward Accumulated amount. */ @@ -494,7 +494,7 @@ contract provider is module, safeMath, announcementTypes { 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 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 @limit Quota of the check-rounds. @provider Address of the provider @@ -527,7 +527,7 @@ contract provider is module, safeMath, announcementTypes { function getClientReward(uint256 limit) internal returns (uint256 reward) { /* Inner function for the client in order to collect the share from the token emission - + @limit Quota of checking the schelling-rounds. @reward Collected token amount from the checked rounds. */ @@ -574,7 +574,7 @@ contract provider is module, safeMath, announcementTypes { } function getProviderReward(address addr, uint256 limit) internal returns (uint256 providerReward, uint256 adminReward) { /* - Inner function for the provider in order to collect the share from the token emission + Inner function for the provider in order to collect the share from the token emission @addr Address of the provider. @limit Quota of the check-rounds. @providerReward The reward of the provider’s address from the checked rounds. @@ -594,7 +594,7 @@ contract provider is module, safeMath, announcementTypes { rate = providers[addr].data[currHeight].rateHistory[a].value; } if ( rate > 0 ) { - if ( ( a > LTSID && rightForInterest(providers[addr].data[currHeight].supply[LTSID], providers[addr].data[currHeight].priv) || + if ( ( a > LTSID && rightForInterest(providers[addr].data[currHeight].supply[LTSID], providers[addr].data[currHeight].priv) || rightForInterest(providers[addr].data[currHeight].supply[a], providers[addr].data[currHeight].priv) ) ) { if ( limit > 0 && steps > limit ) { a--; @@ -636,7 +636,7 @@ contract provider is module, safeMath, announcementTypes { /* Inner function for updating the database when some token change has happened. In this case we are checking if despite the changes the provider is still entitled to the token emission. In case the legitimacy changes then the global supply should be set as well. - + @providerAddress Provider address. @providerHeight Provider height. @neg the change was negative or not @@ -646,15 +646,15 @@ contract provider is module, safeMath, announcementTypes { if ( currentSchellingRound != LSID ) { if ( neg ) { setRightForInterest( - providers[providerAddress].data[providerHeight].supply[LSID], - providers[providerAddress].data[providerHeight].supply[LSID] - value, + providers[providerAddress].data[providerHeight].supply[LSID], + providers[providerAddress].data[providerHeight].supply[LSID] - value, providers[providerAddress].data[providerHeight].priv ); providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] - value; } else { setRightForInterest( - providers[providerAddress].data[providerHeight].supply[LSID], - providers[providerAddress].data[providerHeight].supply[LSID] + value, + providers[providerAddress].data[providerHeight].supply[LSID], + providers[providerAddress].data[providerHeight].supply[LSID] + value, providers[providerAddress].data[providerHeight].priv ); providers[providerAddress].data[providerHeight].supply[currentSchellingRound] = providers[providerAddress].data[providerHeight].supply[LSID] + value; @@ -663,15 +663,15 @@ contract provider is module, safeMath, announcementTypes { } else { if ( neg ) { setRightForInterest( - getProviderCurrentSupply(providerAddress), - getProviderCurrentSupply(providerAddress) - value, + getProviderCurrentSupply(providerAddress), + getProviderCurrentSupply(providerAddress) - value, providers[providerAddress].data[providerHeight].priv ); providers[providerAddress].data[providerHeight].supply[currentSchellingRound] -= value; } else { setRightForInterest( - getProviderCurrentSupply(providerAddress), - getProviderCurrentSupply(providerAddress) + value, + getProviderCurrentSupply(providerAddress), + getProviderCurrentSupply(providerAddress) + value, providers[providerAddress].data[providerHeight].priv ); providers[providerAddress].data[providerHeight].supply[currentSchellingRound] += value; @@ -683,7 +683,7 @@ contract provider is module, safeMath, announcementTypes { Inner function for updating the database in case token change has happened. In this case we check if the provider despite the changes is still entitled to the token emission. We just call this only if the private provider and it’s own capital bears emission. - + @providerAddress Provider address. @providerHeight Provider height. @neg Was the change negative? @@ -693,15 +693,15 @@ contract provider is module, safeMath, announcementTypes { if ( currentSchellingRound != LSID ) { if ( neg ) { setRightForInterest( - providers[providerAddress].data[providerHeight].ownSupply[LSID], - providers[providerAddress].data[providerHeight].ownSupply[LSID] - value, + providers[providerAddress].data[providerHeight].ownSupply[LSID], + providers[providerAddress].data[providerHeight].ownSupply[LSID] - value, true ); providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] - value; } else { setRightForInterest( - providers[providerAddress].data[providerHeight].ownSupply[LSID], - providers[providerAddress].data[providerHeight].ownSupply[LSID] + value, + providers[providerAddress].data[providerHeight].ownSupply[LSID], + providers[providerAddress].data[providerHeight].ownSupply[LSID] + value, true ); providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] = providers[providerAddress].data[providerHeight].ownSupply[LSID] + value; @@ -710,15 +710,15 @@ contract provider is module, safeMath, announcementTypes { } else { if ( neg ) { setRightForInterest( - getProviderCurrentSupply(providerAddress), - getProviderCurrentSupply(providerAddress) - value, + getProviderCurrentSupply(providerAddress), + getProviderCurrentSupply(providerAddress) - value, true ); providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] -= value; } else { setRightForInterest( - getProviderCurrentSupply(providerAddress), - getProviderCurrentSupply(providerAddress) + value, + getProviderCurrentSupply(providerAddress), + getProviderCurrentSupply(providerAddress) + value, true ); providers[providerAddress].data[providerHeight].ownSupply[currentSchellingRound] += value; @@ -728,7 +728,7 @@ contract provider is module, safeMath, announcementTypes { function TEMath(uint256 a, uint256 b, bool neg) internal returns (uint256) { /* Inner function for the changes of the numbers - + @a First number @b 2nd number @neg Operation with numbers. If it is TRUE then subtraction, if it is FALSE then addition. @@ -740,7 +740,7 @@ contract provider is module, safeMath, announcementTypes { /* Inner function for perceiving the changes of the balance and updating the database. If the address is a provider and the balance is decreasing than can not let it go under the minimum level. - + @addr The address where the change happened. @value Rate of the change. @neg ype of the change. If it is TRUE then the balance has been decreased if it is FALSE then it has been increased. @@ -771,9 +771,9 @@ contract provider is module, safeMath, announcementTypes { function getTokenBalance(address addr) internal returns (uint256 balance) { /* Inner function in order to poll the token balance of the address. - + @addr Address - + @balance Balance of the address. */ (bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr); @@ -783,7 +783,7 @@ contract provider is module, safeMath, announcementTypes { function checkICO() internal returns (bool isICO) { /* Inner function to check the ICO status. - + @isICO Is the ICO in process or not? */ (bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO(); diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol index 575b99a8..fcba13ad 100644 --- a/test/compilationTests/corion/publisher.sol +++ b/test/compilationTests/corion/publisher.sol @@ -1,278 +1,278 @@ -pragma solidity ^0.4.11;
-
-import "./announcementTypes.sol";
-import "./module.sol";
-import "./moduleHandler.sol";
-import "./safeMath.sol";
-
-contract publisher is announcementTypes, module, safeMath {
- /*
- module callbacks
- */
- function transferEvent(address from, address to, uint256 value) external returns (bool success) {
- /*
- Transaction completed. This function is available only for moduleHandler
- If a transaction is carried out from or to an address which participated in the objection of an announcement, its objection purport is automatically set
- */
- require( super.isModuleHandler(msg.sender) );
- uint256 announcementID;
- uint256 a;
- // need reverse lookup
- for ( a=0 ; a<opponents[from].length ; a++ ) {
- announcementID = opponents[msg.sender][a];
- if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
- announcements[announcementID].oppositionWeight = safeSub(announcements[a].oppositionWeight, value);
- }
- }
- for ( a=0 ; a<opponents[to].length ; a++ ) {
- announcementID = opponents[msg.sender][a];
- if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) {
- announcements[announcementID].oppositionWeight = safeAdd(announcements[a].oppositionWeight, value);
- }
- }
- return true;
- }
-
- /*
- Pool
- */
-
- uint256 public minAnnouncementDelay = 40320;
- uint256 public minAnnouncementDelayOnICO = 17280;
- uint8 public oppositeRate = 33;
-
- struct announcements_s {
- announcementType Type;
- uint256 start;
- uint256 end;
- bool open;
- string announcement;
- string link;
- bool oppositable;
- uint256 oppositionWeight;
- bool result;
-
- string _str;
- uint256 _uint;
- address _addr;
- }
- mapping(uint256 => announcements_s) public announcements;
- uint256 announcementsLength = 1;
-
- mapping (address => uint256[]) public opponents;
-
- constructor(address moduleHandler) public {
- /*
- Installation function. The installer will be registered in the admin list automatically
-
- @moduleHandler Address of moduleHandler
- */
- super.registerModuleHandler(moduleHandler);
- }
-
- 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
-
- @id Its identification
-
- @Type Subject of announcement
- @Start Height of announcement block
- @End Planned completion of announcement
- @Closed Closed or not
- @Announcement Announcement text
- @Link Link perhaps to a Forum
- @Opposited Objected or not
- @_str Text value
- @_uint Number value
- @_addr Address value
- */
- Type = uint256(announcements[id].Type);
- Start = announcements[id].start;
- End = announcements[id].end;
- Closed = ! announcements[id].open;
- Announcement = announcements[id].announcement;
- Link = announcements[id].link;
- if ( checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
- Opposited = true;
- }
- _str = announcements[id]._str;
- _uint = announcements[id]._uint;
- _addr = announcements[id]._addr;
- }
-
- function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) {
- /*
- Veto check
-
- @weight Purport of objections so far
- @oppositable Opposable at all
-
- @success Opposed or not
- */
- if ( ! oppositable ) { return false; }
- (bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply();
- require( _success );
- return _amount * oppositeRate / 100 > weight;
- }
-
- function newAnnouncement(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external {
- /*
- New announcement. Can be called only by those in the admin list
-
- @Type Topic of announcement
- @Start height of announcement block
- @End planned completion of announcement
- @Closed Completed or not
- @Announcement Announcement text
- @Link link to a Forum
- @Opposition opposed or not
- @_str text box
- @_uint number box
- @_addr address box
- */
- announcementsLength++;
- announcements[announcementsLength].Type = Type;
- announcements[announcementsLength].start = block.number;
- if ( checkICO() ) {
- announcements[announcementsLength].end = block.number + minAnnouncementDelayOnICO;
- } else {
- announcements[announcementsLength].end = block.number + minAnnouncementDelay;
- }
- announcements[announcementsLength].open = true;
- announcements[announcementsLength].announcement = Announcement;
- announcements[announcementsLength].link = Link;
- announcements[announcementsLength].oppositable = Oppositable;
- announcements[announcementsLength].oppositionWeight = 0;
- announcements[announcementsLength].result = false;
- announcements[announcementsLength]._str = _str;
- announcements[announcementsLength]._uint = _uint;
- announcements[announcementsLength]._addr = _addr;
- emit ENewAnnouncement(announcementsLength, Type);
- }
-
- function closeAnnouncement(uint256 id) onlyOwner external {
- /*
- Close announcement. It can be closed only by those in the admin list. Windup is allowed only after the announcement is completed.
-
- @id Announcement identification
- */
- require( announcements[id].open && announcements[id].end < block.number );
- if ( ! checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) {
- announcements[id].result = true;
- if ( announcements[id].Type == announcementType.newModule ) {
- require( moduleHandler(moduleHandlerAddress).newModule(announcements[id]._str, announcements[id]._addr, true, true) );
- } else if ( announcements[id].Type == announcementType.dropModule ) {
- require( moduleHandler(moduleHandlerAddress).dropModule(announcements[id]._str, true) );
- } else if ( announcements[id].Type == announcementType.replaceModule ) {
- require( moduleHandler(moduleHandlerAddress).replaceModule(announcements[id]._str, announcements[id]._addr, true) );
- } else if ( announcements[id].Type == announcementType.replaceModuleHandler) {
- require( moduleHandler(moduleHandlerAddress).replaceModuleHandler(announcements[id]._addr) );
- } else if ( announcements[id].Type == announcementType.transactionFeeRate ||
- announcements[id].Type == announcementType.transactionFeeMin ||
- announcements[id].Type == announcementType.transactionFeeMax ||
- announcements[id].Type == announcementType.transactionFeeBurn ) {
- require( moduleHandler(moduleHandlerAddress).configureModule("token", announcements[id].Type, announcements[id]._uint) );
- } else if ( announcements[id].Type == announcementType.providerPublicFunds ||
- announcements[id].Type == announcementType.providerPrivateFunds ||
- announcements[id].Type == announcementType.providerPrivateClientLimit ||
- announcements[id].Type == announcementType.providerPublicMinRate ||
- announcements[id].Type == announcementType.providerPublicMaxRate ||
- announcements[id].Type == announcementType.providerPrivateMinRate ||
- announcements[id].Type == announcementType.providerPrivateMaxRate ||
- announcements[id].Type == announcementType.providerGasProtect ||
- announcements[id].Type == announcementType.providerInterestMinFunds ||
- announcements[id].Type == announcementType.providerRentRate ) {
- require( moduleHandler(moduleHandlerAddress).configureModule("provider", announcements[id].Type, announcements[id]._uint) );
- } else if ( announcements[id].Type == announcementType.schellingRoundBlockDelay ||
- announcements[id].Type == announcementType.schellingCheckRounds ||
- announcements[id].Type == announcementType.schellingCheckAboves ||
- announcements[id].Type == announcementType.schellingRate ) {
- require( moduleHandler(moduleHandlerAddress).configureModule("schelling", announcements[id].Type, announcements[id]._uint) );
- } else if ( announcements[id].Type == announcementType.publisherMinAnnouncementDelay) {
- minAnnouncementDelay = announcements[id]._uint;
- } else if ( announcements[id].Type == announcementType.publisherOppositeRate) {
- oppositeRate = uint8(announcements[id]._uint);
- }
- }
- announcements[id].end = block.number;
- announcements[id].open = false;
- }
-
- function oppositeAnnouncement(uint256 id) external {
- /*
- Opposition of announcement
- If announcement is opposable, anyone owning a token can oppose it
- Opposition is automatically with the total amount of tokens
- If the quantity of his tokens changes, the purport of his opposition changes automatically
- The prime time is the windup of the announcement, because this is the moment when the number of tokens in opposition are counted.
- One address is entitled to be in oppositon only once. An opposition cannot be withdrawn.
- Running announcements can be opposed only.
-
- @id Announcement identification
- */
- uint256 newArrayID = 0;
- bool foundEmptyArrayID = false;
- require( announcements[id].open );
- require( announcements[id].oppositable );
- for ( uint256 a=0 ; a<opponents[msg.sender].length ; a++ ) {
- require( opponents[msg.sender][a] != id );
- if ( ! announcements[opponents[msg.sender][a]].open) {
- delete opponents[msg.sender][a];
- if ( ! foundEmptyArrayID ) {
- foundEmptyArrayID = true;
- newArrayID = a;
- }
- }
- if ( ! foundEmptyArrayID ) {
- foundEmptyArrayID = true;
- newArrayID = a;
- }
- }
- (bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(msg.sender);
- require( _success );
- require( _balance > 0);
- if ( foundEmptyArrayID ) {
- opponents[msg.sender][newArrayID] = id;
- } else {
- opponents[msg.sender].push(id);
- }
- announcements[id].oppositionWeight += _balance;
- emit EOppositeAnnouncement(id, msg.sender, _balance);
- }
-
- function invalidateAnnouncement(uint256 id) onlyOwner external {
- /*
- Withdraw announcement. Only those in the admin list can withdraw it.
-
- @id Announcement identification
- */
- require( announcements[id].open );
- announcements[id].end = block.number;
- announcements[id].open = false;
- emit EInvalidateAnnouncement(id);
- }
-
- modifier onlyOwner() {
- /*
- Only the owner is allowed to call it.
- */
- require( moduleHandler(moduleHandlerAddress).owners(msg.sender) );
- _;
- }
-
- function checkICO() internal returns (bool isICO) {
- /*
- Inner function to check the ICO status.
- @bool Is the ICO in process or not?
- */
- (bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO();
- require( _success );
- return _isICO;
- }
-
- event ENewAnnouncement(uint256 id, announcementType typ);
- event EOppositeAnnouncement(uint256 id, address addr, uint256 value);
- event EInvalidateAnnouncement(uint256 id);
- event ECloseAnnouncement(uint256 id);
-}
+pragma solidity ^0.4.11; + +import "./announcementTypes.sol"; +import "./module.sol"; +import "./moduleHandler.sol"; +import "./safeMath.sol"; + +contract publisher is announcementTypes, module, safeMath { + /* + module callbacks + */ + function transferEvent(address from, address to, uint256 value) external returns (bool success) { + /* + Transaction completed. This function is available only for moduleHandler + If a transaction is carried out from or to an address which participated in the objection of an announcement, its objection purport is automatically set + */ + require( super.isModuleHandler(msg.sender) ); + uint256 announcementID; + uint256 a; + // need reverse lookup + for ( a=0 ; a<opponents[from].length ; a++ ) { + announcementID = opponents[msg.sender][a]; + if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) { + announcements[announcementID].oppositionWeight = safeSub(announcements[a].oppositionWeight, value); + } + } + for ( a=0 ; a<opponents[to].length ; a++ ) { + announcementID = opponents[msg.sender][a]; + if ( announcements[announcementID].end < block.number && announcements[announcementID].open ) { + announcements[announcementID].oppositionWeight = safeAdd(announcements[a].oppositionWeight, value); + } + } + return true; + } + + /* + Pool + */ + + uint256 public minAnnouncementDelay = 40320; + uint256 public minAnnouncementDelayOnICO = 17280; + uint8 public oppositeRate = 33; + + struct announcements_s { + announcementType Type; + uint256 start; + uint256 end; + bool open; + string announcement; + string link; + bool oppositable; + uint256 oppositionWeight; + bool result; + + string _str; + uint256 _uint; + address _addr; + } + mapping(uint256 => announcements_s) public announcements; + uint256 announcementsLength = 1; + + mapping (address => uint256[]) public opponents; + + constructor(address moduleHandler) public { + /* + Installation function. The installer will be registered in the admin list automatically + + @moduleHandler Address of moduleHandler + */ + super.registerModuleHandler(moduleHandler); + } + + 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 + + @id Its identification + + @Type Subject of announcement + @Start Height of announcement block + @End Planned completion of announcement + @Closed Closed or not + @Announcement Announcement text + @Link Link perhaps to a Forum + @Opposited Objected or not + @_str Text value + @_uint Number value + @_addr Address value + */ + Type = uint256(announcements[id].Type); + Start = announcements[id].start; + End = announcements[id].end; + Closed = ! announcements[id].open; + Announcement = announcements[id].announcement; + Link = announcements[id].link; + if ( checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) { + Opposited = true; + } + _str = announcements[id]._str; + _uint = announcements[id]._uint; + _addr = announcements[id]._addr; + } + + function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) { + /* + Veto check + + @weight Purport of objections so far + @oppositable Opposable at all + + @success Opposed or not + */ + if ( ! oppositable ) { return false; } + (bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply(); + require( _success ); + return _amount * oppositeRate / 100 > weight; + } + + function newAnnouncement(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external { + /* + New announcement. Can be called only by those in the admin list + + @Type Topic of announcement + @Start height of announcement block + @End planned completion of announcement + @Closed Completed or not + @Announcement Announcement text + @Link link to a Forum + @Opposition opposed or not + @_str text box + @_uint number box + @_addr address box + */ + announcementsLength++; + announcements[announcementsLength].Type = Type; + announcements[announcementsLength].start = block.number; + if ( checkICO() ) { + announcements[announcementsLength].end = block.number + minAnnouncementDelayOnICO; + } else { + announcements[announcementsLength].end = block.number + minAnnouncementDelay; + } + announcements[announcementsLength].open = true; + announcements[announcementsLength].announcement = Announcement; + announcements[announcementsLength].link = Link; + announcements[announcementsLength].oppositable = Oppositable; + announcements[announcementsLength].oppositionWeight = 0; + announcements[announcementsLength].result = false; + announcements[announcementsLength]._str = _str; + announcements[announcementsLength]._uint = _uint; + announcements[announcementsLength]._addr = _addr; + emit ENewAnnouncement(announcementsLength, Type); + } + + function closeAnnouncement(uint256 id) onlyOwner external { + /* + Close announcement. It can be closed only by those in the admin list. Windup is allowed only after the announcement is completed. + + @id Announcement identification + */ + require( announcements[id].open && announcements[id].end < block.number ); + if ( ! checkOpposited(announcements[id].oppositionWeight, announcements[id].oppositable) ) { + announcements[id].result = true; + if ( announcements[id].Type == announcementType.newModule ) { + require( moduleHandler(moduleHandlerAddress).newModule(announcements[id]._str, announcements[id]._addr, true, true) ); + } else if ( announcements[id].Type == announcementType.dropModule ) { + require( moduleHandler(moduleHandlerAddress).dropModule(announcements[id]._str, true) ); + } else if ( announcements[id].Type == announcementType.replaceModule ) { + require( moduleHandler(moduleHandlerAddress).replaceModule(announcements[id]._str, announcements[id]._addr, true) ); + } else if ( announcements[id].Type == announcementType.replaceModuleHandler) { + require( moduleHandler(moduleHandlerAddress).replaceModuleHandler(announcements[id]._addr) ); + } else if ( announcements[id].Type == announcementType.transactionFeeRate || + announcements[id].Type == announcementType.transactionFeeMin || + announcements[id].Type == announcementType.transactionFeeMax || + announcements[id].Type == announcementType.transactionFeeBurn ) { + require( moduleHandler(moduleHandlerAddress).configureModule("token", announcements[id].Type, announcements[id]._uint) ); + } else if ( announcements[id].Type == announcementType.providerPublicFunds || + announcements[id].Type == announcementType.providerPrivateFunds || + announcements[id].Type == announcementType.providerPrivateClientLimit || + announcements[id].Type == announcementType.providerPublicMinRate || + announcements[id].Type == announcementType.providerPublicMaxRate || + announcements[id].Type == announcementType.providerPrivateMinRate || + announcements[id].Type == announcementType.providerPrivateMaxRate || + announcements[id].Type == announcementType.providerGasProtect || + announcements[id].Type == announcementType.providerInterestMinFunds || + announcements[id].Type == announcementType.providerRentRate ) { + require( moduleHandler(moduleHandlerAddress).configureModule("provider", announcements[id].Type, announcements[id]._uint) ); + } else if ( announcements[id].Type == announcementType.schellingRoundBlockDelay || + announcements[id].Type == announcementType.schellingCheckRounds || + announcements[id].Type == announcementType.schellingCheckAboves || + announcements[id].Type == announcementType.schellingRate ) { + require( moduleHandler(moduleHandlerAddress).configureModule("schelling", announcements[id].Type, announcements[id]._uint) ); + } else if ( announcements[id].Type == announcementType.publisherMinAnnouncementDelay) { + minAnnouncementDelay = announcements[id]._uint; + } else if ( announcements[id].Type == announcementType.publisherOppositeRate) { + oppositeRate = uint8(announcements[id]._uint); + } + } + announcements[id].end = block.number; + announcements[id].open = false; + } + + function oppositeAnnouncement(uint256 id) external { + /* + Opposition of announcement + If announcement is opposable, anyone owning a token can oppose it + Opposition is automatically with the total amount of tokens + If the quantity of his tokens changes, the purport of his opposition changes automatically + The prime time is the windup of the announcement, because this is the moment when the number of tokens in opposition are counted. + One address is entitled to be in oppositon only once. An opposition cannot be withdrawn. + Running announcements can be opposed only. + + @id Announcement identification + */ + uint256 newArrayID = 0; + bool foundEmptyArrayID = false; + require( announcements[id].open ); + require( announcements[id].oppositable ); + for ( uint256 a=0 ; a<opponents[msg.sender].length ; a++ ) { + require( opponents[msg.sender][a] != id ); + if ( ! announcements[opponents[msg.sender][a]].open) { + delete opponents[msg.sender][a]; + if ( ! foundEmptyArrayID ) { + foundEmptyArrayID = true; + newArrayID = a; + } + } + if ( ! foundEmptyArrayID ) { + foundEmptyArrayID = true; + newArrayID = a; + } + } + (bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(msg.sender); + require( _success ); + require( _balance > 0); + if ( foundEmptyArrayID ) { + opponents[msg.sender][newArrayID] = id; + } else { + opponents[msg.sender].push(id); + } + announcements[id].oppositionWeight += _balance; + emit EOppositeAnnouncement(id, msg.sender, _balance); + } + + function invalidateAnnouncement(uint256 id) onlyOwner external { + /* + Withdraw announcement. Only those in the admin list can withdraw it. + + @id Announcement identification + */ + require( announcements[id].open ); + announcements[id].end = block.number; + announcements[id].open = false; + emit EInvalidateAnnouncement(id); + } + + modifier onlyOwner() { + /* + Only the owner is allowed to call it. + */ + require( moduleHandler(moduleHandlerAddress).owners(msg.sender) ); + _; + } + + function checkICO() internal returns (bool isICO) { + /* + Inner function to check the ICO status. + @bool Is the ICO in process or not? + */ + (bool _success, bool _isICO) = moduleHandler(moduleHandlerAddress).isICO(); + require( _success ); + return _isICO; + } + + event ENewAnnouncement(uint256 id, announcementType typ); + event EOppositeAnnouncement(uint256 id, address addr, uint256 value); + event EInvalidateAnnouncement(uint256 id); + event ECloseAnnouncement(uint256 id); +} diff --git a/test/compilationTests/corion/safeMath.sol b/test/compilationTests/corion/safeMath.sol index 9e27d379..a6680f27 100644 --- a/test/compilationTests/corion/safeMath.sol +++ b/test/compilationTests/corion/safeMath.sol @@ -5,7 +5,7 @@ contract safeMath { /* Biztonsagos hozzadas. Tulcsordulas elleni vedelem. A vegeredmeny nem lehet kevesebb mint az @a, ha igen megall a kod. - + @a Amihez hozzaadni kell @b Amennyit hozzaadni kell. @uint256 Vegeredmeny. @@ -15,12 +15,12 @@ contract safeMath { } return a + b; } - + function safeSub(uint256 a, uint256 b) internal returns(uint256) { /* Biztonsagos kivonas. Tulcsordulas elleni vedelem. A vegeredmeny nem lehet tobb mint az @a, ha igen megall a kod. - + @a Amibol kivonni kell. @b Amennyit kivonni kell. @uint256 Vegeredmeny. diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol index bea53680..c4f3c02c 100644 --- a/test/compilationTests/corion/schelling.sol +++ b/test/compilationTests/corion/schelling.sol @@ -141,9 +141,9 @@ contract schelling is module, announcementTypes, schellingVars { } function transferEvent(address from, address to, uint256 value) external returns (bool) { /* - Transaction completed. This function can be called only by the ModuleHandler. + Transaction completed. This function can be called only by the ModuleHandler. If this contract is the receiver, the amount will be added to the prize pool of the current round. - + @from From who @to To who @value Amount @@ -160,7 +160,7 @@ contract schelling is module, announcementTypes, schellingVars { } modifier isReady { (bool _success, bool _active) = super.isActive(); - require( _success && _active ); + require( _success && _active ); _; } /* @@ -175,7 +175,7 @@ contract schelling is module, announcementTypes, schellingVars { require( db.setFunds(addr, amount) ); } function setVoter(address owner, _voter memory voter) internal { - require( db.setVoter(owner, + require( db.setVoter(owner, voter.roundID, voter.hash, voter.status, @@ -189,7 +189,7 @@ contract schelling is module, announcementTypes, schellingVars { return _voter(b, c, d, e, f); } function setRound(uint256 id, _rounds memory round) internal { - require( db.setRound(id, + require( db.setRound(id, round.totalAboveWeight, round.totalBelowWeight, round.reward, @@ -250,7 +250,7 @@ contract schelling is module, announcementTypes, schellingVars { constructor(address _moduleHandler, address _db, bool _forReplace) public { /* Installation function. - + @_moduleHandler Address of ModuleHandler. @_db Address of the database. @_forReplace This address will be replaced with the old one or not. @@ -265,7 +265,7 @@ contract schelling is module, announcementTypes, schellingVars { function configure(announcementType a, uint256 b) external returns(bool) { /* Can be called only by the ModuleHandler. - + @a Sort of configuration @b Value */ @@ -280,22 +280,22 @@ contract schelling is module, announcementTypes, schellingVars { function prepareVote(bytes32 votehash, uint256 roundID) isReady noContract external { /* Initializing manual vote. - Only the hash of vote will be sent. (Envelope sending). - The address must be in default state, that is there are no vote in progress. + Only the hash of vote will be sent. (Envelope sending). + The address must be in default state, that is there are no vote in progress. Votes can be sent only on the actually Schelling round. - + @votehash Hash of the vote @roundID Number of Schelling round */ nextRound(); - + uint256 currentRound = getCurrentRound(); schellingVars._rounds memory round = getRound(currentRound); _voter memory voter; uint256 funds; - + require( roundID == currentRound ); - + voter = getVoter(msg.sender); funds = getFunds(msg.sender); @@ -304,10 +304,10 @@ contract schelling is module, announcementTypes, schellingVars { voter.roundID = currentRound; voter.hash = votehash; voter.status = voterStatus.afterPrepareVote; - + setVoter(msg.sender, voter); round.voted = true; - + setRound(currentRound, round); } function sendVote(string vote) isReady noContract external { @@ -318,21 +318,21 @@ contract schelling is module, announcementTypes, schellingVars { If the vote invalid, the deposit will be lost. If the “envelope” was opened later than 1,5 Schelling round, the vote is automatically invalid, and deposit can be lost. Lost deposits will be 100% burned. - + @vote Hash of the content of the vote. */ nextRound(); - + uint256 currentRound = getCurrentRound(); _rounds memory round; _voter memory voter; uint256 funds; - + bool lostEverything; voter = getVoter(msg.sender); round = getRound(voter.roundID); funds = getFunds(msg.sender); - + require( voter.status == voterStatus.afterPrepareVote ); require( voter.roundID < currentRound ); if ( keccak256(bytes(vote)) == voter.hash ) { @@ -355,7 +355,7 @@ contract schelling is module, announcementTypes, schellingVars { delete funds; delete voter.status; } - + setVoter(msg.sender, voter); setRound(voter.roundID, round); setFunds(msg.sender, funds); @@ -368,17 +368,17 @@ contract schelling is module, announcementTypes, schellingVars { The right votes take share of deposits. */ nextRound(); - + uint256 currentRound = getCurrentRound(); _rounds memory round; _voter memory voter; uint256 funds; - + voter = getVoter(msg.sender); round = getRound(voter.roundID); funds = getFunds(msg.sender); - - require( voter.status == voterStatus.afterSendVoteOk || + + require( voter.status == voterStatus.afterSendVoteOk || voter.status == voterStatus.afterSendVoteBad ); if ( round.blockHeight+roundBlockDelay/2 <= block.number ) { if ( isWinner(round, voter.voteResult) && voter.status == voterStatus.afterSendVoteOk ) { @@ -390,7 +390,7 @@ contract schelling is module, announcementTypes, schellingVars { delete voter.status; delete voter.roundID; } else { revert(); } - + setVoter(msg.sender, voter); setFunds(msg.sender, funds); } @@ -400,12 +400,12 @@ contract schelling is module, announcementTypes, schellingVars { The prizes will be collected here, and with this function can be transferred to the account of the user. Optionally there can be an address of a beneficiary added, which address the prize will be sent to. Without beneficiary, the owner is the default address. Prize will be sent from the Schelling address without any transaction fee. - + @beneficiary Address of the beneficiary */ schellingVars._voter memory voter = getVoter(msg.sender); uint256 funds = getFunds(msg.sender); - + address _beneficiary = msg.sender; if (beneficiary != address(0x00)) { _beneficiary = beneficiary; } uint256 reward; @@ -414,13 +414,13 @@ contract schelling is module, announcementTypes, schellingVars { reward = voter.rewards; delete voter.rewards; require( moduleHandler(moduleHandlerAddress).transfer(address(this), _beneficiary, reward, false) ); - + setVoter(msg.sender, voter); } function checkReward() public view returns (uint256 reward) { /* Withdraw of the amount of the prize (it’s only information). - + @reward Prize */ schellingVars._voter memory voter = getVoter(msg.sender); @@ -435,9 +435,9 @@ contract schelling is module, announcementTypes, schellingVars { _rounds memory newRound; _rounds memory prevRound; uint256 currentSchellingRound = getCurrentSchellingRound(); - + if ( round.blockHeight+roundBlockDelay > block.number) { return false; } - + newRound.blockHeight = block.number; if ( ! round.voted ) { newRound.reward = round.reward; @@ -452,9 +452,9 @@ contract schelling is module, announcementTypes, schellingVars { if ( above >= interestCheckAboves ) { expansion = getTotalSupply() * interestRate / interestRateM / 100; } - + currentSchellingRound++; - + pushRound(newRound); setSchellingExpansion(currentSchellingRound, expansion); require( moduleHandler(moduleHandlerAddress).broadcastSchellingRound(currentSchellingRound, expansion) ); @@ -466,19 +466,19 @@ contract schelling is module, announcementTypes, schellingVars { Every participant entry with his own deposit. In case of wrong vote only this amount of deposit will be burn. The deposit will be sent to the address of Schelling, charged with transaction fee. - + @amount Amount of deposit. */ _voter memory voter = getVoter(msg.sender); uint256 funds = getFunds(msg.sender); - + (bool a, bool b) = moduleHandler(moduleHandlerAddress).isICO(); require( b && b ); require( voter.status == voterStatus.base ); require( amount > 0 ); require( moduleHandler(moduleHandlerAddress).transfer(msg.sender, address(this), amount, true) ); funds += amount; - + setFunds(msg.sender, funds); } function getFunds() isReady noContract external { @@ -489,17 +489,17 @@ contract schelling is module, announcementTypes, schellingVars { */ _voter memory voter = getVoter(msg.sender); uint256 funds = getFunds(msg.sender); - + require( funds > 0 ); require( voter.status == voterStatus.base ); setFunds(msg.sender, 0); - + require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) ); } function getCurrentSchellingRoundID() public view returns (uint256) { /* Number of actual Schelling round. - + @uint256 Schelling round. */ return getCurrentSchellingRound(); @@ -507,7 +507,7 @@ contract schelling is module, announcementTypes, schellingVars { function getSchellingRound(uint256 id) public view returns (uint256 expansion) { /* Amount of token emission of the Schelling round. - + @id Number of Schelling round @expansion Amount of token emission */ @@ -516,7 +516,7 @@ contract schelling is module, announcementTypes, schellingVars { function getRoundWeight(uint256 aboveW, uint256 belowW) internal returns (uint256) { /* Inside function for calculating the weights of the votes. - + @aboveW Weight of votes: ABOVE @belowW Weight of votes: BELOW @uint256 Calculatet weight @@ -532,7 +532,7 @@ contract schelling is module, announcementTypes, schellingVars { function isWinner(_rounds memory round, bool aboveVote) internal returns (bool) { /* Inside function for calculating the result of the game. - + @round Structure of Schelling round. @aboveVote Is the vote = ABOVE or not @bool Result @@ -543,31 +543,31 @@ contract schelling is module, announcementTypes, schellingVars { } return false; } - + function getTotalSupply() internal returns (uint256 amount) { /* Inside function for querying the whole amount of the tokens. - + @uint256 Whole token amount */ (bool _success, uint256 _amount) = moduleHandler(moduleHandlerAddress).totalSupply(); require( _success ); return _amount; } - + function getTokenBalance(address addr) internal returns (uint256 balance) { /* Inner function in order to poll the token balance of the address. - + @addr Address - + @balance Balance of the address. */ (bool _success, uint256 _balance) = moduleHandler(moduleHandlerAddress).balanceOf(addr); require( _success ); return _balance; } - + modifier noContract { /* Contract can’t call this function, only a natural address. diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol index be6e914b..87ec64d6 100644 --- a/test/compilationTests/corion/token.sol +++ b/test/compilationTests/corion/token.sol @@ -23,7 +23,7 @@ contract token is safeMath, module, announcementTypes { } modifier isReady { (bool _success, bool _active) = super.isActive(); - require( _success && _active ); + require( _success && _active ); _; } /** @@ -35,7 +35,7 @@ contract token is safeMath, module, announcementTypes { string public name = "Corion"; string public symbol = "COR"; uint8 public decimals = 6; - + tokenDB public db; address public icoAddr; uint256 public transactionFeeRate = 20; @@ -45,15 +45,15 @@ contract token is safeMath, module, announcementTypes { uint256 public transactionFeeBurn = 80; address public exchangeAddress; bool public isICO = true; - + mapping(address => bool) public genesis; constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable { /* Installation function - + When _icoAddr is defined, 0.2 ether has to be attached as many times as many genesis addresses are given - + @forReplace This address will be replaced with the old one or not. @moduleHandler Modulhandler's address @dbAddr Address of database @@ -82,18 +82,18 @@ contract token is safeMath, module, announcementTypes { } } } - + function closeIco() external returns (bool success) { /* ICO finished. It can be called only by ICO contract - + @success Was the Function successful? */ require( msg.sender == icoAddr ); isICO = false; return true; } - + /** * @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf. * @param spender The address of the account able to transfer the tokens @@ -104,17 +104,17 @@ contract token is safeMath, module, announcementTypes { function approve(address spender, uint256 amount, uint256 nonce) isReady external returns (bool success) { /* Authorise another address to use a certain quantity of the authorising owner’s balance - + @spender Address of authorised party @amount Token quantity @nonce Transaction count - + @success Was the Function successful? */ _approve(spender, amount, nonce); return true; } - + /** * @notice `msg.sender` approves `spender` to spend `amount` tokens on its behalf and notify the spender from your approve with your `extraData` data. * @param spender The address of the account able to transfer the tokens @@ -127,24 +127,24 @@ contract token is safeMath, module, announcementTypes { /* Authorise another address to use a certain quantity of the authorising owner’s balance Following the transaction the receiver address `approvedCorionToken` function is called by the given data - + @spender Authorized address @amount Token quantity @extraData Extra data to be received by the receiver @nonce Transaction count - + @success Was the Function successful? */ _approve(spender, amount, nonce); require( thirdPartyContractAbstract(spender).approvedCorionToken(msg.sender, amount, extraData) ); return true; } - + function _approve(address spender, uint256 amount, uint256 nonce) internal { /* Internal Function to authorise another address to use a certain quantity of the authorising owner’s balance. If the transaction count not match the authorise fails. - + @spender Address of authorised party @amount Token quantity @nonce Transaction count @@ -158,10 +158,10 @@ contract token is safeMath, module, announcementTypes { function allowance(address owner, address spender) public view returns (uint256 remaining, uint256 nonce) { /* Get the quantity of tokens given to be used - + @owner Authorising address @spender Authorised address - + @remaining Tokens to be spent @nonce Transaction count */ @@ -169,7 +169,7 @@ contract token is safeMath, module, announcementTypes { require( _success ); return (_remaining, _nonce); } - + /** * @notice Send `amount` Corion tokens to `to` from `msg.sender` * @param to The address of the recipient @@ -181,10 +181,10 @@ contract token is safeMath, module, announcementTypes { Start transaction, token is sent from caller’s address to receiver’s address Transaction fee is to be deducted. If receiver is not a natural address but a person, he will be called - + @to To who @amount Quantity - + @success Was the Function successful? */ bytes memory _data; @@ -196,7 +196,7 @@ contract token is safeMath, module, announcementTypes { emit Transfer(msg.sender, to, amount, _data); return true; } - + /** * @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from` * @param from The address holding the tokens being transferred @@ -209,11 +209,11 @@ contract token is safeMath, module, announcementTypes { Start transaction to send a quantity from a given address to another address. (approve / allowance). This can be called only by the address approved in advance Transaction fee is to be deducted If receiver is not a natural address but a person, he will be called - + @from From who. @to To who @amount Quantity - + @success Was the Function successful? */ if ( from != msg.sender ) { @@ -233,7 +233,7 @@ contract token is safeMath, module, announcementTypes { emit Transfer(from, to, amount, _data); return true; } - + /** * @notice Send `amount` tokens to `to` from `from` on the condition it is approved by `from` * @param from The address holding the tokens being transferred @@ -245,12 +245,12 @@ contract token is safeMath, module, announcementTypes { /* Start transaction to send a quantity from a given address to another address Only ModuleHandler can call it - + @from From who @to To who. @amount Quantity @fee Deduct transaction fee - yes or no? - + @success Was the Function successful? */ bytes memory _data; @@ -259,7 +259,7 @@ contract token is safeMath, module, announcementTypes { emit Transfer(from, to, amount, _data); return true; } - + /** * @notice Send `amount` Corion tokens to `to` from `msg.sender` and notify the receiver from your transaction with your `extraData` data * @param to The contract address of the recipient @@ -272,11 +272,11 @@ contract token is safeMath, module, announcementTypes { Start transaction to send a quantity from a given address to another address After transaction the function `receiveCorionToken`of the receiver is called by the given data When sending an amount, it is possible the total amount cannot be processed, the remaining amount is sent back with no fee charged - + @to To who. @amount Quantity @extraData Extra data the receiver will get - + @success Was the Function successful? */ if ( isContract(to) ) { @@ -287,11 +287,11 @@ contract token is safeMath, module, announcementTypes { emit Transfer(msg.sender, to, amount, extraData); return true; } - + function _transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal { /* Internal function to start transactions to a contract - + @from From who @to To who. @amount Quantity @@ -306,15 +306,15 @@ contract token is safeMath, module, announcementTypes { } _processTransactionFee(from, amount - _back); } - + function _transfer(address from, address to, uint256 amount, bool fee) internal { /* Internal function to start transactions. When Tokens are sent, transaction fee is charged During ICO transactions are allowed only from genesis addresses. - After sending the tokens, the ModuleHandler is notified and it will broadcast the fact among members - + After sending the tokens, the ModuleHandler is notified and it will broadcast the fact among members + The 0xa636a97578d26a3b76b060bbc18226d954cf3757 address are blacklisted. - + @from From who @to To who @amount Quantity @@ -336,7 +336,7 @@ contract token is safeMath, module, announcementTypes { } require( moduleHandler(moduleHandlerAddress).broadcastTransfer(from, to, amount) ); } - + /** * @notice Transaction fee will be deduced from `owner` for transacting `value` * @param owner The address where will the transaction fee deduced @@ -345,23 +345,23 @@ contract token is safeMath, module, announcementTypes { */ function processTransactionFee(address owner, uint256 value) isReady external returns (bool success) { /* - Charge transaction fee. It can be called only by moduleHandler - + Charge transaction fee. It can be called only by moduleHandler + @owner From who. @value Quantity to calculate the fee - + @success Was the Function successful? */ require( super.isModuleHandler(msg.sender) ); _processTransactionFee(owner, value); return true; } - + function _processTransactionFee(address owner, uint256 value) internal { /* Internal function to charge the transaction fee. A certain quantity is burnt, the rest is sent to the Schelling game prize pool. No transaction fee during ICO. - + @owner From who @value Quantity to calculate the fee */ @@ -385,13 +385,13 @@ contract token is safeMath, module, announcementTypes { _burn(owner, _fee); } } - + function getTransactionFee(uint256 value) public view returns (bool success, uint256 fee) { /* Transaction fee query. - + @value Quantity to calculate the fee - + @success Was the Function successful? @fee Amount of Transaction fee */ @@ -401,25 +401,25 @@ contract token is safeMath, module, announcementTypes { else if ( fee < transactionFeeMin ) { fee = transactionFeeMin; } return (true, fee); } - + function mint(address owner, uint256 value) isReady external returns (bool success) { /* Generating tokens. It can be called only by ICO contract or the moduleHandler. - + @owner Address @value Amount. - + @success Was the Function successful? */ require( super.isModuleHandler(msg.sender) || msg.sender == icoAddr ); _mint(owner, value); return true; } - + function _mint(address owner, uint256 value) internal { /* Internal function to generate tokens - + @owner Token is credited to this address @value Quantity */ @@ -430,25 +430,25 @@ contract token is safeMath, module, announcementTypes { } emit Mint(owner, value); } - + function burn(address owner, uint256 value) isReady external returns (bool success) { /* Burning the token. Can call only modulehandler - + @owner Burn the token from this address @value Quantity - + @success Was the Function successful? */ require( super.isModuleHandler(msg.sender) ); _burn(owner, value); return true; } - + function _burn(address owner, uint256 value) internal { /* Internal function to burn the token - + @owner Burn the token from this address @value Quantity */ @@ -456,13 +456,13 @@ contract token is safeMath, module, announcementTypes { require( moduleHandler(moduleHandlerAddress).broadcastTransfer(owner, address(0x00), value) ); emit Burn(owner, value); } - + function isContract(address addr) internal returns (bool success) { /* Internal function to check if the given address is natural, or a contract - + @addr Address to be checked - + @success Is the address crontact or not */ uint256 _codeLength; @@ -475,9 +475,9 @@ contract token is safeMath, module, announcementTypes { function balanceOf(address owner) public view returns (uint256 value) { /* Token balance query - + @owner Address - + @value Balance of address */ return db.balanceOf(owner); @@ -486,19 +486,19 @@ contract token is safeMath, module, announcementTypes { function totalSupply() public view returns (uint256 value) { /* Total token quantity query - + @value Total token quantity */ return db.totalSupply(); } - + function configure(announcementType aType, uint256 value) isReady external returns(bool success) { /* Token settings configuration.It can be call only by moduleHandler - + @aType Type of setting @value Value - + @success Was the Function successful? */ require( super.isModuleHandler(msg.sender) ); @@ -509,7 +509,7 @@ contract token is safeMath, module, announcementTypes { else { return false; } return true; } - + event AllowanceUsed(address indexed spender, address indexed owner, uint256 indexed value); event Mint(address indexed addr, uint256 indexed value); event Burn(address indexed addr, uint256 indexed value); diff --git a/test/compilationTests/corion/tokenDB.sol b/test/compilationTests/corion/tokenDB.sol index 484135ca..1632a89b 100644 --- a/test/compilationTests/corion/tokenDB.sol +++ b/test/compilationTests/corion/tokenDB.sol @@ -1,77 +1,77 @@ -pragma solidity ^0.4.11;
-
-import "./safeMath.sol";
-import "./owned.sol";
-
-contract tokenDB is safeMath, ownedDB {
-
- struct allowance_s {
- uint256 amount;
- uint256 nonce;
- }
-
- mapping(address => mapping(address => allowance_s)) public allowance;
- mapping (address => uint256) public balanceOf;
- uint256 public totalSupply;
-
- function increase(address owner, uint256 value) external returns(bool success) {
- /*
- Increase of balance of the address in database. Only owner can call it.
-
- @owner Address
- @value Quantity
-
- @success Was the Function successful?
- */
- require( isOwner() );
- balanceOf[owner] = safeAdd(balanceOf[owner], value);
- totalSupply = safeAdd(totalSupply, value);
- return true;
- }
-
- function decrease(address owner, uint256 value) external returns(bool success) {
- /*
- Decrease of balance of the address in database. Only owner can call it.
-
- @owner Address
- @value Quantity
-
- @success Was the Function successful?
- */
- require( isOwner() );
- balanceOf[owner] = safeSub(balanceOf[owner], value);
- totalSupply = safeSub(totalSupply, value);
- return true;
- }
-
- function setAllowance(address owner, address spender, uint256 amount, uint256 nonce) external returns(bool success) {
- /*
- Set allowance in the database. Only owner can call it.
-
- @owner Owner address
- @spender Spender address
- @amount Amount to set
- @nonce Transaction count
-
- @success Was the Function successful?
- */
- require( isOwner() );
- allowance[owner][spender].amount = amount;
- allowance[owner][spender].nonce = nonce;
- return true;
- }
-
- function getAllowance(address owner, address spender) public view returns(bool success, uint256 remaining, uint256 nonce) {
- /*
- Get allowance from the database.
-
- @owner Owner address
- @spender Spender address
-
- @success Was the Function successful?
- @remaining Remaining amount of the allowance
- @nonce Transaction count
- */
- return ( true, allowance[owner][spender].amount, allowance[owner][spender].nonce );
- }
-}
+pragma solidity ^0.4.11; + +import "./safeMath.sol"; +import "./owned.sol"; + +contract tokenDB is safeMath, ownedDB { + + struct allowance_s { + uint256 amount; + uint256 nonce; + } + + mapping(address => mapping(address => allowance_s)) public allowance; + mapping (address => uint256) public balanceOf; + uint256 public totalSupply; + + function increase(address owner, uint256 value) external returns(bool success) { + /* + Increase of balance of the address in database. Only owner can call it. + + @owner Address + @value Quantity + + @success Was the Function successful? + */ + require( isOwner() ); + balanceOf[owner] = safeAdd(balanceOf[owner], value); + totalSupply = safeAdd(totalSupply, value); + return true; + } + + function decrease(address owner, uint256 value) external returns(bool success) { + /* + Decrease of balance of the address in database. Only owner can call it. + + @owner Address + @value Quantity + + @success Was the Function successful? + */ + require( isOwner() ); + balanceOf[owner] = safeSub(balanceOf[owner], value); + totalSupply = safeSub(totalSupply, value); + return true; + } + + function setAllowance(address owner, address spender, uint256 amount, uint256 nonce) external returns(bool success) { + /* + Set allowance in the database. Only owner can call it. + + @owner Owner address + @spender Spender address + @amount Amount to set + @nonce Transaction count + + @success Was the Function successful? + */ + require( isOwner() ); + allowance[owner][spender].amount = amount; + allowance[owner][spender].nonce = nonce; + return true; + } + + function getAllowance(address owner, address spender) public view returns(bool success, uint256 remaining, uint256 nonce) { + /* + Get allowance from the database. + + @owner Owner address + @spender Spender address + + @success Was the Function successful? + @remaining Remaining amount of the allowance + @nonce Transaction count + */ + return ( true, allowance[owner][spender].amount, allowance[owner][spender].nonce ); + } +} diff --git a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol index 0bc7307d..fccf05e5 100644 --- a/test/compilationTests/gnosis/Tokens/OutcomeToken.sol +++ b/test/compilationTests/gnosis/Tokens/OutcomeToken.sol @@ -36,7 +36,7 @@ contract OutcomeToken is StandardToken { { eventContract = msg.sender; } - + /// @dev Events contract issues new tokens for address. Returns success /// @param _for Address of receiver /// @param outcomeTokenCount Number of tokens to issue diff --git a/test/compilationTests/zeppelin/Bounty.sol b/test/compilationTests/zeppelin/Bounty.sol index 1b5d05b4..d45e130c 100644 --- a/test/compilationTests/zeppelin/Bounty.sol +++ b/test/compilationTests/zeppelin/Bounty.sol @@ -25,7 +25,7 @@ contract Bounty is PullPayment, Destructible { } /** - * @dev Create and deploy the target contract (extension of Target contract), and sets the + * @dev Create and deploy the target contract (extension of Target contract), and sets the * msg.sender as a researcher * @return A target contract */ @@ -69,10 +69,10 @@ contract Bounty is PullPayment, Destructible { contract Target { /** - * @dev Checks all values a contract assumes to be true all the time. If this function returns - * false, the contract is broken in some way and is in an inconsistent state. - * 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. + * @dev Checks all values a contract assumes to be true all the time. If this function returns + * false, the contract is broken in some way and is in an inconsistent state. + * 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() public returns(bool); } diff --git a/test/compilationTests/zeppelin/LimitBalance.sol b/test/compilationTests/zeppelin/LimitBalance.sol index 8bf4b253..d07b3c2c 100644 --- a/test/compilationTests/zeppelin/LimitBalance.sol +++ b/test/compilationTests/zeppelin/LimitBalance.sol @@ -12,7 +12,7 @@ contract LimitBalance { uint256 public limit; /** - * @dev Constructor that sets the passed value as a limit. + * @dev Constructor that sets the passed value as a limit. * @param _limit uint256 to represent the limit. */ constructor(uint256 _limit) public { diff --git a/test/compilationTests/zeppelin/ReentrancyGuard.sol b/test/compilationTests/zeppelin/ReentrancyGuard.sol index 7805ec07..f7abb698 100644 --- a/test/compilationTests/zeppelin/ReentrancyGuard.sol +++ b/test/compilationTests/zeppelin/ReentrancyGuard.sol @@ -9,7 +9,7 @@ pragma solidity ^0.4.11; contract ReentrancyGuard { /** - * @dev We use a single lock for the whole contract. + * @dev We use a single lock for the whole contract. */ bool private rentrancy_lock = false; diff --git a/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol b/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol index da4e3b7f..e94fc9fb 100644 --- a/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol +++ b/test/compilationTests/zeppelin/crowdsale/FinalizableCrowdsale.sol @@ -24,7 +24,7 @@ contract FinalizableCrowdsale is Crowdsale, Ownable { finalization(); emit Finalized(); - + isFinalized = true; } diff --git a/test/compilationTests/zeppelin/lifecycle/Destructible.sol b/test/compilationTests/zeppelin/lifecycle/Destructible.sol index 5b0e9f58..8b57924d 100644 --- a/test/compilationTests/zeppelin/lifecycle/Destructible.sol +++ b/test/compilationTests/zeppelin/lifecycle/Destructible.sol @@ -13,7 +13,7 @@ contract Destructible is Ownable { constructor() public payable { } /** - * @dev Transfers the current balance to the owner and terminates the contract. + * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() public onlyOwner { selfdestruct(owner); diff --git a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol index c8b773ef..eb141587 100644 --- a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol +++ b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol @@ -4,7 +4,7 @@ pragma solidity ^0.4.11; import "../ownership/Ownable.sol"; import "../token/ERC20Basic.sol"; -/** +/** * @title TokenDestructible: * @author Remco Bloemen <remco@2π.com> * @dev Base contract that can be destroyed by owner. All funds in contract including @@ -14,7 +14,7 @@ contract TokenDestructible is Ownable { constructor() public payable { } - /** + /** * @notice Terminate contract and refund to owner * @param tokens List of addresses of ERC20 or ERC20Basic token contracts to refund. diff --git a/test/compilationTests/zeppelin/ownership/Claimable.sol b/test/compilationTests/zeppelin/ownership/Claimable.sol index d7b48a29..7778e2de 100644 --- a/test/compilationTests/zeppelin/ownership/Claimable.sol +++ b/test/compilationTests/zeppelin/ownership/Claimable.sol @@ -6,14 +6,14 @@ import './Ownable.sol'; /** * @title Claimable - * @dev Extension for the Ownable contract, where the ownership needs to be claimed. + * @dev Extension for the Ownable contract, where the ownership needs to be claimed. * This allows the new owner to accept the transfer. */ contract Claimable is Ownable { address public pendingOwner; /** - * @dev Modifier throws if called by any account other than the pendingOwner. + * @dev Modifier throws if called by any account other than the pendingOwner. */ modifier onlyPendingOwner() { if (msg.sender != pendingOwner) { @@ -23,8 +23,8 @@ contract Claimable is Ownable { } /** - * @dev Allows the current owner to set the pendingOwner address. - * @param newOwner The address to transfer ownership to. + * @dev Allows the current owner to set the pendingOwner address. + * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { pendingOwner = newOwner; diff --git a/test/compilationTests/zeppelin/ownership/Contactable.sol b/test/compilationTests/zeppelin/ownership/Contactable.sol index 5f781e13..5053494d 100644 --- a/test/compilationTests/zeppelin/ownership/Contactable.sol +++ b/test/compilationTests/zeppelin/ownership/Contactable.sol @@ -4,7 +4,7 @@ import './Ownable.sol'; /** * @title Contactable token - * @dev Basic version of a contactable contract, allowing the owner to provide a string with their + * @dev Basic version of a contactable contract, allowing the owner to provide a string with their * contact information. */ contract Contactable is Ownable{ diff --git a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol index 540a2ce0..f4c8a681 100644 --- a/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol +++ b/test/compilationTests/zeppelin/ownership/DelayedClaimable.sol @@ -15,10 +15,10 @@ contract DelayedClaimable is Claimable { uint256 public start; /** - * @dev Used to specify the time period during which a pending - * owner can claim ownership. + * @dev Used to specify the time period during which a pending + * owner can claim ownership. * @param _start The earliest time ownership can be claimed. - * @param _end The latest time ownership can be claimed. + * @param _end The latest time ownership can be claimed. */ function setLimits(uint256 _start, uint256 _end) public onlyOwner { if (_start > _end) @@ -29,8 +29,8 @@ 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. + * @dev Allows the pendingOwner address to finalize the transfer, as long as it is called within + * the specified start and end time. */ function claimOwnership() public onlyPendingOwner { if ((block.number > end) || (block.number < start)) diff --git a/test/compilationTests/zeppelin/ownership/HasNoContracts.sol b/test/compilationTests/zeppelin/ownership/HasNoContracts.sol index b5bd649d..19b363d4 100644 --- a/test/compilationTests/zeppelin/ownership/HasNoContracts.sol +++ b/test/compilationTests/zeppelin/ownership/HasNoContracts.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.11; import "./Ownable.sol"; -/** +/** * @title Contracts that should not own Contracts * @author Remco Bloemen <remco@2π.com> * @dev Should contracts (anything Ownable) end up being owned by this contract, it allows the owner diff --git a/test/compilationTests/zeppelin/ownership/HasNoEther.sol b/test/compilationTests/zeppelin/ownership/HasNoEther.sol index 75d90841..5e3d27d2 100644 --- a/test/compilationTests/zeppelin/ownership/HasNoEther.sol +++ b/test/compilationTests/zeppelin/ownership/HasNoEther.sol @@ -2,7 +2,7 @@ pragma solidity ^0.4.11; import "./Ownable.sol"; -/** +/** * @title Contracts that should not own Ether * @author Remco Bloemen <remco@2π.com> * @dev This tries to block incoming ether to prevent accidental loss of Ether. Should Ether end up @@ -16,9 +16,9 @@ contract HasNoEther is Ownable { /** * @dev Constructor that rejects incoming Ether - * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we - * leave out payable, then Solidity will allow inheriting contracts to implement a payable - * constructor. By doing it this way we prevent a payable constructor from working. Alternatively + * @dev The `payable` flag is added so we can access `msg.value` without compiler warning. If we + * leave out payable, then Solidity will allow inheriting contracts to implement a payable + * constructor. By doing it this way we prevent a payable constructor from working. Alternatively * we could use assembly to access msg.value. */ constructor() public payable { diff --git a/test/compilationTests/zeppelin/ownership/HasNoTokens.sol b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol index 87e0c6df..e14d8da7 100644 --- a/test/compilationTests/zeppelin/ownership/HasNoTokens.sol +++ b/test/compilationTests/zeppelin/ownership/HasNoTokens.sol @@ -3,7 +3,7 @@ pragma solidity ^0.4.11; import "./Ownable.sol"; import "../token/ERC20Basic.sol"; -/** +/** * @title Contracts that should not own Tokens * @author Remco Bloemen <remco@2π.com> * @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens. @@ -12,7 +12,7 @@ import "../token/ERC20Basic.sol"; */ contract HasNoTokens is Ownable { - /** + /** * @dev Reject all ERC23 compatible tokens * @param from_ address The address that is transferring the tokens * @param value_ uint256 the amount of the specified token diff --git a/test/compilationTests/zeppelin/ownership/NoOwner.sol b/test/compilationTests/zeppelin/ownership/NoOwner.sol index 7215abf3..c0ef7f4d 100644 --- a/test/compilationTests/zeppelin/ownership/NoOwner.sol +++ b/test/compilationTests/zeppelin/ownership/NoOwner.sol @@ -4,10 +4,10 @@ import "./HasNoEther.sol"; import "./HasNoTokens.sol"; import "./HasNoContracts.sol"; -/** +/** * @title Base contract for contracts that should not own things. * @author Remco Bloemen <remco@2π.com> - * @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or + * @dev Solves a class of errors where a contract accidentally becomes owner of Ether, Tokens or * Owned contracts. See respective base contracts for details. */ contract NoOwner is HasNoEther, HasNoTokens, HasNoContracts { diff --git a/test/compilationTests/zeppelin/ownership/Ownable.sol b/test/compilationTests/zeppelin/ownership/Ownable.sol index a862cb74..bd175077 100644 --- a/test/compilationTests/zeppelin/ownership/Ownable.sol +++ b/test/compilationTests/zeppelin/ownership/Ownable.sol @@ -3,14 +3,14 @@ pragma solidity ^0.4.11; /** * @title Ownable - * @dev The Ownable contract has an owner address, and provides basic authorization control - * functions, this simplifies the implementation of "user permissions". + * @dev The Ownable contract has an owner address, and provides basic authorization control + * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; - /** + /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ @@ -20,7 +20,7 @@ contract Ownable { /** - * @dev Throws if called by any account other than the owner. + * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { if (msg.sender != owner) { @@ -32,7 +32,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. + * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { if (newOwner != address(0)) { diff --git a/test/compilationTests/zeppelin/ownership/Shareable.sol b/test/compilationTests/zeppelin/ownership/Shareable.sol index 0c8d16a5..b2cb165d 100644 --- a/test/compilationTests/zeppelin/ownership/Shareable.sol +++ b/test/compilationTests/zeppelin/ownership/Shareable.sol @@ -3,7 +3,7 @@ pragma solidity ^0.4.11; /** * @title Shareable - * @dev inheritable "property" contract that enables methods to be protected by requiring the + * @dev inheritable "property" contract that enables methods to be protected by requiring the * acquiescence of either a single, or, crucially, each of a number of, designated owners. * @dev Usage: use modifiers onlyowner (just own owned) or onlymanyowners(hash), whereby the same hash must be provided by some number (specified in constructor) of the set of owners (specified in the constructor) before the interior is executed. */ @@ -41,9 +41,9 @@ contract Shareable { } _; } - - /** - * @dev Modifier for multisig functions. + + /** + * @dev Modifier for multisig functions. * @param _operation The operation must have an intrinsic hash in order that later attempts can be * realised as the same underlying operation and thus count as confirmations. */ @@ -53,8 +53,8 @@ contract Shareable { } } - /** - * @dev Constructor is given the number of sigs required to do protected "onlymanyowners" + /** + * @dev Constructor is given the number of sigs required to do protected "onlymanyowners" * transactions as well as the selection of addresses capable of confirming them. * @param _owners A list of owners. * @param _required The amount required for a transaction to be approved. diff --git a/test/compilationTests/zeppelin/token/BasicToken.sol b/test/compilationTests/zeppelin/token/BasicToken.sol index bc085f85..3d5646a4 100644 --- a/test/compilationTests/zeppelin/token/BasicToken.sol +++ b/test/compilationTests/zeppelin/token/BasicToken.sol @@ -7,7 +7,7 @@ import '../math/SafeMath.sol'; /** * @title Basic token - * @dev Basic version of StandardToken, with no allowances. + * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic { using SafeMath for uint256; @@ -27,7 +27,7 @@ contract BasicToken is ERC20Basic { /** * @dev Gets the balance of the specified address. - * @param _owner The address to query the the balance of. + * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { diff --git a/test/compilationTests/zeppelin/token/LimitedTransferToken.sol b/test/compilationTests/zeppelin/token/LimitedTransferToken.sol index 3ce928f6..d668b86f 100644 --- a/test/compilationTests/zeppelin/token/LimitedTransferToken.sol +++ b/test/compilationTests/zeppelin/token/LimitedTransferToken.sol @@ -4,11 +4,11 @@ import "./ERC20.sol"; /** * @title LimitedTransferToken - * @dev LimitedTransferToken defines the generic interface and the implementation to limit token - * transferability for different events. It is intended to be used as a base class for other token - * contracts. + * @dev LimitedTransferToken defines the generic interface and the implementation to limit token + * transferability for different events. It is intended to be used as a base class for other token + * contracts. * LimitedTransferToken has been designed to allow for different limiting factors, - * this can be achieved by recursively calling super.transferableTokens() until the base class is + * this can be achieved by recursively calling super.transferableTokens() until the base class is * hit. For example: * function transferableTokens(address holder, uint64 time) view public returns (uint256) { * return min256(unlockedTokens, super.transferableTokens(holder, time)); @@ -48,7 +48,7 @@ contract LimitedTransferToken is ERC20 { /** * @dev Default transferable tokens function returns all tokens for a holder (no limit). - * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the + * @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the * specific logic for limiting token transferability for a holder over time. */ function transferableTokens(address holder, uint64 time) view public returns (uint256) { diff --git a/test/compilationTests/zeppelin/token/SimpleToken.sol b/test/compilationTests/zeppelin/token/SimpleToken.sol index 6c3f5740..d8717562 100644 --- a/test/compilationTests/zeppelin/token/SimpleToken.sol +++ b/test/compilationTests/zeppelin/token/SimpleToken.sol @@ -6,7 +6,7 @@ import "./StandardToken.sol"; /** * @title SimpleToken - * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. + * @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the creator. * Note they can later distribute these tokens as they wish using `transfer` and other * `StandardToken` functions. */ @@ -18,7 +18,7 @@ contract SimpleToken is StandardToken { uint256 public INITIAL_SUPPLY = 10000; /** - * @dev Constructor that gives msg.sender all of existing tokens. + * @dev Constructor that gives msg.sender all of existing tokens. */ constructor() public { totalSupply = INITIAL_SUPPLY; diff --git a/test/compilationTests/zeppelin/token/TokenTimelock.sol b/test/compilationTests/zeppelin/token/TokenTimelock.sol index a1722ebf..4847b648 100644 --- a/test/compilationTests/zeppelin/token/TokenTimelock.sol +++ b/test/compilationTests/zeppelin/token/TokenTimelock.sol @@ -5,11 +5,11 @@ import './ERC20Basic.sol'; /** * @title TokenTimelock - * @dev TokenTimelock is a token holder contract that will allow a + * @dev TokenTimelock is a token holder contract that will allow a * beneficiary to extract the tokens after a given release time */ contract TokenTimelock { - + // ERC20 basic token contract being held ERC20Basic token; diff --git a/test/compilationTests/zeppelin/token/VestedToken.sol b/test/compilationTests/zeppelin/token/VestedToken.sol index ca13b638..7edc7d16 100644 --- a/test/compilationTests/zeppelin/token/VestedToken.sol +++ b/test/compilationTests/zeppelin/token/VestedToken.sol @@ -226,7 +226,7 @@ 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 specific 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 memory grant, uint64 time) private view returns (uint256) { diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol index b6dd12b8..07113093 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() external { + function() external { uint[] storage y = x; assembly { pop(y) @@ -8,4 +8,4 @@ contract C { } } // ---- -// TypeError: (119-120): You have to use the _slot or _offset suffix to access storage reference variables. +// TypeError: (118-119): You have to use the _slot or _offset suffix to access storage reference variables. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol index d5c8eaf5..dc742142 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_assignment.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() external { + function() external { uint[] storage y = x; assembly { y_slot := 1 @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (115-121): Storage variables cannot be assigned to. -// TypeError: (139-147): Storage variables cannot be assigned to. +// TypeError: (114-120): Storage variables cannot be assigned to. +// TypeError: (138-146): Storage variables cannot be assigned to. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol index 84f98ed9..b01a7705 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_fine.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() external { + function() external { uint[] storage y = x; assembly { pop(y_slot) diff --git a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol index 4025e11c..704b712d 100644 --- a/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol +++ b/test/libsolidity/syntaxTests/inlineAssembly/storage_reference_on_memory.sol @@ -1,6 +1,6 @@ contract C { uint[] x; - function() external { + function() external { uint[] memory y = x; assembly { pop(y_slot) @@ -9,5 +9,5 @@ contract C { } } // ---- -// TypeError: (118-124): The suffixes _offset and _slot can only be used on storage variables. -// TypeError: (142-150): The suffixes _offset and _slot can only be used on storage variables. +// TypeError: (117-123): The suffixes _offset and _slot can only be used on storage variables. +// TypeError: (141-149): The suffixes _offset and _slot can only be used on storage variables. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiSingleVariableDeclaration.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiSingleVariableDeclaration.sol index 182ba072..7db98577 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiSingleVariableDeclaration.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiSingleVariableDeclaration.sol @@ -3,4 +3,4 @@ contract C { (uint a) = f(); a; } -} +} diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol index 2b765837..85094d00 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationInvalidType.sol @@ -3,7 +3,7 @@ contract C { (uint a, string memory b,,) = f(); a; b; } -} +} // ---- // TypeError: (85-118): Type string memory is not implicitly convertible to expected type uint256. // TypeError: (85-118): Type uint256 is not implicitly convertible to expected type string memory. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol index 224d9614..1f9e52d1 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping.sol @@ -5,6 +5,6 @@ contract C { } a; } -} +} // ---- // DeclarationError: (99-100): Undeclared identifier. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol index 242a1f39..45b8858b 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationScoping2.sol @@ -4,7 +4,7 @@ contract C { (uint a, uint b, uint c) = (a, b, c); } } -} +} // ---- // DeclarationError: (79-80): Undeclared identifier. "a" is not (or not yet) visible at this point. // DeclarationError: (82-83): Undeclared identifier. "b" is not (or not yet) visible at this point. diff --git a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol index 8ae0eaac..00458908 100644 --- a/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol +++ b/test/libsolidity/syntaxTests/multiVariableDeclaration/multiVariableDeclarationThatIsExpression.sol @@ -4,6 +4,6 @@ contract C { function f() internal pure returns (uint, uint, uint, S storage, uint, uint) { (,,,s.x[2](),,) = f(); } -} +} // ---- // TypeError: (160-168): Expression has to be an lvalue. |