diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index 13434da6a..6702452cb 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract Migrations { @@ -12,7 +12,7 @@ contract Migrations { _; } - function Migrations() public { + constructor() public { owner = msg.sender; } diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index 9ab366d0e..ca7180b89 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./interfaces/IModuleRegistry.sol"; import "./interfaces/IModuleFactory.sol"; @@ -32,9 +32,10 @@ contract ModuleRegistry is IModuleRegistry, Ownable { function useModule(address _moduleFactory) external { //msg.sender must be a security token - below will throw if not ISecurityTokenRegistry(securityTokenRegistry).getSecurityTokenData(msg.sender); - require(registry[_moduleFactory] != 0); + require(registry[_moduleFactory] != 0, "ModuleFactory type should not be 0"); //To use a module, either it must be verified, or owned by the ST owner - require(verified[_moduleFactory]||(IModuleFactory(_moduleFactory).owner() == ISecurityToken(msg.sender).owner())); + require(verified[_moduleFactory]||(IModuleFactory(_moduleFactory).owner() == ISecurityToken(msg.sender).owner()), + "Module factory is not verified as well as not called by the owner"); reputation[_moduleFactory].push(msg.sender); emit LogModuleUsed (_moduleFactory, msg.sender); } @@ -44,9 +45,9 @@ contract ModuleRegistry is IModuleRegistry, Ownable { * @param _moduleFactory is the address of the module factory to be registered */ function registerModule(address _moduleFactory) external returns(bool) { - require(registry[_moduleFactory] == 0); + require(registry[_moduleFactory] == 0, "Module factory should not be pre-registered"); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); - require(moduleFactory.getType() != 0); + require(moduleFactory.getType() != 0, "Factory type should not equal to 0"); registry[_moduleFactory] = moduleFactory.getType(); moduleList[moduleFactory.getType()].push(_moduleFactory); reputation[_moduleFactory] = new address[](0); @@ -62,7 +63,7 @@ contract ModuleRegistry is IModuleRegistry, Ownable { */ function verifyModule(address _moduleFactory, bool _verified) external onlyOwner returns(bool) { //Must already have been registered - require(registry[_moduleFactory] != 0); + require(registry[_moduleFactory] != 0, "Module factory should have been already registered"); verified[_moduleFactory] = _verified; emit LogModuleVerified(_moduleFactory, _verified); return true; @@ -73,7 +74,7 @@ contract ModuleRegistry is IModuleRegistry, Ownable { * @param _securityTokenRegistry is the address of the token registry */ function setTokenRegistry(address _securityTokenRegistry) public onlyOwner { - require(_securityTokenRegistry != address(0)); + require(_securityTokenRegistry != address(0), "Address of securityTokenregistry should not be 0x"); securityTokenRegistry = _securityTokenRegistry; } diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 0cce8cfdb..579716c44 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./interfaces/ITickerRegistry.sol"; import "./tokens/SecurityToken.sol"; @@ -16,7 +16,7 @@ contract SecurityTokenRegistry is Ownable, ISecurityTokenRegistry, Util { * @dev Constructor used to set the essentials addresses to facilitate * the creation of the security token */ - function SecurityTokenRegistry( + constructor ( address _polyAddress, address _moduleRegistry, address _tickerRegistry, @@ -40,8 +40,8 @@ contract SecurityTokenRegistry is Ownable, ISecurityTokenRegistry, Util { * @param _tokenDetails off-chain details of the token */ function generateSecurityToken(string _name, string _symbol, uint8 _decimals, bytes32 _tokenDetails) public { - require(bytes(_name).length > 0 && bytes(_symbol).length > 0); - require(ITickerRegistry(tickerRegistry).checkValidity(_symbol, msg.sender, _name)); + require(bytes(_name).length > 0 && bytes(_symbol).length > 0, "Name and Symbol string length should be greater than 0"); + require(ITickerRegistry(tickerRegistry).checkValidity(_symbol, msg.sender, _name), "Trying to use non-valid symbol"); string memory symbol = upper(_symbol); address newSecurityTokenAddress = ISTProxy(protocolVersionST[protocolVersion]).deployToken( _name, diff --git a/contracts/TickerRegistry.sol b/contracts/TickerRegistry.sol index c84ee6b63..e2ae6d6b4 100644 --- a/contracts/TickerRegistry.sol +++ b/contracts/TickerRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; /* Allows issuers to reserve their token symbols ahead of actually generating their security token. @@ -43,7 +43,7 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { // Emit when the token symbol expiry get changed event LogChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); - function TickerRegistry() public { + constructor() public { } @@ -57,9 +57,9 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { * @param _swarmHash Off-chain details of the issuer and token */ function registerTicker(address _owner, string _symbol, string _tokenName, bytes32 _swarmHash) public { - require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10); + require(bytes(_symbol).length > 0 && bytes(_symbol).length <= 10, "Ticker length should always between 0 & 10"); string memory symbol = upper(_symbol); - require(expiryCheck(symbol)); + require(expiryCheck(symbol), "Ticker is already reserved"); registeredSymbols[symbol] = SymbolDetails(_owner, now, _tokenName, _swarmHash, false); emit LogRegisterTicker (_owner, symbol, _tokenName, _swarmHash, now); } @@ -69,7 +69,7 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { * @param _newExpiry new time period for token symbol expiry */ function changeExpiryLimit(uint256 _newExpiry) public onlyOwner { - require(_newExpiry >= 1 days); + require(_newExpiry >= 1 days, "Expiry should greater than or equal to 1 day"); uint256 _oldExpiry = expiryLimit; expiryLimit = _newExpiry; emit LogChangeExpiryLimit(_oldExpiry, _newExpiry); @@ -81,7 +81,7 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { * @return bool */ function setTokenRegistry(address _stRegistry) public onlyOwner returns(bool) { - require(_stRegistry != address(0) && strAddress == address(0)); + require(_stRegistry != address(0) && strAddress == address(0), "Token registry contract is already set or input argument is 0x"); strAddress = _stRegistry; return true; } @@ -95,10 +95,10 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { */ function checkValidity(string _symbol, address _owner, string _tokenName) public returns(bool) { string memory symbol = upper(_symbol); - require(msg.sender == strAddress); - require(registeredSymbols[symbol].status != true); - require(registeredSymbols[symbol].owner == _owner); - require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now); + require(msg.sender == strAddress, "msg.sender should be SecurityTokenRegistry contract"); + require(registeredSymbols[symbol].status != true, "Symbol status should not equal to true"); + require(registeredSymbols[symbol].owner == _owner, "Owner of the symbol should matched with the requested issuer address"); + require(registeredSymbols[symbol].timestamp.add(expiryLimit) >= now, "Ticker should not be expired"); registeredSymbols[symbol].tokenName = _tokenName; registeredSymbols[symbol].status = true; return true; diff --git a/contracts/helpers/PolyToken.sol b/contracts/helpers/PolyToken.sol index b61fb52f2..5674e0861 100644 --- a/contracts/helpers/PolyToken.sol +++ b/contracts/helpers/PolyToken.sol @@ -1,11 +1,11 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "zeppelin-solidity/contracts/token/ERC20/MintableToken.sol"; contract PolyToken is MintableToken { - function PolyToken() public { + constructor () public { } diff --git a/contracts/helpers/Util.sol b/contracts/helpers/Util.sol index 05cf91dcf..b7ae21d6c 100644 --- a/contracts/helpers/Util.sol +++ b/contracts/helpers/Util.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract Util { diff --git a/contracts/interfaces/IModule.sol b/contracts/interfaces/IModule.sol index ed68d096a..842518460 100644 --- a/contracts/interfaces/IModule.sol +++ b/contracts/interfaces/IModule.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ISecurityToken.sol"; import "./IModuleFactory.sol"; @@ -15,7 +15,7 @@ contract IModule { ERC20 public polyToken; - function IModule(address _securityToken, address _polyAddress) public { + constructor (address _securityToken, address _polyAddress) public { securityToken = _securityToken; factory = msg.sender; polyToken = ERC20(_polyAddress); diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index e9ef7fa4b..89560187c 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; @@ -9,7 +9,7 @@ contract IModuleFactory is Ownable { ERC20 public polyToken; - function IModuleFactory(address _polyAddress) public { + constructor (address _polyAddress) public { polyToken = ERC20(_polyAddress); } diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index 13bf859ad..0b6c430c6 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; //Simple interface that any module contracts should implement diff --git a/contracts/interfaces/IST20.sol b/contracts/interfaces/IST20.sol index c45c3739b..de367d14d 100644 --- a/contracts/interfaces/IST20.sol +++ b/contracts/interfaces/IST20.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract IST20 { diff --git a/contracts/interfaces/ISTProxy.sol b/contracts/interfaces/ISTProxy.sol index 1c6276fe7..cdc96710b 100644 --- a/contracts/interfaces/ISTProxy.sol +++ b/contracts/interfaces/ISTProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract ISTProxy { diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index ba672f828..f853d856c 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./IST20.sol"; import "zeppelin-solidity/contracts/ownership/Ownable.sol"; diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 7d6957184..b1627aae6 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ISecurityToken.sol"; diff --git a/contracts/interfaces/ITickerRegistry.sol b/contracts/interfaces/ITickerRegistry.sol index 87a9abb32..38ffaed9f 100644 --- a/contracts/interfaces/ITickerRegistry.sol +++ b/contracts/interfaces/ITickerRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; contract ITickerRegistry { diff --git a/contracts/modules/PermissionManager/GeneralPermissionManager.sol b/contracts/modules/PermissionManager/GeneralPermissionManager.sol index 9180b4e80..4e9c420c0 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManager.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./IPermissionManager.sol"; @@ -25,7 +25,7 @@ contract GeneralPermissionManager is IPermissionManager { event LogAddPermission(address _delegate, bytes32 _details, uint256 _timestamp); /// @notice constructor - function GeneralPermissionManager(address _securityToken, address _polyAddress) public + constructor (address _securityToken, address _polyAddress) public IModule(_securityToken, _polyAddress) { } diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index 05bc9bfd3..80e8e6a69 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./GeneralPermissionManager.sol"; import "../../interfaces/IModuleFactory.sol"; @@ -6,15 +6,15 @@ import "../../interfaces/IModuleFactory.sol"; contract GeneralPermissionManagerFactory is IModuleFactory { - function GeneralPermissionManagerFactory(address _polyAddress) public - IModuleFactory(_polyAddress) + constructor (address _polyAddress) public + IModuleFactory(_polyAddress) { } function deploy(bytes /* _data */) external returns(address) { if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); return address(new GeneralPermissionManager(msg.sender, address(polyToken))); } diff --git a/contracts/modules/PermissionManager/IPermissionManager.sol b/contracts/modules/PermissionManager/IPermissionManager.sol index 7d5f665c9..e832fad3d 100644 --- a/contracts/modules/PermissionManager/IPermissionManager.sol +++ b/contracts/modules/PermissionManager/IPermissionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "../../interfaces/IModule.sol"; diff --git a/contracts/modules/STO/CappedSTO.sol b/contracts/modules/STO/CappedSTO.sol index c74c39b0d..dac1d2d1e 100644 --- a/contracts/modules/STO/CappedSTO.sol +++ b/contracts/modules/STO/CappedSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ISTO.sol"; import "../../interfaces/IST20.sol"; @@ -41,7 +41,7 @@ contract CappedSTO is ISTO { */ event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); - function CappedSTO(address _securityToken, address _polyAddress) public + constructor (address _securityToken, address _polyAddress) public IModule(_securityToken, _polyAddress) { } @@ -66,10 +66,10 @@ contract CappedSTO is ISTO { public onlyFactory { - require(_rate > 0); - require(_fundsReceiver != address(0)); - require(_startTime >= now && _endTime > _startTime); - require(_cap > 0); + require(_rate > 0, "Rate of token should be greater than 0"); + require(_fundsReceiver != address(0), "Zero address is not permitted"); + require(_startTime >= now && _endTime > _startTime, "Date parameters are not valid"); + require(_cap > 0, "Cap should be greater than 0"); startTime = _startTime; endTime = _endTime; cap = _cap; @@ -88,7 +88,7 @@ contract CappedSTO is ISTO { * @param _beneficiary Address performing the token purchase */ function buyTokens(address _beneficiary) public payable { - require(fundraiseType == FundraiseType.ETH); + require(fundraiseType == FundraiseType.ETH, "ETH should be the mode of investment"); uint256 weiAmount = msg.value; _processTx(_beneficiary, weiAmount); @@ -102,8 +102,8 @@ contract CappedSTO is ISTO { * @param _investedPOLY Amount of POLY invested */ function buyTokensWithPoly(uint256 _investedPOLY) public { - require(fundraiseType == FundraiseType.POLY); - require(verifyInvestment(msg.sender, _investedPOLY)); + require(fundraiseType == FundraiseType.POLY, "POLY should be the mode of investment"); + require(verifyInvestment(msg.sender, _investedPOLY), "Not valid Investment"); _processTx(msg.sender, _investedPOLY); _forwardPoly(msg.sender, wallet, _investedPOLY); _postValidatePurchase(msg.sender, _investedPOLY); @@ -171,10 +171,10 @@ contract CappedSTO is ISTO { * @param _investedAmount Value in wei involved in the purchase */ function _preValidatePurchase(address _beneficiary, uint256 _investedAmount) internal view { - require(_beneficiary != address(0)); - require(_investedAmount != 0); - require(tokensSold.add(_getTokenAmount(_investedAmount)) <= cap); - require(now >= startTime && now <= endTime); + require(_beneficiary != address(0), "Beneficiary address should not be 0x"); + require(_investedAmount != 0, "Amount invested should not be equal to 0"); + require(tokensSold.add(_getTokenAmount(_investedAmount)) <= cap, "Investment more than cap is not allowed"); + require(now >= startTime && now <= endTime, "Offering is closed/Not yet started"); } /** @@ -192,7 +192,7 @@ contract CappedSTO is ISTO { * @param _tokenAmount Number of tokens to be emitted */ function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { - require(IST20(securityToken).mint(_beneficiary, _tokenAmount)); + require(IST20(securityToken).mint(_beneficiary, _tokenAmount), "Error in minting the tokens"); } /** diff --git a/contracts/modules/STO/CappedSTOFactory.sol b/contracts/modules/STO/CappedSTOFactory.sol index d741dc463..0bc9f5428 100644 --- a/contracts/modules/STO/CappedSTOFactory.sol +++ b/contracts/modules/STO/CappedSTOFactory.sol @@ -7,7 +7,7 @@ import "../../interfaces/IModule.sol"; contract CappedSTOFactory is IModuleFactory { - function CappedSTOFactory(address _polyAddress) public + constructor (address _polyAddress) public IModuleFactory(_polyAddress) { @@ -15,12 +15,12 @@ contract CappedSTOFactory is IModuleFactory { function deploy(bytes _data) external returns(address) { if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); //Check valid bytes - can only call module init function CappedSTO cappedSTO = new CappedSTO(msg.sender, address(polyToken)); //Checks that _data is valid (not calling anything it shouldn't) - require(getSig(_data) == cappedSTO.getInitFunction()); - require(address(cappedSTO).call(_data)); + require(getSig(_data) == cappedSTO.getInitFunction(), "Provided data is not valid"); + require(address(cappedSTO).call(_data), "Un-successfull call"); return address(cappedSTO); } diff --git a/contracts/modules/STO/DummySTO.sol b/contracts/modules/STO/DummySTO.sol index a7ef8b880..7f2792cbc 100644 --- a/contracts/modules/STO/DummySTO.sol +++ b/contracts/modules/STO/DummySTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ISTO.sol"; import "../../interfaces/IST20.sol"; @@ -19,7 +19,7 @@ contract DummySTO is ISTO { mapping (address => uint256) public investors; - function DummySTO(address _securityToken, address _polyAddress) public + constructor (address _securityToken, address _polyAddress) public IModule(_securityToken, _polyAddress) { } @@ -36,7 +36,7 @@ contract DummySTO is ISTO { } function generateTokens(address _investor, uint256 _amount) public onlyOwner { - require(_amount > 0); + require(_amount > 0, "Amount should be greater than 0"); IST20(securityToken).mint(_investor, _amount); if (investors[_investor] == 0) { investorCount = investorCount + 1; diff --git a/contracts/modules/STO/DummySTOFactory.sol b/contracts/modules/STO/DummySTOFactory.sol index a4324d713..a3ec20dc7 100644 --- a/contracts/modules/STO/DummySTOFactory.sol +++ b/contracts/modules/STO/DummySTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./DummySTO.sol"; import "../../interfaces/IModuleFactory.sol"; @@ -7,7 +7,7 @@ import "../../interfaces/IModule.sol"; contract DummySTOFactory is IModuleFactory { - function DummySTOFactory(address _polyAddress) public + constructor (address _polyAddress) public IModuleFactory(_polyAddress) { @@ -15,13 +15,13 @@ contract DummySTOFactory is IModuleFactory { function deploy(bytes _data) external returns(address) { - if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + if (getCost() > 0) + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); //Check valid bytes - can only call module init function DummySTO dummySTO = new DummySTO(msg.sender, address(polyToken)); //Checks that _data is valid (not calling anything it shouldn't) - require(getSig(_data) == dummySTO.getInitFunction()); - require(address(dummySTO).call(_data)); + require(getSig(_data) == dummySTO.getInitFunction(), "Provided data is not valid"); + require(address(dummySTO).call(_data), "Un-successfull call"); return address(dummySTO); } diff --git a/contracts/modules/STO/ISTO.sol b/contracts/modules/STO/ISTO.sol index 90efcc6a6..5a4350850 100644 --- a/contracts/modules/STO/ISTO.sol +++ b/contracts/modules/STO/ISTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "../../interfaces/IModule.sol"; import "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"; @@ -22,12 +22,12 @@ contract ISTO is IModule { function getNumberInvestors() public view returns (uint256); function _check(uint8 _fundraiseType, address _polyToken) internal { - require(_fundraiseType == 0 || _fundraiseType == 1); + require(_fundraiseType == 0 || _fundraiseType == 1, "Not a valid fundraise type"); if (_fundraiseType == 0) { fundraiseType = FundraiseType.ETH; } if (_fundraiseType == 1) { - require(_polyToken != address(0)); + require(_polyToken != address(0), "Address of the polyToken should not be 0x"); fundraiseType = FundraiseType.POLY; polyAddress = _polyToken; } diff --git a/contracts/modules/TransferManager/ExchangeTransferManager.sol b/contracts/modules/TransferManager/ExchangeTransferManager.sol index 5a7ebfe48..49a969435 100644 --- a/contracts/modules/TransferManager/ExchangeTransferManager.sol +++ b/contracts/modules/TransferManager/ExchangeTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ITransferManager.sol"; @@ -16,7 +16,7 @@ contract ExchangeTransferManager is ITransferManager { event LogModifyWhitelist(address _investor, uint256 _dateAdded, address _addedBy); - function ExchangeTransferManager(address _securityToken, address _polyAddress) + constructor (address _securityToken, address _polyAddress) public IModule(_securityToken, _polyAddress) { @@ -46,7 +46,7 @@ contract ExchangeTransferManager is ITransferManager { } function modifyWhitelistMulti(address[] _investors, bool[] _valids) public onlyFactoryOwner { - require(_investors.length == _valids.length); + require(_investors.length == _valids.length, "Length of arrays are un-equal"); for (uint256 i = 0; i < _investors.length; i++) { modifyWhitelist(_investors[i], _valids[i]); } diff --git a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol index 1d5fd5464..ebdd17c7f 100644 --- a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ExchangeTransferManager.sol"; import "../../interfaces/IModuleFactory.sol"; @@ -6,7 +6,7 @@ import "../../interfaces/IModuleFactory.sol"; contract ExchangeTransferManagerFactory is IModuleFactory { - function ExchangeTransferManagerFactory(address _polyAddress) public + constructor (address _polyAddress) public IModuleFactory(_polyAddress) { @@ -14,10 +14,10 @@ contract ExchangeTransferManagerFactory is IModuleFactory { function deploy(bytes _data) external returns(address) { if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); ExchangeTransferManager exchangeTransferManager = new ExchangeTransferManager(msg.sender, address(polyToken)); - require(getSig(_data) == exchangeTransferManager.getInitFunction()); - require(address(exchangeTransferManager).call(_data)); + require(getSig(_data) == exchangeTransferManager.getInitFunction(), "Provided data is not valid"); + require(address(exchangeTransferManager).call(_data), "Un-successfull call"); return address(exchangeTransferManager); } diff --git a/contracts/modules/TransferManager/GeneralTransferManager.sol b/contracts/modules/TransferManager/GeneralTransferManager.sol index df7d37908..d2c9f0f5f 100644 --- a/contracts/modules/TransferManager/GeneralTransferManager.sol +++ b/contracts/modules/TransferManager/GeneralTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./ITransferManager.sol"; @@ -51,7 +51,7 @@ contract GeneralTransferManager is ITransferManager { uint256 _toTime ); - function GeneralTransferManager(address _securityToken, address _polyAddress) + constructor (address _securityToken, address _polyAddress) public IModule(_securityToken, _polyAddress) { diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index cd5e5fdb0..b7e23081b 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./GeneralTransferManager.sol"; import "../../interfaces/IModuleFactory.sol"; @@ -6,15 +6,15 @@ import "../../interfaces/IModuleFactory.sol"; contract GeneralTransferManagerFactory is IModuleFactory { - function GeneralTransferManagerFactory(address _polyAddress) public + constructor (address _polyAddress) public IModuleFactory(_polyAddress) { } function deploy(bytes /* _data */) external returns(address) { - if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + if (getCost() > 0) + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); return address(new GeneralTransferManager(msg.sender, address(polyToken))); } diff --git a/contracts/modules/TransferManager/ITransferManager.sol b/contracts/modules/TransferManager/ITransferManager.sol index 5bc61963d..3b6ec1ea7 100644 --- a/contracts/modules/TransferManager/ITransferManager.sol +++ b/contracts/modules/TransferManager/ITransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "../../interfaces/IModule.sol"; diff --git a/contracts/tokens/STVersionProxy001.sol b/contracts/tokens/STVersionProxy001.sol index b295a3f6d..014b68902 100644 --- a/contracts/tokens/STVersionProxy001.sol +++ b/contracts/tokens/STVersionProxy001.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./SecurityToken.sol"; import "../SecurityTokenRegistry.sol"; @@ -14,7 +14,7 @@ contract STVersionProxy001 is ISTProxy { bool addTransferManager = true; bool addPermissionManager = true; - function STVersionProxy001(address _transferManagerFactory, address _permissionManagerFactory) public { + constructor (address _transferManagerFactory, address _permissionManagerFactory) public { transferManagerFactory = _transferManagerFactory; permissionManagerFactory = _permissionManagerFactory; } diff --git a/contracts/tokens/STVersionProxy002.sol b/contracts/tokens/STVersionProxy002.sol index 2c2bfac64..1d1afbd79 100644 --- a/contracts/tokens/STVersionProxy002.sol +++ b/contracts/tokens/STVersionProxy002.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./SecurityTokenV2.sol"; import "../SecurityTokenRegistry.sol"; @@ -14,7 +14,7 @@ contract STVersionProxy002 is ISTProxy { bool addTransferManager = true; bool addPermissionManager = true; - function STVersionProxy002(address _transferManagerFactory, address _permissionManagerFactory) public { + constructor (address _transferManagerFactory, address _permissionManagerFactory) public { transferManagerFactory = _transferManagerFactory; permissionManagerFactory = _permissionManagerFactory; } diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index 513d9c391..0621f9a0f 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "zeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; import "zeppelin-solidity/contracts/token/ERC20/DetailedERC20.sol"; @@ -71,7 +71,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { _; } - function SecurityToken( + constructor ( string _name, string _symbol, uint8 _decimals, @@ -113,17 +113,17 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { //Check that module exists in registry - will throw otherwise IModuleRegistry(moduleRegistry).useModule(_moduleFactory); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); - require(modules[moduleFactory.getType()].length < MAX_MODULES); + require(modules[moduleFactory.getType()].length < MAX_MODULES, "Limit of MAX MODULES is reached"); uint256 moduleCost = moduleFactory.getCost(); - require(moduleCost <= _maxCost); + require(moduleCost <= _maxCost, "Max Cost is always be greater than module cost"); //Check that this module has not already been set as locked - require(!modulesLocked[moduleFactory.getType()]); + require(!modulesLocked[moduleFactory.getType()], "Module has already been set as locked"); //Approve fee for module - require(polyToken.approve(_moduleFactory, moduleCost)); + require(polyToken.approve(_moduleFactory, moduleCost), "Not able to approve the module cost"); //Creates instance of module from factory address module = moduleFactory.deploy(_data); //Approve ongoing budget - require(polyToken.approve(module, _budget)); + require(polyToken.approve(module, _budget), "Not able to approve the budget"); //Add to SecurityToken module map modules[moduleFactory.getType()].push(ModuleData(moduleFactory.getName(), module)); modulesLocked[moduleFactory.getType()] = _locked; @@ -137,9 +137,11 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * @param _moduleIndex is the index of the module within the chosen type */ function removeModule(uint8 _moduleType, uint8 _moduleIndex) external onlyOwner { - require(_moduleIndex < modules[_moduleType].length); - require(modules[_moduleType][_moduleIndex].moduleAddress != address(0)); - require(!modulesLocked[_moduleType]); + require(_moduleIndex < modules[_moduleType].length, + "Module index doesn't exist as per the choosen module type"); + require(modules[_moduleType][_moduleIndex].moduleAddress != address(0), + "Module contract address should not be 0x"); + require(!modulesLocked[_moduleType], "Module should not be locked"); //Take the last member of the list, and replace _moduleIndex with this, then shorten the list by one emit LogModuleRemoved(_moduleType, modules[_moduleType][_moduleIndex].moduleAddress, now); modules[_moduleType][_moduleIndex] = modules[_moduleType][modules[_moduleType].length - 1]; @@ -191,7 +193,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * Owner can transfer POLY to the ST which will be used to pay for modules that require a POLY fee. */ function withdrawPoly(uint256 _amount) public onlyOwner { - require(polyToken.transfer(owner, _amount)); + require(polyToken.transfer(owner, _amount), "In-sufficient balance"); } /** @@ -208,7 +210,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * @dev Overloaded version of the transfer function */ function transfer(address _to, uint256 _value) public returns (bool success) { - require(verifyTransfer(msg.sender, _to, _value)); + require(verifyTransfer(msg.sender, _to, _value), "Transfer is not valid"); return super.transfer(_to, _value); } @@ -216,7 +218,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * @dev Overloaded version of the transferFrom function */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { - require(verifyTransfer(_from, _to, _value)); + require(verifyTransfer(_from, _to, _value), "Transfer is not valid"); return super.transferFrom(_from, _to, _value); } @@ -239,7 +241,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * Can only be called by the STO attached to the token (Or by the ST owner if there's no STO attached yet) */ function mint(address _investor, uint256 _amount) public onlyModule(STO_KEY, true) returns (bool success) { - require(verifyTransfer(address(0), _investor, _amount)); + require(verifyTransfer(address(0), _investor, _amount), "Transfer is not valid"); totalSupply_ = totalSupply_.add(_amount); balances[_investor] = balances[_investor].add(_amount); emit Mint(_investor, _amount); diff --git a/contracts/tokens/SecurityTokenV2.sol b/contracts/tokens/SecurityTokenV2.sol index 3b44629a7..ce5a33b29 100644 --- a/contracts/tokens/SecurityTokenV2.sol +++ b/contracts/tokens/SecurityTokenV2.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "./SecurityToken.sol"; @@ -10,7 +10,7 @@ import "./SecurityToken.sol"; contract SecurityTokenV2 is SecurityToken { bytes32 public securityTokenVersion = "0.0.2"; - function SecurityTokenV2( + constructor ( string _name, string _symbol, uint8 _decimals, diff --git a/test/helpers/contracts/PolyTokenFaucet.sol b/test/helpers/contracts/PolyTokenFaucet.sol index 51df03251..d06251758 100644 --- a/test/helpers/contracts/PolyTokenFaucet.sol +++ b/test/helpers/contracts/PolyTokenFaucet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "zeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/test/helpers/contracts/TestSTOFactory.sol b/test/helpers/contracts/TestSTOFactory.sol index b20ab7bd5..40db6a6f7 100644 --- a/test/helpers/contracts/TestSTOFactory.sol +++ b/test/helpers/contracts/TestSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.21; +pragma solidity ^0.4.23; import "../../../contracts/modules/STO/DummySTO.sol"; import "../../../contracts/interfaces/IModuleFactory.sol"; @@ -7,7 +7,7 @@ import "../../../contracts/interfaces/IModule.sol"; contract TestSTOFactory is IModuleFactory { - function TestSTOFactory(address _polyAddress) public + constructor (address _polyAddress) public IModuleFactory(_polyAddress) { @@ -15,12 +15,12 @@ contract TestSTOFactory is IModuleFactory { function deploy(bytes _data) external returns(address) { if(getCost() > 0) - require(polyToken.transferFrom(msg.sender, owner, getCost())); + require(polyToken.transferFrom(msg.sender, owner, getCost()), "Failed transferFrom because of sufficent Allowance is not provided"); //Check valid bytes - can only call module init function DummySTO dummySTO = new DummySTO(msg.sender, address(polyToken)); //Checks that _data is valid (not calling anything it shouldn't) - require(getSig(_data) == dummySTO.getInitFunction()); - require(address(dummySTO).call(_data)); + require(getSig(_data) == dummySTO.getInitFunction(), "Provided data is not valid"); + require(address(dummySTO).call(_data), "Un-successfull call"); return address(dummySTO); }