diff --git a/contracts/FeatureRegistry.sol b/contracts/FeatureRegistry.sol index 1fbbb2134..ea13f0297 100644 --- a/contracts/FeatureRegistry.sol +++ b/contracts/FeatureRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./ReclaimTokens.sol"; import "./interfaces/IFeatureRegistry.sol"; @@ -9,8 +9,6 @@ import "./interfaces/IFeatureRegistry.sol"; contract FeatureRegistry is IFeatureRegistry, ReclaimTokens { mapping(bytes32 => bool) public featureStatus; - event ChangeFeatureStatus(string _nameKey, bool _newStatus); - /** * @notice Get the status of a feature * @param _nameKey is the key for the feature status mapping diff --git a/contracts/Migrations.sol b/contracts/Migrations.sol index a15e3c71b..610cba54d 100644 --- a/contracts/Migrations.sol +++ b/contracts/Migrations.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract Migrations { address public owner; diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index 3ed36954c..92c27b7a3 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IModuleRegistry.sol"; @@ -43,28 +43,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { bytes32 constant POLYMATHREGISTRY = 0x90eeab7c36075577c7cc5ff366e389fefa8a18289b949bab3529ab4471139d4d; //keccak256("polymathRegistry") bytes32 constant FEATURE_REGISTRY = 0xed9ca06607835ad25ecacbcb97f2bc414d4a51ecf391b5ae42f15991227ab146; //keccak256("featureRegistry") bytes32 constant SECURITY_TOKEN_REGISTRY = 0x12ada4f7ee6c2b7b933330be61fefa007a1f497dc8df1b349b48071a958d7a81; //keccak256("securityTokenRegistry") - - /////////// - // Events - ////////// - - // Emit when network becomes paused - event Pause(address account); - // Emit when network becomes unpaused - event Unpause(address account); - // Emit when Module is used by the SecurityToken - event ModuleUsed(address indexed _moduleFactory, address indexed _securityToken); - // Emit when the Module Factory gets registered on the ModuleRegistry contract - event ModuleRegistered(address indexed _moduleFactory, address indexed _owner); - // Emit when the module gets verified by Polymath - event ModuleVerified(address indexed _moduleFactory); - // Emit when the module gets unverified by Polymath or the factory owner - event ModuleUnverified(address indexed _moduleFactory); - // Emit when a ModuleFactory is removed by Polymath - event ModuleRemoved(address indexed _moduleFactory, address indexed _decisionMaker); - // Emit when ownership gets transferred - event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); - + /////////////// //// Modifiers /////////////// diff --git a/contracts/Pausable.sol b/contracts/Pausable.sol index 184987439..717423b02 100644 --- a/contracts/Pausable.sol +++ b/contracts/Pausable.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Utility contract to allow pausing and unpausing of certain functions diff --git a/contracts/PolymathRegistry.sol b/contracts/PolymathRegistry.sol index f80144b43..0c0fc9220 100644 --- a/contracts/PolymathRegistry.sol +++ b/contracts/PolymathRegistry.sol @@ -1,15 +1,14 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./ReclaimTokens.sol"; +import "./interfaces/IPolymathRegistry.sol"; /** * @title Core functionality for registry upgradability */ -contract PolymathRegistry is ReclaimTokens { +contract PolymathRegistry is ReclaimTokens, IPolymathRegistry { mapping(bytes32 => address) public storedAddresses; - event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); - /** * @notice Gets the contract address * @param _nameKey is the key for the contract address mapping diff --git a/contracts/ReclaimTokens.sol b/contracts/ReclaimTokens.sol index 75b8cb192..f14171027 100644 --- a/contracts/ReclaimTokens.sol +++ b/contracts/ReclaimTokens.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/STRGetter.sol b/contracts/STRGetter.sol index 62ca4955f..34dbfb262 100644 --- a/contracts/STRGetter.sol +++ b/contracts/STRGetter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./storage/EternalStorage.sol"; import "./interfaces/ISecurityToken.sol"; diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 22df7ccda..751511a79 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -1,10 +1,17 @@ +/** + // + IMPORTANT: Developer should update the ISecurityTokenRegistry.sol (Interface) if there is any change in + function signature or addition/removal of the functions from SecurityTokenRegistry & STRGetter contract. + // + + */ + pragma solidity ^0.5.0; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "./interfaces/IOwnable.sol"; import "./interfaces/ISTFactory.sol"; -import "./interfaces/ISecurityTokenRegistry.sol"; import "./interfaces/ISecurityToken.sol"; import "./interfaces/IPolymathRegistry.sol"; import "./interfaces/IOracle.sol"; @@ -333,7 +340,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { // Attempt to charge the reg fee if it is > 0 USD (uint256 usdFee, uint256 polyFee) = _takeFee(TICKERREGFEE); string memory ticker = Util.upper(_ticker); - require(_tickerAvailable(ticker), "Ticker reserved"); + require(tickerAvailable(ticker), "Ticker reserved"); // Check whether ticker was previously registered (and expired) address previousOwner = _tickerOwner(ticker); if (previousOwner != address(0)) { @@ -462,11 +469,11 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { } /** - * @notice Internal - Checks if the entered ticker is registered and has not expired + * @notice Checks if the entered ticker is registered and has not expired * @param _ticker is the token ticker * @return bool */ - function _tickerAvailable(string memory _ticker) internal view returns(bool) { + function tickerAvailable(string memory _ticker) public view returns(bool) { if (_tickerOwner(_ticker) != address(0)) { /*solium-disable-next-line security/no-block-members*/ if ((now > getUintValue(Encoder.getKey("registeredTickers_expiryDate", _ticker))) && !_tickerStatus(_ticker)) { diff --git a/contracts/datastore/DataStore.sol b/contracts/datastore/DataStore.sol index 50a397838..f0e7ee0fe 100644 --- a/contracts/datastore/DataStore.sol +++ b/contracts/datastore/DataStore.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/ISecurityToken.sol"; import "../interfaces/IOwnable.sol"; diff --git a/contracts/datastore/DataStoreFactory.sol b/contracts/datastore/DataStoreFactory.sol index 3b088f999..1281ac755 100644 --- a/contracts/datastore/DataStoreFactory.sol +++ b/contracts/datastore/DataStoreFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./DataStoreProxy.sol"; diff --git a/contracts/datastore/DataStoreProxy.sol b/contracts/datastore/DataStoreProxy.sol index 1afb27e0d..e8acae6bf 100644 --- a/contracts/datastore/DataStoreProxy.sol +++ b/contracts/datastore/DataStoreProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../proxy/Proxy.sol"; import "./DataStoreStorage.sol"; diff --git a/contracts/datastore/DataStoreStorage.sol b/contracts/datastore/DataStoreStorage.sol index 4f1a5330f..c3bc04b25 100644 --- a/contracts/datastore/DataStoreStorage.sol +++ b/contracts/datastore/DataStoreStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/ISecurityToken.sol"; diff --git a/contracts/external/IMedianizer.sol b/contracts/external/IMedianizer.sol index aebe8f77a..94541a5ed 100644 --- a/contracts/external/IMedianizer.sol +++ b/contracts/external/IMedianizer.sol @@ -1,5 +1,5 @@ /* solium-disable */ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to MakerDAO Medianizer contract diff --git a/contracts/interfaces/ICheckPermission.sol b/contracts/interfaces/ICheckPermission.sol index cf9448801..cbf3129b9 100644 --- a/contracts/interfaces/ICheckPermission.sol +++ b/contracts/interfaces/ICheckPermission.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface ICheckPermission { /** diff --git a/contracts/interfaces/IDataStore.sol b/contracts/interfaces/IDataStore.sol index 33df6b934..331e56748 100644 --- a/contracts/interfaces/IDataStore.sol +++ b/contracts/interfaces/IDataStore.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IDataStore { /** diff --git a/contracts/interfaces/IFeatureRegistry.sol b/contracts/interfaces/IFeatureRegistry.sol index afbb9f223..ee6c931a8 100644 --- a/contracts/interfaces/IFeatureRegistry.sol +++ b/contracts/interfaces/IFeatureRegistry.sol @@ -1,9 +1,20 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface for managing polymath feature switches */ interface IFeatureRegistry { + + event ChangeFeatureStatus(string _nameKey, bool _newStatus); + + /** + * @notice change a feature status + * @dev feature status is set to false by default + * @param _nameKey is the key for the feature status mapping + * @param _newStatus is the new feature status + */ + function setFeatureStatus(string calldata _nameKey, bool _newStatus) external; + /** * @notice Get the status of a feature * @param _nameKey is the key for the feature status mapping diff --git a/contracts/interfaces/IModule.sol b/contracts/interfaces/IModule.sol index cc263c4f7..210e71e4e 100644 --- a/contracts/interfaces/IModule.sol +++ b/contracts/interfaces/IModule.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface that every module contract should implement diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index 99810470e..48630a500 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface that every module factory contract should implement @@ -91,4 +91,28 @@ interface IModuleFactory { */ function upperSTVersionBounds() external view returns(uint8[] memory upperBounds); + /** + * @notice Updates the tags of the ModuleFactory + * @param _tagsData New list of tags + */ + function changeTags(bytes32[] calldata _tagsData) external; + + /** + * @notice Updates the name of the ModuleFactory + * @param _name New name that will replace the old one. + */ + function changeName(bytes32 _name) external; + + /** + * @notice Updates the description of the ModuleFactory + * @param _description New description that will replace the old one. + */ + function changeDescription(string calldata _description) external; + + /** + * @notice Updates the title of the ModuleFactory + * @param _title New Title that will replace the old one. + */ + function changeTitle(string calldata _title) external; + } diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index ef4fab666..44785c074 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -1,9 +1,32 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface for the Polymath Module Registry contract */ interface IModuleRegistry { + + /////////// + // Events + ////////// + + // Emit when network becomes paused + event Pause(address account); + // Emit when network becomes unpaused + event Unpause(address account); + // Emit when Module is used by the SecurityToken + event ModuleUsed(address indexed _moduleFactory, address indexed _securityToken); + // Emit when the Module Factory gets registered on the ModuleRegistry contract + event ModuleRegistered(address indexed _moduleFactory, address indexed _owner); + // Emit when the module gets verified by Polymath + event ModuleVerified(address indexed _moduleFactory); + // Emit when the module gets unverified by Polymath or the factory owner + event ModuleUnverified(address indexed _moduleFactory); + // Emit when a ModuleFactory is removed by Polymath + event ModuleRemoved(address indexed _moduleFactory, address indexed _decisionMaker); + // Emit when ownership gets transferred + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + + /** * @notice Called by a security token to notify the registry it is using a module * @param _moduleFactory is the address of the relevant module factory @@ -78,7 +101,7 @@ interface IModuleRegistry { * @param _moduleType Type of Module * @return address array that contains the list of addresses of module factory contracts. */ - function getAllModulesByType(uint8 _moduleType) external view returns(address[] memory); + function getAllModulesByType(uint8 _moduleType) external view returns(address[] memory factories); /** * @notice Returns the list of addresses of Module Factory of a particular type * @param _moduleType Type of Module @@ -111,4 +134,26 @@ interface IModuleRegistry { */ function isPaused() external view returns(bool paused); + /** + * @notice Reclaims all ERC20Basic compatible tokens + * @param _tokenContract The address of the token contract + */ + function reclaimERC20(address _tokenContract) external; + + /** + * @notice Called by the owner to pause, triggers stopped state + */ + function pause() external; + + /** + * @notice Called by the owner to unpause, returns to normal state + */ + function unpause() external; + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param _newOwner The address to transfer ownership to. + */ + function transferOwnership(address _newOwner) external; + } diff --git a/contracts/interfaces/IOracle.sol b/contracts/interfaces/IOracle.sol index 89bcc8856..c590f6e48 100644 --- a/contracts/interfaces/IOracle.sol +++ b/contracts/interfaces/IOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IOracle { /** diff --git a/contracts/interfaces/IOwnable.sol b/contracts/interfaces/IOwnable.sol index 8680cfd41..2eb7b59a9 100644 --- a/contracts/interfaces/IOwnable.sol +++ b/contracts/interfaces/IOwnable.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Ownable diff --git a/contracts/interfaces/IPoly.sol b/contracts/interfaces/IPoly.sol index 0de0cc753..4c936d982 100644 --- a/contracts/interfaces/IPoly.sol +++ b/contracts/interfaces/IPoly.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title ERC20 interface diff --git a/contracts/interfaces/IPolymathRegistry.sol b/contracts/interfaces/IPolymathRegistry.sol index bc89d5081..24401ada3 100644 --- a/contracts/interfaces/IPolymathRegistry.sol +++ b/contracts/interfaces/IPolymathRegistry.sol @@ -1,6 +1,9 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IPolymathRegistry { + + event ChangeAddress(string _nameKey, address indexed _oldAddress, address indexed _newAddress); + /** * @notice Returns the contract address * @param _nameKey is the key for the contract address mapping @@ -8,4 +11,11 @@ interface IPolymathRegistry { */ function getAddress(string calldata _nameKey) external view returns(address registryAddress); + /** + * @notice Changes the contract address + * @param _nameKey is the key for the contract address mapping + * @param _newAddress is the new contract address + */ + function changeAddress(string calldata _nameKey, address _newAddress) external; + } diff --git a/contracts/interfaces/ISTFactory.sol b/contracts/interfaces/ISTFactory.sol index f88a7cdb9..a2b911f9d 100644 --- a/contracts/interfaces/ISTFactory.sol +++ b/contracts/interfaces/ISTFactory.sol @@ -1,9 +1,18 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface for security token proxy deployment */ interface ISTFactory { + + event LogicContractSet(string _version, address _logicContract, bytes _upgradeData); + event TokenUpgraded( + address indexed _securityToken, + uint256 indexed _version + ); + event DefaultTransferManagerUpdated(address indexed _oldTransferManagerFactory, address indexed _newTransferManagerFactory); + event DefaultDataStoreUpdated(address indexed _oldDataStoreFactory, address indexed _newDataStoreFactory); + /** * @notice Deploys the token and adds default modules like permission manager and transfer manager. * Future versions of the proxy can attach different modules or pass some other paramters. @@ -25,7 +34,36 @@ interface ISTFactory { bool _divisible, address _treasuryWallet, address _polymathRegistry - ) - external + ) + external returns(address tokenAddress); + + /** + * @notice Used to set a new token logic contract + * @param _version Version of upgraded module + * @param _logicContract Address of deployed module logic contract referenced from proxy + * @param _initializationData Initialization data that used to intialize value in the securityToken + * @param _upgradeData Data to be passed in call to upgradeToAndCall when a token upgrades its module + */ + function setLogicContract(string calldata _version, address _logicContract, bytes calldata _initializationData, bytes calldata _upgradeData) external; + + /** + * @notice Used to upgrade a token + * @param _maxModuleType maximum module type enumeration + */ + function upgradeToken(uint8 _maxModuleType) external; + + /** + * @notice Used to set a new default transfer manager + * @dev Setting this to address(0) means don't deploy a default TM + * @param _transferManagerFactory Address of new default transfer manager factory + */ + function updateDefaultTransferManager(address _transferManagerFactory) external; + + /** + * @notice Used to set a new default data store + * @dev Setting this to address(0) means don't deploy a default data store + * @param _dataStoreFactory Address of new default data store factory + */ + function updateDefaultDataStore(address _dataStoreFactory) external; } diff --git a/contracts/interfaces/ISTO.sol b/contracts/interfaces/ISTO.sol index 504df3c8f..ce46ef456 100644 --- a/contracts/interfaces/ISTO.sol +++ b/contracts/interfaces/ISTO.sol @@ -1,12 +1,29 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by all STO modules */ interface ISTO { + + enum FundRaiseType {ETH, POLY, SC} + + // Event + event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes); + /** * @notice Returns the total no. of tokens sold */ function getTokensSold() external view returns(uint256 soldTokens); + /** + * @notice Returns funds raised by the STO + */ + function getRaised(FundRaiseType _fundRaiseType) external view returns(uint256 raisedAmount); + + /** + * @notice Pause (overridden function) + * @dev Only securityToken owner restriction applied on the super function + */ + function pause() external; + } diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index ccd996535..67a2dc2f8 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -1,49 +1,123 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface for all security tokens */ interface ISecurityToken { // Standard ERC20 interface + function symbol() external view returns (string memory); + function name() external view returns (string memory); function decimals() external view returns(uint8); function totalSupply() external view returns(uint256); - function balanceOf(address _owner) external view returns(uint256); - function allowance(address _owner, address _spender) external view returns(uint256); - function transfer(address _to, uint256 _value) external returns(bool); - function transferFrom(address _from, address _to, uint256 _value) external returns(bool); - function approve(address _spender, uint256 _value) external returns(bool); - function decreaseApproval(address _spender, uint _subtractedValue) external returns(bool); - function increaseApproval(address _spender, uint _addedValue) external returns(bool); + function balanceOf(address owner) external view returns(uint256); + function allowance(address owner, address spender) external view returns(uint256); + function transfer(address to, uint256 value) external returns(bool); + function transferFrom(address from, address to, uint256 value) external returns(bool); + function approve(address spender, uint256 value) external returns(bool); + function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool); + function increaseAllowance(address spender, uint256 addedValue) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); - function name() external view returns(string memory); + // Emit at the time when module get added + event ModuleAdded( + uint8[] _types, + bytes32 indexed _name, + address indexed _moduleFactory, + address _module, + uint256 _moduleCost, + uint256 _budget, + bytes32 _label, + bool _archived + ); + + // Emit when the token details get updated + event UpdateTokenDetails(string _oldDetails, string _newDetails); + // Emit when the token name get updated + event UpdateTokenName(string _oldName, string _newName); + // Emit when the granularity get changed + event GranularityChanged(uint256 _oldGranularity, uint256 _newGranularity); + // Emit when is permanently frozen by the issuer + event FreezeIssuance(); + // Emit when transfers are frozen or unfrozen + event FreezeTransfers(bool _status); + // Emit when new checkpoint created + event CheckpointCreated(uint256 indexed _checkpointId, uint256 _investorLength); + // Events to log controller actions + event SetController(address indexed _oldController, address indexed _newController); + //Event emit when the global treasury wallet address get changed + event TreasuryWalletChanged(address _oldTreasuryWallet, address _newTreasuryWallet); + event DisableController(); + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + event TokenUpgraded(uint8 _major, uint8 _minor, uint8 _patch); + + // Emit when Module get archived from the securityToken + event ModuleArchived(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when Module get unarchived from the securityToken + event ModuleUnarchived(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when Module get removed from the securityToken + event ModuleRemoved(uint8[] _types, address _module); //Event emitted by the tokenLib. + // Emit when the budget allocated to a module is changed + event ModuleBudgetChanged(uint8[] _moduleTypes, address _module, uint256 _oldBudget, uint256 _budget); //Event emitted by the tokenLib. + + // Transfer Events + event TransferByPartition( + bytes32 indexed _fromPartition, + address _operator, + address indexed _from, + address indexed _to, + uint256 _value, + bytes _data, + bytes _operatorData + ); - /** - * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the - * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped - * with a reson string to understand the failure cause, table of Ethereum status code will always reside off-chain - * @param _to address The address which you want to transfer to - * @param _value uint256 the amount of tokens to be transferred - * @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer. - * @return bool It signifies whether the transaction will be executed or not. - * @return byte Ethereum status code (ESC) - * @return bytes32 Application specific reason code - */ - function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool isExecuted, byte statusCode, bytes32 reasonCode); + // Operator Events + event AuthorizedOperator(address indexed operator, address indexed tokenHolder); + event RevokedOperator(address indexed operator, address indexed tokenHolder); + event AuthorizedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder); + event RevokedOperatorByPartition(bytes32 indexed partition, address indexed operator, address indexed tokenHolder); + + // Issuance / Redemption Events + event IssuedByPartition(bytes32 indexed partition, address indexed to, uint256 value, bytes data); + event RedeemedByPartition(bytes32 indexed partition, address indexed operator, address indexed from, uint256 value, bytes data, bytes operatorData); + + // Document Events + event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash); + event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash); + + // Controller Events + event ControllerTransfer( + address _controller, + address indexed _from, + address indexed _to, + uint256 _value, + bytes _data, + bytes _operatorData + ); + + event ControllerRedemption( + address _controller, + address indexed _tokenHolder, + uint256 _value, + bytes _data, + bytes _operatorData + ); + + // Issuance / Redemption Events + event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); + event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); /** * @notice Initialization function * @dev Expected to be called atomically with the proxy being created, by the owner of the token * @dev Can only be called once */ - function initialize() external; + function initialize(address _getterDelegate) external; /** * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped * with a reson string to understand the failure cause, table of Ethereum status code will always reside off-chain - * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred * @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer. @@ -51,7 +125,7 @@ interface ISecurityToken { * @return byte Ethereum status code (ESC) * @return bytes32 Application specific reason code */ - function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool isExecuted, byte statusCode, bytes32 reasonCode); + function canTransfer(address _to, uint256 _value, bytes calldata _data) external view returns (bool isExecuted, byte statusCode, bytes32 reasonCode); /** * @notice The standard provides an on-chain function to determine whether a transfer will succeed, @@ -65,7 +139,30 @@ interface ISecurityToken { * @return Application specific reason codes with additional details * @return The partition to which the transferred tokens were allocated for the _to address */ - function canTransferByPartition(address _from, address _to, bytes32 _partition, uint256 _value, bytes calldata _data) external view returns (byte isExecuted, bytes32 statusCode, bytes32 reasonCode); + function canTransferByPartition( + address _from, + address _to, + bytes32 _partition, + uint256 _value, + bytes calldata _data + ) + external + view + returns (byte statusCode, bytes32 reasonCode, bytes32 partition); + + /** + * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the + * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped + * with a reson string to understand the failure cause, table of Ethereum status code will always reside off-chain + * @param _from address The address which you want to send tokens from + * @param _to address The address which you want to transfer to + * @param _value uint256 the amount of tokens to be transferred + * @param _data The `bytes _data` allows arbitrary data to be submitted alongside the transfer. + * @return bool It signifies whether the transaction will be executed or not. + * @return byte Ethereum status code (ESC) + * @return bytes32 Application specific reason code + */ + function canTransferFrom(address _from, address _to, uint256 _value, bytes calldata _data) external view returns (bool isExecuted, byte statusCode, bytes32 reasonCode); /** * @notice Used to attach a new document to the contract, or update the URI or hash of an existing attached document @@ -188,10 +285,6 @@ interface ISecurityToken { bytes calldata _operatorData ) external; - // Issuance / Redemption Events - event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); - event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); - /** * @notice Validate permissions with PermissionManager if it exists, If no Permission return false * @dev Note that IModule withPerm will allow ST owner all permissions anyway @@ -259,9 +352,9 @@ interface ISecurityToken { function getCheckpointTimes() external view returns(uint256[] memory checkpointTimes); /** - * @notice Gets length of investors array - * NB - this length may differ from investorCount if the list has not been pruned of zero-balance investors - * @return Length + * @notice returns an array of investors + * NB - this length may differ from investorCount as it contains all investors that ever held tokens + * @return list of addresses */ function getInvestors() external view returns(address[] memory investors); @@ -385,11 +478,12 @@ interface ISecurityToken { function unfreezeTransfers() external; /** - * @notice Ends token minting period permanently + * @notice Permanently freeze issuance of this security token. + * @dev It MUST NOT be possible to increase `totalSuppy` after this function is called. */ - function freezeIssuance() external; + function freezeIssuance(bytes calldata _signature) external; - /** + /** * @notice Attachs a module to the SecurityToken * @dev E.G.: On deployment (through the STR) ST gets a TransferManager module attached to it * @dev to control restrictions on transfers. @@ -481,7 +575,7 @@ interface ISecurityToken { * @notice Used by the issuer to permanently disable controller functionality * @dev enabled via feature switch "disableControllerAllowed" */ - function disableController() external; + function disableController(bytes calldata _signature) external; /** * @notice Used to get the version of the securityToken @@ -624,4 +718,41 @@ interface ISecurityToken { * @notice Returns if transfers are currently frozen or not */ function transfersFrozen() external view returns (bool isFrozen); + + /** + * @dev Allows the current owner to transfer control of the contract to a newOwner. + * @param newOwner The address to transfer ownership to. + */ + function transferOwnership(address newOwner) external; + + /** + * @return true if `msg.sender` is the owner of the contract. + */ + function isOwner() external view returns (bool); + + /** + * @return the address of the owner. + */ + function owner() external view returns (address ownerAddress); + + function controller() external view returns(address controllerAddress); + + function moduleRegistry() external view returns(address moduleRegistryAddress); + + function securityTokenRegistry() external view returns(address securityTokenRegistryAddress); + + function polyToken() external view returns(address polyTokenAddress); + + function tokenFactory() external view returns(address tokenFactoryAddress); + + function getterDelegate() external view returns(address delegate); + + function controllerDisabled() external view returns(bool isDisabled); + + function initialized() external view returns(bool isInitialized); + + function tokenDetails() external view returns(string memory details); + + function updateFromRegistry() external; + } diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 1a3fb2a74..225b3c13c 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -1,10 +1,105 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface for the Polymath Security Token Registry contract */ interface ISecurityTokenRegistry { + // Emit when network becomes paused + event Pause(address account); + // Emit when network becomes unpaused + event Unpause(address account); + // Emit when the ticker is removed from the registry + event TickerRemoved(string _ticker, address _removedBy); + // Emit when the token ticker expiry is changed + event ChangeExpiryLimit(uint256 _oldExpiry, uint256 _newExpiry); + // Emit when changeSecurityLaunchFee is called + event ChangeSecurityLaunchFee(uint256 _oldFee, uint256 _newFee); + // Emit when changeTickerRegistrationFee is called + event ChangeTickerRegistrationFee(uint256 _oldFee, uint256 _newFee); + // Emit when Fee currency is changed + event ChangeFeeCurrency(bool _isFeeInPoly); + // Emit when ownership gets transferred + event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); + // Emit when ownership of the ticker gets changed + event ChangeTickerOwnership(string _ticker, address indexed _oldOwner, address indexed _newOwner); + // Emit at the time of launching a new security token of version 3.0+ + event NewSecurityTokenCreated( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + bool _fromAdmin, + uint256 _usdFee, + uint256 _polyFee, + uint256 _protocolVersion + ); + // Emit at the time of launching a new security token v2.0. + // _registrationFee is in poly + event NewSecurityToken( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + bool _fromAdmin, + uint256 _registrationFee + ); + // Emit when new ticker get registers + event RegisterTicker( + address indexed _owner, + string _ticker, + uint256 indexed _registrationDate, + uint256 indexed _expiryDate, + bool _fromAdmin, + uint256 _registrationFeePoly, + uint256 _registrationFeeUsd + ); + // Emit after ticker registration + // _registrationFee is in poly + // fee in usd is not being emitted to maintain backwards compatibility + event RegisterTicker( + address indexed _owner, + string _ticker, + string _name, + uint256 indexed _registrationDate, + uint256 indexed _expiryDate, + bool _fromAdmin, + uint256 _registrationFee + ); + // Emit at when issuer refreshes exisiting token + event SecurityTokenRefreshed( + string _ticker, + string _name, + address indexed _securityTokenAddress, + address indexed _owner, + uint256 _addedAt, + address _registrant, + uint256 _protocolVersion + ); + event ProtocolFactorySet(address indexed _STFactory, uint8 _major, uint8 _minor, uint8 _patch); + event LatestVersionSet(uint8 _major, uint8 _minor, uint8 _patch); + event ProtocolFactoryRemoved(address indexed _STFactory, uint8 _major, uint8 _minor, uint8 _patch); + + /** + * @notice Deploys an instance of a new Security Token of version 2.0 and records it to the registry + * @dev this function is for backwards compatibilty with 2.0 dApp. + * @param _name is the name of the token + * @param _ticker is the ticker symbol of the security token + * @param _tokenDetails is the off-chain details of the token + * @param _divisible is whether or not the token is divisible + */ + function generateSecurityToken( + string calldata _name, + string calldata _ticker, + string calldata _tokenDetails, + bool _divisible + ) + external; + /** * @notice Deploys an instance of a new Security Token and records it to the registry * @param _name is the name of the token @@ -16,14 +111,33 @@ interface ISecurityTokenRegistry { * - `_protocolVersion` is the packed value of uin8[3] array (it will be calculated offchain) * - if _protocolVersion == 0 then latest version of securityToken will be generated */ - function generateSecurityToken( + function generateNewSecurityToken( string calldata _name, string calldata _ticker, string calldata _tokenDetails, bool _divisible, address _treasuryWallet, uint256 _protocolVersion - ) external; + ) + external; + + /** + * @notice Deploys an instance of a new Security Token and replaces the old one in the registry + * This can be used to upgrade from version 2.0 of ST to 3.0 or in case something goes wrong with earlier ST + * @dev This function needs to be in STR 3.0. Defined public to avoid stack overflow + * @param _name is the name of the token + * @param _ticker is the ticker symbol of the security token + * @param _tokenDetails is the off-chain details of the token + * @param _divisible is whether or not the token is divisible + */ + function refreshSecurityToken( + string calldata _name, + string calldata _ticker, + string calldata _tokenDetails, + bool _divisible, + address _treasuryWallet + ) + external returns (address securityToken); /** * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) @@ -44,6 +158,41 @@ interface ISecurityTokenRegistry { ) external; + /** + * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) + * @param _ticker is the ticker symbol of the security token + * @param _owner is the owner of the token + * @param _securityToken is the address of the securityToken + * @param _tokenDetails is the off-chain details of the token + * @param _deployedAt is the timestamp at which the security token is deployed + */ + function modifyExistingSecurityToken( + string calldata _ticker, + address _owner, + address _securityToken, + string calldata _tokenDetails, + uint256 _deployedAt + ) + external; + + /** + * @notice Modifies the ticker details. Only Polymath has the ability to do so. + * @notice Only allowed to modify the tickers which are not yet deployed. + * @param _owner is the owner of the token + * @param _ticker is the token ticker + * @param _registrationDate is the date at which ticker is registered + * @param _expiryDate is the expiry date for the ticker + * @param _status is the token deployment status + */ + function modifyExistingTicker( + address _owner, + string calldata _ticker, + uint256 _registrationDate, + uint256 _expiryDate, + bool _status + ) + external; + /** * @notice Registers the token ticker for its particular owner * @notice once the token ticker is registered to its owner then no other issuer can claim @@ -55,15 +204,13 @@ interface ISecurityTokenRegistry { function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external; /** - * @notice Changes the protocol version and the SecurityToken contract - * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions - * @notice Changing versions does not affect existing tokens. - * @param _STFactoryAddress Address of the proxy. - * @param _major Major version of the proxy. - * @param _minor Minor version of the proxy. - * @param _patch Patch version of the proxy - */ - function setProtocolVersion(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) external; + * @notice Registers the token ticker to the selected owner + * @notice Once the token ticker is registered to its owner then no other issuer can claim + * @notice its ownership. If the ticker expires and its issuer hasn't used it, then someone else can take it. + * @param _owner is address of the owner of the token + * @param _ticker is unique token ticker + */ + function registerNewTicker(address _owner, string calldata _ticker) external; /** * @notice Check that Security Token is registered @@ -86,25 +233,36 @@ interface ISecurityTokenRegistry { function getSecurityTokenAddress(string calldata _ticker) external view returns(address tokenAddress); /** - * @notice Get security token data by its address - * @param _securityToken Address of the Scurity token. - * @return string Symbol of the Security Token. - * @return address Address of the issuer of Security Token. - * @return string Details of the Token. - * @return uint256 Timestamp at which Security Token get launched on Polymath platform - * @return version of the securityToken - */ - function getSecurityTokenData(address _securityToken) external view returns(string memory tokenSymbol, address tokenAddress, string memory tokenDetails, uint256 tokenTime, uint8[] memory tokenVersion); + * @notice Returns the security token data by address + * @param _securityToken is the address of the security token. + * @return string is the ticker of the security Token. + * @return address is the issuer of the security Token. + * @return string is the details of the security token. + * @return uint256 is the timestamp at which security Token was deployed. + */ + function getSecurityTokenData(address _securityToken) external view returns ( + string memory tokenSymbol, + address tokenAddress, + string memory tokenDetails, + uint256 tokenTime, + uint8[] memory tokenVersion + ); /** * @notice Get the current STFactory Address */ function getSTFactoryAddress() external view returns(address stFactoryAddress); + /** + * @notice Returns the STFactory Address of a particular version + * @param _protocolVersion Packed protocol version + */ + function getSTFactoryAddressOfVersion(uint256 _protocolVersion) external view returns(address stFactory); + /** * @notice Get Protocol version */ - function getProtocolVersion() external view returns(uint8[] memory protocolVersion); + function getLatestProtocolVersion() external view returns(uint8[] memory protocolVersion); /** * @notice Used to get the ticker list as per the owner @@ -195,17 +353,69 @@ interface ISecurityTokenRegistry { */ function changeFeesAmountAndCurrency(uint256 _tickerRegFee, uint256 _stLaunchFee, bool _isFeeInPoly) external; + /** + * @notice Changes the SecurityToken contract for a particular factory version + * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions + * @notice Changing versions does not affect existing tokens. + * @param _STFactoryAddress is the address of the proxy. + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function setProtocolFactory(address _STFactoryAddress, uint8 _major, uint8 _minor, uint8 _patch) external; + + /** + * @notice Removes a STFactory + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function removeProtocolFactory(uint8 _major, uint8 _minor, uint8 _patch) external; + + /** + * @notice Changes the default protocol version + * @notice Used only by Polymath to upgrade the SecurityToken contract and add more functionalities to future versions + * @notice Changing versions does not affect existing tokens. + * @param _major Major version of the proxy. + * @param _minor Minor version of the proxy. + * @param _patch Patch version of the proxy + */ + function setLatestVersion(uint8 _major, uint8 _minor, uint8 _patch) external; + + /** + * @notice Changes the PolyToken address. Only Polymath. + * @param _newAddress is the address of the polytoken. + */ + function updatePolyTokenAddress(address _newAddress) external; + + /** + * @notice Used to update the polyToken contract address + */ + function updateFromRegistry() external; + /** * @notice Gets the security token launch fee * @return Fee amount */ - function getSecurityTokenLaunchFee() external view returns(uint256 fee); + function getSecurityTokenLaunchFee() external returns(uint256 fee); /** * @notice Gets the ticker registration fee * @return Fee amount */ - function getTickerRegistrationFee() external view returns(uint256 fee); + function getTickerRegistrationFee() external returns(uint256 fee); + + /** + * @notice Set the getter contract address + * @param _getterContract Address of the contract + */ + function setGetterRegistry(address _getterContract) external; + + /** + * @notice Returns the usd & poly fee for a particular feetype + * @param _feeType Key corresponding to fee type + */ + function getFees(bytes32 _feeType) external returns (uint256 usdFee, uint256 polyFee); /** * @notice Returns the list of tokens to which the delegate has some access @@ -220,16 +430,59 @@ interface ISecurityTokenRegistry { */ function getExpiryLimit() external view returns(uint256 expiry); + /** + * @notice Gets the status of the ticker + * @param _ticker Ticker whose status need to determine + * @return bool + */ + function getTickerStatus(string calldata _ticker) external view returns(bool status); + + /** + * @notice Gets the fee currency + * @return true = poly, false = usd + */ + function getIsFeeInPoly() external view returns(bool isInPoly); + + /** + * @notice Gets the owner of the ticker + * @param _ticker Ticker whose owner need to determine + * @return address Address of the owner + */ + function getTickerOwner(string calldata _ticker) external view returns(address owner); + /** * @notice Checks whether the registry is paused or not * @return bool */ function isPaused() external view returns(bool paused); + /** + * @notice Called by the owner to pause, triggers stopped state + */ + function pause() external; + + /** + * @notice Called by the owner to unpause, returns to normal state + */ + function unpause() external; + + /** + * @notice Reclaims all ERC20Basic compatible tokens + * @param _tokenContract is the address of the token contract + */ + function reclaimERC20(address _tokenContract) external; + /** * @notice Gets the owner of the contract * @return address owner */ function owner() external view returns(address ownerAddress); + /** + * @notice Checks if the entered ticker is registered and has not expired + * @param _ticker is the token ticker + * @return bool + */ + function tickerAvailable(string calldata _ticker) external view returns(bool); + } diff --git a/contracts/interfaces/ITransferManager.sol b/contracts/interfaces/ITransferManager.sol index 3f66c3774..8ca4339b7 100644 --- a/contracts/interfaces/ITransferManager.sol +++ b/contracts/interfaces/ITransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by all Transfer Manager modules diff --git a/contracts/interfaces/IUSDTieredSTOProxy.sol b/contracts/interfaces/IUSDTieredSTOProxy.sol deleted file mode 100644 index fef8d49e5..000000000 --- a/contracts/interfaces/IUSDTieredSTOProxy.sol +++ /dev/null @@ -1,22 +0,0 @@ -pragma solidity ^0.5.0; - -/** - * @title Interface for security token proxy deployment - */ -interface IUSDTieredSTOProxy { - /** - * @notice Deploys the STO. - * @param _securityToken Contract address of the securityToken - * @param _factoryAddress Contract address of the factory - * @return address Address of the deployed STO - */ - function deploySTO(address _securityToken, address _factoryAddress) external returns(address STOAddress); - - /** - * @notice Used to get the init function signature - * @param _contractAddress Address of the STO contract - * @return bytes4 - */ - function getInitFunction(address _contractAddress) external returns(bytes4 initFunction); - -} diff --git a/contracts/interfaces/IUpgradableTokenFactory.sol b/contracts/interfaces/IUpgradableTokenFactory.sol index b5bfe3156..a30039e32 100644 --- a/contracts/interfaces/IUpgradableTokenFactory.sol +++ b/contracts/interfaces/IUpgradableTokenFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by upgradable token factories diff --git a/contracts/interfaces/IVoting.sol b/contracts/interfaces/IVoting.sol index d30e34fce..61a8a158d 100644 --- a/contracts/interfaces/IVoting.sol +++ b/contracts/interfaces/IVoting.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IVoting { @@ -46,5 +46,15 @@ interface IVoting { * @return uint256 totalVoters * @return bool isActive */ - function getBallotDetails(uint256 _ballotId) external view returns(uint256 quorum, uint256 totalSupplyAtCheckpoint, uint256 checkpointId, uint256 startTime, uint256 endTime, uint256 totalProposals, uint256 totalVoters, bool isActive); + function getBallotDetails(uint256 _ballotId) external view returns( + uint256 quorum, + uint256 totalSupplyAtCheckpoint, + uint256 checkpointId, + uint256 startTime, + uint256 endTime, + uint256 totalProposals, + uint256 totalVoters, + bool isActive + ); + } diff --git a/contracts/interfaces/token/IERC1410.sol b/contracts/interfaces/token/IERC1410.sol index a3bee2445..96a5d0bf8 100644 --- a/contracts/interfaces/token/IERC1410.sol +++ b/contracts/interfaces/token/IERC1410.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IERC1410 { diff --git a/contracts/interfaces/token/IERC1594.sol b/contracts/interfaces/token/IERC1594.sol index 3ad774e3e..79cf13830 100644 --- a/contracts/interfaces/token/IERC1594.sol +++ b/contracts/interfaces/token/IERC1594.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Standard Interface of ERC1594 @@ -26,4 +26,4 @@ interface IERC1594 { event Issued(address indexed _operator, address indexed _to, uint256 _value, bytes _data); event Redeemed(address indexed _operator, address indexed _from, uint256 _value, bytes _data); -} \ No newline at end of file +} diff --git a/contracts/interfaces/token/IERC1643.sol b/contracts/interfaces/token/IERC1643.sol index 4c929defa..33ad85635 100644 --- a/contracts/interfaces/token/IERC1643.sol +++ b/contracts/interfaces/token/IERC1643.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; // @title IERC1643 Document Management (part of the ERC1400 Security Token Standards) /// @dev See https://github.com/SecurityTokenStandard/EIP-Spec @@ -6,14 +6,14 @@ pragma solidity ^0.5.0; interface IERC1643 { // Document Management - //-- Included in interface but commented because getDocuement() & getAllDocuments() body is provided in the STGetter + //-- Included in interface but commented because getDocuement() & getAllDocuments() body is provided in the STGetter // function getDocument(bytes32 _name) external view returns (string memory, bytes32, uint256); // function getAllDocuments() external view returns (bytes32[] memory); function setDocument(bytes32 _name, string calldata _uri, bytes32 _documentHash) external; function removeDocument(bytes32 _name) external; - + // Document Events event DocumentRemoved(bytes32 indexed _name, string _uri, bytes32 _documentHash); event DocumentUpdated(bytes32 indexed _name, string _uri, bytes32 _documentHash); -} \ No newline at end of file +} diff --git a/contracts/interfaces/token/IERC1644.sol b/contracts/interfaces/token/IERC1644.sol index d03e1cf30..2367d3df9 100644 --- a/contracts/interfaces/token/IERC1644.sol +++ b/contracts/interfaces/token/IERC1644.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; interface IERC1644 { @@ -25,4 +25,4 @@ interface IERC1644 { bytes _operatorData ); -} \ No newline at end of file +} diff --git a/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol b/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol index 01e437577..6af25046a 100644 --- a/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol +++ b/contracts/libraries/BokkyPooBahsDateTimeLibrary.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; // ---------------------------------------------------------------------------- // BokkyPooBah's DateTime Library v1.01 diff --git a/contracts/libraries/DecimalMath.sol b/contracts/libraries/DecimalMath.sol index 92abcc7de..4b32d8912 100644 --- a/contracts/libraries/DecimalMath.sol +++ b/contracts/libraries/DecimalMath.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/libraries/Encoder.sol b/contracts/libraries/Encoder.sol index b3cf9124d..67647264a 100644 --- a/contracts/libraries/Encoder.sol +++ b/contracts/libraries/Encoder.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; library Encoder { function getKey(string memory _key) internal pure returns(bytes32) { diff --git a/contracts/libraries/StatusCodes.sol b/contracts/libraries/StatusCodes.sol index c4c8ad823..77323ef75 100644 --- a/contracts/libraries/StatusCodes.sol +++ b/contracts/libraries/StatusCodes.sol @@ -1,9 +1,9 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; library StatusCodes { // ERC1400 status code inspired from ERC1066 - enum Status { + enum Status { TransferFailure, TransferSuccess, InsufficientBalance, @@ -18,4 +18,4 @@ library StatusCodes { function code(Status _status) internal pure returns (byte) { return byte(uint8(0x50) + (uint8(_status))); } -} \ No newline at end of file +} diff --git a/contracts/libraries/TokenLib.sol b/contracts/libraries/TokenLib.sol index f5a5d314e..8355a3dff 100644 --- a/contracts/libraries/TokenLib.sol +++ b/contracts/libraries/TokenLib.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IPoly.sol"; import "./StatusCodes.sol"; diff --git a/contracts/libraries/Util.sol b/contracts/libraries/Util.sol index b502ca305..04ed231cb 100644 --- a/contracts/libraries/Util.sol +++ b/contracts/libraries/Util.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Utility contract for reusable code diff --git a/contracts/libraries/VersionUtils.sol b/contracts/libraries/VersionUtils.sol index fa4fc5c56..3cbc9abf4 100644 --- a/contracts/libraries/VersionUtils.sol +++ b/contracts/libraries/VersionUtils.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Helper library use to compare or validate the semantic versions diff --git a/contracts/libraries/VolumeRestrictionLib.sol b/contracts/libraries/VolumeRestrictionLib.sol index 3672f216e..f53fd4b08 100644 --- a/contracts/libraries/VolumeRestrictionLib.sol +++ b/contracts/libraries/VolumeRestrictionLib.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IDataStore.sol"; import "./BokkyPooBahsDateTimeLibrary.sol"; @@ -72,9 +72,9 @@ library VolumeRestrictionLib { public view returns(bool) - { + { // if restriction is to check whether the current transaction is performed within the 24 hours - // span after the last transaction performed by the user + // span after the last transaction performed by the user if (BokkyPooBahsDateTimeLibrary.diffSeconds(_lastTradedTimestamp, now) < 86400) { (,, uint256 lastTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(_lastTradedTimestamp); (,, uint256 currentTxDay) = BokkyPooBahsDateTimeLibrary.timestampToDate(now); @@ -179,7 +179,7 @@ library VolumeRestrictionLib { VolumeRestrictionTMStorage.TypeOfPeriod _currentTypeOfPeriod, VolumeRestrictionTMStorage.TypeOfPeriod _callFrom, uint256 _endTime - ) + ) internal pure returns(VolumeRestrictionTMStorage.TypeOfPeriod) diff --git a/contracts/mocks/Dummy/DummySTO.sol b/contracts/mocks/Dummy/DummySTO.sol index 00ac2cb1f..40a06b234 100644 --- a/contracts/mocks/Dummy/DummySTO.sol +++ b/contracts/mocks/Dummy/DummySTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../modules/STO/STO.sol"; import "../../interfaces/ISecurityToken.sol"; diff --git a/contracts/mocks/Dummy/DummySTOFactory.sol b/contracts/mocks/Dummy/DummySTOFactory.sol index b41ded163..694b77b72 100644 --- a/contracts/mocks/Dummy/DummySTOFactory.sol +++ b/contracts/mocks/Dummy/DummySTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../modules/UpgradableModuleFactory.sol"; import "./DummySTOProxy.sol"; diff --git a/contracts/mocks/Dummy/DummySTOProxy.sol b/contracts/mocks/Dummy/DummySTOProxy.sol index 1f7d44620..0085484b6 100644 --- a/contracts/mocks/Dummy/DummySTOProxy.sol +++ b/contracts/mocks/Dummy/DummySTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../proxy/OwnedUpgradeabilityProxy.sol"; import "../../Pausable.sol"; diff --git a/contracts/mocks/Dummy/DummySTOStorage.sol b/contracts/mocks/Dummy/DummySTOStorage.sol index 922a2836f..718301677 100644 --- a/contracts/mocks/Dummy/DummySTOStorage.sol +++ b/contracts/mocks/Dummy/DummySTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the DummySTO storage @@ -12,4 +12,4 @@ contract DummySTOStorage { mapping (address => uint256) public investors; -} \ No newline at end of file +} diff --git a/contracts/mocks/FunctionSigClash1.sol b/contracts/mocks/FunctionSigClash1.sol index b334f5a00..651d64e38 100644 --- a/contracts/mocks/FunctionSigClash1.sol +++ b/contracts/mocks/FunctionSigClash1.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract functionSigClash1 { // function clash550254402() public { diff --git a/contracts/mocks/FunctionSigClash2.sol b/contracts/mocks/FunctionSigClash2.sol index 10a6bd951..c41e1d61a 100644 --- a/contracts/mocks/FunctionSigClash2.sol +++ b/contracts/mocks/FunctionSigClash2.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract functionSigClash2 { // function proxyOwner() public { diff --git a/contracts/mocks/MockBurnFactory.sol b/contracts/mocks/MockBurnFactory.sol index 5fae2df01..a28c89af5 100644 --- a/contracts/mocks/MockBurnFactory.sol +++ b/contracts/mocks/MockBurnFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./MockRedemptionManager.sol"; import "../modules/Experimental/Burn/TrackedRedemptionFactory.sol"; diff --git a/contracts/mocks/MockCountTransferManager.sol b/contracts/mocks/MockCountTransferManager.sol index eca133691..777c72004 100644 --- a/contracts/mocks/MockCountTransferManager.sol +++ b/contracts/mocks/MockCountTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../modules/TransferManager/CTM/CountTransferManager.sol"; diff --git a/contracts/mocks/MockFactory.sol b/contracts/mocks/MockFactory.sol index 6e79e4e12..f989d3b4f 100644 --- a/contracts/mocks/MockFactory.sol +++ b/contracts/mocks/MockFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./Dummy/DummySTOFactory.sol"; diff --git a/contracts/mocks/MockModuleRegistry.sol b/contracts/mocks/MockModuleRegistry.sol index 8dccc7bf6..dbce5fab8 100644 --- a/contracts/mocks/MockModuleRegistry.sol +++ b/contracts/mocks/MockModuleRegistry.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../ModuleRegistry.sol"; diff --git a/contracts/mocks/MockOracle.sol b/contracts/mocks/MockOracle.sol index 511c1ef5b..2ef7d5383 100644 --- a/contracts/mocks/MockOracle.sol +++ b/contracts/mocks/MockOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IOracle.sol"; diff --git a/contracts/mocks/MockPolyOracle.sol b/contracts/mocks/MockPolyOracle.sol index 15041a42d..aae3b96f6 100644 --- a/contracts/mocks/MockPolyOracle.sol +++ b/contracts/mocks/MockPolyOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../oracles/PolyOracle.sol"; diff --git a/contracts/mocks/MockRedemptionManager.sol b/contracts/mocks/MockRedemptionManager.sol index e401bd0f5..bbd4af721 100644 --- a/contracts/mocks/MockRedemptionManager.sol +++ b/contracts/mocks/MockRedemptionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../modules/Experimental/Burn/TrackedRedemption.sol"; @@ -7,7 +7,7 @@ import "../modules/Experimental/Burn/TrackedRedemption.sol"; */ contract MockRedemptionManager is TrackedRedemption { mapping(address => uint256) tokenToRedeem; - mapping(address => mapping(bytes32 => uint256)) redeemedTokensByPartition; + mapping(address => mapping(bytes32 => uint256)) redeemedTokensByPartition; event RedeemedTokenByOwner(address _investor, address _byWhoom, uint256 _value); event RedeemedTokensByPartition(address indexed _investor, address indexed _operator, bytes32 _partition, uint256 _value, bytes _data, bytes _operatorData); diff --git a/contracts/mocks/MockSTGetter.sol b/contracts/mocks/MockSTGetter.sol index 4e7acdedb..249e38920 100644 --- a/contracts/mocks/MockSTGetter.sol +++ b/contracts/mocks/MockSTGetter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../tokens/STGetter.sol"; diff --git a/contracts/mocks/MockSTRGetter.sol b/contracts/mocks/MockSTRGetter.sol index 464a73847..c206af5a1 100644 --- a/contracts/mocks/MockSTRGetter.sol +++ b/contracts/mocks/MockSTRGetter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../STRGetter.sol"; diff --git a/contracts/mocks/MockSecurityTokenLogic.sol b/contracts/mocks/MockSecurityTokenLogic.sol index d50e59f49..9d1992614 100644 --- a/contracts/mocks/MockSecurityTokenLogic.sol +++ b/contracts/mocks/MockSecurityTokenLogic.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../tokens/SecurityToken.sol"; diff --git a/contracts/mocks/MockWrongTypeFactory.sol b/contracts/mocks/MockWrongTypeFactory.sol index 255e56270..027d8ac14 100644 --- a/contracts/mocks/MockWrongTypeFactory.sol +++ b/contracts/mocks/MockWrongTypeFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./MockBurnFactory.sol"; import "../modules/ModuleFactory.sol"; diff --git a/contracts/mocks/PolyTokenFaucet.sol b/contracts/mocks/PolyTokenFaucet.sol index 4ebd9863f..78f02b563 100644 --- a/contracts/mocks/PolyTokenFaucet.sol +++ b/contracts/mocks/PolyTokenFaucet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/mocks/SecurityTokenMock.sol b/contracts/mocks/SecurityTokenMock.sol index 9f3b6a1d2..6fdd949e2 100644 --- a/contracts/mocks/SecurityTokenMock.sol +++ b/contracts/mocks/SecurityTokenMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../tokens/SecurityToken.sol"; diff --git a/contracts/mocks/SecurityTokenRegistryMock.sol b/contracts/mocks/SecurityTokenRegistryMock.sol index e4d5e6ca5..0c6bc85ff 100644 --- a/contracts/mocks/SecurityTokenRegistryMock.sol +++ b/contracts/mocks/SecurityTokenRegistryMock.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../SecurityTokenRegistry.sol"; diff --git a/contracts/mocks/TestSTOFactory.sol b/contracts/mocks/TestSTOFactory.sol index 9ce6e79c1..57aab7976 100644 --- a/contracts/mocks/TestSTOFactory.sol +++ b/contracts/mocks/TestSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./Dummy/DummySTOFactory.sol"; diff --git a/contracts/modules/Burn/IBurn.sol b/contracts/modules/Burn/IBurn.sol index 64a9b7de9..d40e046d1 100644 --- a/contracts/modules/Burn/IBurn.sol +++ b/contracts/modules/Burn/IBurn.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by all checkpoint modules diff --git a/contracts/modules/Checkpoint/Dividend/DividendCheckpoint.sol b/contracts/modules/Checkpoint/Dividend/DividendCheckpoint.sol index bf2955802..ffa1513fd 100644 --- a/contracts/modules/Checkpoint/Dividend/DividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/Dividend/DividendCheckpoint.sol @@ -5,7 +5,7 @@ * the function may fail. If this happens investors can pull their dividends, or the Issuer * can use pushDividendPaymentToAddresses to provide an explict address list in batches */ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import ".././ICheckpoint.sol"; import "../../../storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpoint.sol b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpoint.sol index f1c379aaa..af122ddba 100644 --- a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../DividendCheckpoint.sol"; import "./ERC20DividendCheckpointStorage.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointFactory.sol b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointFactory.sol index ffa62635a..42a424001 100644 --- a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./ERC20DividendCheckpointProxy.sol"; import "../../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointProxy.sol b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointProxy.sol index 7b13a2bf8..4b060eae1 100644 --- a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointProxy.sol +++ b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./ERC20DividendCheckpointStorage.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol index 1c6bca68c..d83fcde56 100644 --- a/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol +++ b/contracts/modules/Checkpoint/Dividend/ERC20/ERC20DividendCheckpointStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title It holds the storage variables related to ERC20DividendCheckpoint module diff --git a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpoint.sol b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpoint.sol index c5d308969..360f5dfe2 100644 --- a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpoint.sol +++ b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../DividendCheckpoint.sol"; import "../../../../interfaces/IOwnable.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointFactory.sol b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointFactory.sol index 851119e53..1d3239009 100644 --- a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./EtherDividendCheckpointProxy.sol"; import "../../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointProxy.sol b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointProxy.sol index 3e97b585d..953d6456e 100644 --- a/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointProxy.sol +++ b/contracts/modules/Checkpoint/Dividend/Ether/EtherDividendCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../../proxy/OwnedUpgradeabilityProxy.sol"; import "../../../../storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol"; diff --git a/contracts/modules/Checkpoint/ICheckpoint.sol b/contracts/modules/Checkpoint/ICheckpoint.sol index f7b10b77d..4f845fa98 100644 --- a/contracts/modules/Checkpoint/ICheckpoint.sol +++ b/contracts/modules/Checkpoint/ICheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by all checkpoint modules diff --git a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol index a08677222..f8b4b9483 100644 --- a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol +++ b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../VotingCheckpoint.sol"; import "./PLCRVotingCheckpointStorage.sol"; @@ -27,14 +27,14 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { uint256 _proposedQuorum ); event BallotStatusChanged(uint256 indexed _ballotId, bool _newStatus); - event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _change); + event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _exempt); constructor(address _securityToken, address _polyAddress) public Module(_securityToken, _polyAddress) { - } + } /** * @notice Use to create the ballot @@ -48,7 +48,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { uint256 _revealDuration, uint256 _noOfProposals, uint256 _proposedQuorum - ) + ) external withPerm(ADMIN) { @@ -98,7 +98,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { require(_proposedQuorum <= 100 * 10 ** 16, "Invalid quorum percentage"); // not more than 100 % // Overflow check require( - uint64(_commitDuration) == _commitDuration && + uint64(_commitDuration) == _commitDuration && uint64(_revealDuration) == _revealDuration && uint64(_startTime) == _startTime && uint24(_totalProposals) == _totalProposals, @@ -172,43 +172,43 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { * Change the given ballot exempted list * @param _ballotId Given ballot Id * @param _voter Address of the voter - * @param _change Whether it is exempted or not + * @param _exempt Whether it is exempted or not */ - function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) external withPerm(ADMIN) { - _changeBallotExemptedVotersList(_ballotId, _voter, _change); + function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) external withPerm(ADMIN) { + _changeBallotExemptedVotersList(_ballotId, _voter, _exempt); } /** * Change the given ballot exempted list (Multi) * @param _ballotId Given ballot Id * @param _voters Address of the voter - * @param _changes Whether it is exempted or not + * @param _exempts Whether it is exempted or not */ - function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) { - require(_voters.length == _changes.length, "Array length mismatch"); + function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) { + require(_voters.length == _exempts.length, "Array length mismatch"); for (uint256 i = 0; i < _voters.length; i++) { - _changeBallotExemptedVotersList(_ballotId, _voters[i], _changes[i]); + _changeBallotExemptedVotersList(_ballotId, _voters[i], _exempts[i]); } } - function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) internal { + function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) internal { require(_voter != address(0), "Invalid address"); _validBallotId(_ballotId); - require(ballots[_ballotId].exemptedVoters[_voter] != _change, "No change"); - ballots[_ballotId].exemptedVoters[_voter] = _change; - emit ChangedBallotExemptedVotersList(_ballotId, _voter, _change); + require(ballots[_ballotId].exemptedVoters[_voter] != _exempt, "No change"); + ballots[_ballotId].exemptedVoters[_voter] = _exempt; + emit ChangedBallotExemptedVotersList(_ballotId, _voter, _exempt); } /** * Use to check whether the voter is allowed to vote or not * @param _ballotId The index of the target ballot * @param _voter Address of the voter - * @return bool + * @return bool */ function isVoterAllowed(uint256 _ballotId, address _voter) public view returns(bool) { bool allowed = (ballots[_ballotId].exemptedVoters[_voter] || (defaultExemptIndex[_voter] != 0)); return !allowed; - } + } /** * @notice Allows the token issuer to set the active stats of a ballot @@ -265,7 +265,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { ) { if (_ballotId >= ballots.length) return (new uint256[](0), new uint256[](0), 0, false, 0); - + Ballot storage ballot = ballots[_ballotId]; uint256 i = 0; uint256 counter = 0; @@ -288,7 +288,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { counter ++; } } - + tieWith = new uint256[](counter); if (counter > 0) { counter = 0; @@ -296,7 +296,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { if (maxWeight == ballot.proposalToVotes[i + 1] && (i + 1) != winningProposal) { tieWith[counter] = i + 1; counter ++; - } + } } } totalVotes = uint256(ballot.totalVoters); @@ -323,7 +323,7 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { * @return uint256 endTime * @return uint256 totalProposals * @return uint256 totalVoters - * @return bool isActive + * @return bool isActive */ function getBallotDetails(uint256 _ballotId) external view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool) { Ballot memory ballot = ballots[_ballotId]; @@ -375,4 +375,4 @@ contract PLCRVotingCheckpoint is PLCRVotingCheckpointStorage, VotingCheckpoint { require(ballots.length > _ballotId, "Index out of bound"); } -} \ No newline at end of file +} diff --git a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointFactory.sol b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointFactory.sol index 455c036cf..2ce4153ef 100644 --- a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./PLCRVotingCheckpointProxy.sol"; import "../../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointProxy.sol b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointProxy.sol index f225511c1..d206b51fc 100644 --- a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointProxy.sol +++ b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../../Pausable.sol"; import "./PLCRVotingCheckpointStorage.sol"; @@ -29,4 +29,4 @@ contract PLCRVotingCheckpointProxy is PLCRVotingCheckpointStorage, VotingCheckpo _upgradeTo(_version, _implementation); } -} \ No newline at end of file +} diff --git a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol index 99be4a0c6..a4e217e04 100644 --- a/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol +++ b/contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpointStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract PLCRVotingCheckpointStorage { @@ -24,4 +24,4 @@ contract PLCRVotingCheckpointStorage { } Ballot[] ballots; -} \ No newline at end of file +} diff --git a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpoint.sol b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpoint.sol index 3a1ae9de9..6dd575c7a 100644 --- a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpoint.sol +++ b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../VotingCheckpoint.sol"; import "./WeightedVoteCheckpointStorage.sol"; @@ -23,7 +23,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi ); event VoteCast(address indexed _voter, uint256 _weight, uint256 indexed _ballotId, uint256 indexed _proposalId); event BallotStatusChanged(uint256 indexed _ballotId, bool _isActive); - event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _change); + event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _exempt); /** * @notice Constructor @@ -63,7 +63,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi uint256 _startTime, uint256 _endTime, uint256 _noOfProposals - ) + ) internal { require(_noOfProposals > 1, "Incorrect proposals no"); @@ -124,43 +124,43 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi * Change the given ballot exempted list * @param _ballotId Given ballot Id * @param _voter Address of the voter - * @param _change Whether it is exempted or not + * @param _exempt Whether it is exempted or not */ - function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) external withPerm(ADMIN) { - _changeBallotExemptedVotersList(_ballotId, _voter, _change); + function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) external withPerm(ADMIN) { + _changeBallotExemptedVotersList(_ballotId, _voter, _exempt); } /** * Change the given ballot exempted list (Multi) * @param _ballotId Given ballot Id * @param _voters Address of the voter - * @param _changes Whether it is exempted or not + * @param _exempts Whether it is exempted or not */ - function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) { - require(_voters.length == _changes.length, "Array length mismatch"); + function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) { + require(_voters.length == _exempts.length, "Array length mismatch"); for (uint256 i = 0; i < _voters.length; i++) { - _changeBallotExemptedVotersList(_ballotId, _voters[i], _changes[i]); + _changeBallotExemptedVotersList(_ballotId, _voters[i], _exempts[i]); } } - function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _change) internal { + function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) internal { require(_voter != address(0), "Invalid address"); _validBallotId(_ballotId); - require(ballots[_ballotId].exemptedVoters[_voter] != _change, "No change"); - ballots[_ballotId].exemptedVoters[_voter] = _change; - emit ChangedBallotExemptedVotersList(_ballotId, _voter, _change); + require(ballots[_ballotId].exemptedVoters[_voter] != _exempt, "No change"); + ballots[_ballotId].exemptedVoters[_voter] = _exempt; + emit ChangedBallotExemptedVotersList(_ballotId, _voter, _exempt); } /** * Use to check whether the voter is allowed to vote or not * @param _ballotId The index of the target ballot * @param _voter Address of the voter - * @return bool + * @return bool */ function isVoterAllowed(uint256 _ballotId, address _voter) public view returns(bool) { bool allowed = (ballots[_ballotId].exemptedVoters[_voter] || (defaultExemptIndex[_voter] != 0)); return !allowed; - } + } /** * @notice Allows the token issuer to set the active stats of a ballot @@ -216,7 +216,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi counter ++; } } - + tieWith = new uint256[](counter); if (counter > 0) { counter = 0; @@ -224,7 +224,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi if (maxWeight == ballot.proposalToVotes[i + 1] && (i + 1) != winningProposal) { tieWith[counter] = i + 1; counter ++; - } + } } } totalVotes = uint256(ballot.totalVoters); @@ -251,7 +251,7 @@ contract WeightedVoteCheckpoint is WeightedVoteCheckpointStorage, VotingCheckpoi * @return uint256 endTime * @return uint256 totalProposals * @return uint256 totalVoters - * @return bool isActive + * @return bool isActive */ function getBallotDetails(uint256 _ballotId) external view returns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool) { Ballot memory ballot = ballots[_ballotId]; diff --git a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointFactory.sol b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointFactory.sol index c2a9b432b..54f8440f0 100644 --- a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointFactory.sol +++ b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./WeightedVoteCheckpointProxy.sol"; import "../../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointProxy.sol b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointProxy.sol index b926b0371..da71404ed 100644 --- a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointProxy.sol +++ b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../../Pausable.sol"; import "./WeightedVoteCheckpointStorage.sol"; @@ -29,4 +29,4 @@ contract WeightedVoteCheckpointProxy is WeightedVoteCheckpointStorage, VotingChe _upgradeTo(_version, _implementation); } -} \ No newline at end of file +} diff --git a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol index 776427102..fec3cf97f 100644 --- a/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol +++ b/contracts/modules/Checkpoint/Voting/Transparent/WeightedVoteCheckpointStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract WeightedVoteCheckpointStorage { @@ -8,7 +8,7 @@ contract WeightedVoteCheckpointStorage { uint64 startTime; // Timestamp at which ballot will come into effect uint64 endTime; // Timestamp at which ballot will no more into effect uint64 totalProposals; // Count of proposals allowed for a given ballot - uint56 totalVoters; // Count of voters who vote for the given ballot + uint56 totalVoters; // Count of voters who vote for the given ballot bool isActive; // flag used to turn off/on the ballot mapping(uint256 => uint256) proposalToVotes; // Mapping for proposal to total weight collected by the proposal mapping(address => uint256) investorToProposal; // mapping for storing vote details of a voter @@ -16,4 +16,4 @@ contract WeightedVoteCheckpointStorage { } Ballot[] ballots; -} \ No newline at end of file +} diff --git a/contracts/modules/Checkpoint/Voting/VotingCheckpoint.sol b/contracts/modules/Checkpoint/Voting/VotingCheckpoint.sol index 77ae226ea..47013b4fe 100644 --- a/contracts/modules/Checkpoint/Voting/VotingCheckpoint.sol +++ b/contracts/modules/Checkpoint/Voting/VotingCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../interfaces/IVoting.sol"; import "../../Module.sol"; @@ -7,33 +7,33 @@ import "../../../storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol"; contract VotingCheckpoint is VotingCheckpointStorage, ICheckpoint, IVoting, Module { - event ChangedDefaultExemptedVotersList(address indexed _voter, bool _change); + event ChangedDefaultExemptedVotersList(address indexed _voter, bool _exempt); /** * Change the global exempted voters list * @param _voter Address of the voter - * @param _change Whether it is exempted or not + * @param _exempt Whether it is exempted or not */ - function changeDefaultExemptedVotersList(address _voter, bool _change) external withPerm(ADMIN) { - _changeDefaultExemptedVotersList(_voter, _change); + function changeDefaultExemptedVotersList(address _voter, bool _exempt) external withPerm(ADMIN) { + _changeDefaultExemptedVotersList(_voter, _exempt); } /** * Change the global exempted voters list * @param _voters Address of the voter - * @param _changes Whether it is exempted or not + * @param _exempts Whether it is exempted or not */ - function changeDefaultExemptedVotersListMulti(address[] calldata _voters, bool[] calldata _changes) external withPerm(ADMIN) { - require(_voters.length == _changes.length, "Array length mismatch"); + function changeDefaultExemptedVotersListMulti(address[] calldata _voters, bool[] calldata _exempts) external withPerm(ADMIN) { + require(_voters.length == _exempts.length, "Array length mismatch"); for (uint256 i = 0; i < _voters.length; i++) { - _changeDefaultExemptedVotersList(_voters[i], _changes[i]); + _changeDefaultExemptedVotersList(_voters[i], _exempts[i]); } } - function _changeDefaultExemptedVotersList(address _voter, bool _change) internal { + function _changeDefaultExemptedVotersList(address _voter, bool _exempt) internal { require(_voter != address(0), "Invalid address"); - require((defaultExemptIndex[_voter] == 0) == _change); - if (_change) { + require((defaultExemptIndex[_voter] == 0) == _exempt); + if (_exempt) { defaultExemptedVoters.push(_voter); defaultExemptIndex[_voter] = defaultExemptedVoters.length; } else { @@ -44,7 +44,7 @@ contract VotingCheckpoint is VotingCheckpointStorage, ICheckpoint, IVoting, Modu delete defaultExemptIndex[_voter]; defaultExemptedVoters.length --; } - emit ChangedDefaultExemptedVotersList(_voter, _change); + emit ChangedDefaultExemptedVotersList(_voter, _exempt); } /** @@ -53,4 +53,4 @@ contract VotingCheckpoint is VotingCheckpointStorage, ICheckpoint, IVoting, Modu function getDefaultExemptionVotersList() external view returns(address[] memory) { return defaultExemptedVoters; } -} \ No newline at end of file +} diff --git a/contracts/modules/Experimental/Burn/TrackedRedemption.sol b/contracts/modules/Experimental/Burn/TrackedRedemption.sol index c275c177f..8e97fd6b2 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemption.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemption.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../Burn/IBurn.sol"; import "../../Module.sol"; diff --git a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol index 9f30e7c53..c31459288 100644 --- a/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol +++ b/contracts/modules/Experimental/Burn/TrackedRedemptionFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./TrackedRedemption.sol"; import "../../ModuleFactory.sol"; diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol index 16f52e0ba..78b21c85b 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpoint.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./../../Checkpoint/ICheckpoint.sol"; import "../../TransferManager/TransferManager.sol"; @@ -194,7 +194,7 @@ contract ScheduledCheckpoint is ICheckpoint, TransferManager { _update(names[i]); } } - + /** * @notice Return the permissions flag that are associated with CountTransferManager */ diff --git a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol index ad4626b41..343641fba 100644 --- a/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol +++ b/contracts/modules/Experimental/Mixed/ScheduledCheckpointFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./ScheduledCheckpoint.sol"; import "../../ModuleFactory.sol"; diff --git a/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol b/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol index 3de147d50..c30ad4699 100644 --- a/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/KYCTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../TransferManager/TransferManager.sol"; import "../../../interfaces/ISecurityToken.sol"; diff --git a/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol index 4e7286cde..14c319a71 100644 --- a/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/KYCTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./KYCTransferManager.sol"; import "./../../ModuleFactory.sol"; diff --git a/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol b/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol index f6ad9fc3f..0e2e80b87 100644 --- a/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol +++ b/contracts/modules/Experimental/TransferManager/SignedTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../TransferManager/TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol b/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol index 0da29d034..eeb94baf6 100644 --- a/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol +++ b/contracts/modules/Experimental/TransferManager/SignedTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./SignedTransferManager.sol"; import "../../ModuleFactory.sol"; diff --git a/contracts/modules/Module.sol b/contracts/modules/Module.sol index d7ab33f91..cd491d9f8 100644 --- a/contracts/modules/Module.sol +++ b/contracts/modules/Module.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IModule.sol"; import "../Pausable.sol"; diff --git a/contracts/modules/ModuleFactory.sol b/contracts/modules/ModuleFactory.sol index 5e02085b2..7ed4dc24e 100644 --- a/contracts/modules/ModuleFactory.sol +++ b/contracts/modules/ModuleFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../libraries/VersionUtils.sol"; import "../libraries/Util.sol"; diff --git a/contracts/modules/PermissionManager/GeneralPermissionManager.sol b/contracts/modules/PermissionManager/GeneralPermissionManager.sol index 8a3d9e230..bee4a3a3c 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManager.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./IPermissionManager.sol"; import "../Module.sol"; diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index 65b1276d3..d070696b1 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../UpgradableModuleFactory.sol"; import "./GeneralPermissionManagerProxy.sol"; diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerProxy.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerProxy.sol index bd721c887..6272eb908 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerProxy.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../proxy/OwnedUpgradeabilityProxy.sol"; import "../../Pausable.sol"; diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol index a0e55021a..a9559c08f 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the GeneralPermissionManager storage diff --git a/contracts/modules/PermissionManager/IPermissionManager.sol b/contracts/modules/PermissionManager/IPermissionManager.sol index f1fdc69b5..9872e53d5 100644 --- a/contracts/modules/PermissionManager/IPermissionManager.sol +++ b/contracts/modules/PermissionManager/IPermissionManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Interface to be implemented by all permission manager modules diff --git a/contracts/modules/STO/Capped/CappedSTO.sol b/contracts/modules/STO/Capped/CappedSTO.sol index 5c6315892..3cf2ecc93 100644 --- a/contracts/modules/STO/Capped/CappedSTO.sol +++ b/contracts/modules/STO/Capped/CappedSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../STO.sol"; import "openzeppelin-solidity/contracts/utils/ReentrancyGuard.sol"; @@ -80,8 +80,7 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder) * @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments */ - function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public { - _onlySecurityTokenOwner(); + function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) public withPerm(OPERATOR) { require(_allowBeneficialInvestments != allowBeneficialInvestments, "Does not change value"); allowBeneficialInvestments = _allowBeneficialInvestments; emit SetAllowBeneficialInvestments(allowBeneficialInvestments); @@ -134,7 +133,8 @@ contract CappedSTO is CappedSTOStorage, STO, ReentrancyGuard { * @notice Return the permissions flag that are associated with STO */ function getPermissions() public view returns(bytes32[] memory) { - bytes32[] memory allPermissions = new bytes32[](0); + bytes32[] memory allPermissions = new bytes32[](1); + allPermissions[0] = OPERATOR; return allPermissions; } diff --git a/contracts/modules/STO/Capped/CappedSTOFactory.sol b/contracts/modules/STO/Capped/CappedSTOFactory.sol index c9ca716db..abed3ffc4 100644 --- a/contracts/modules/STO/Capped/CappedSTOFactory.sol +++ b/contracts/modules/STO/Capped/CappedSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./CappedSTOProxy.sol"; diff --git a/contracts/modules/STO/Capped/CappedSTOProxy.sol b/contracts/modules/STO/Capped/CappedSTOProxy.sol index 09b64ccba..7abafe7f3 100644 --- a/contracts/modules/STO/Capped/CappedSTOProxy.sol +++ b/contracts/modules/STO/Capped/CappedSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "../../../Pausable.sol"; diff --git a/contracts/modules/STO/Capped/CappedSTOStorage.sol b/contracts/modules/STO/Capped/CappedSTOStorage.sol index 7ddeea403..f5c0fabef 100644 --- a/contracts/modules/STO/Capped/CappedSTOStorage.sol +++ b/contracts/modules/STO/Capped/CappedSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the CappedSTO storage @@ -16,4 +16,4 @@ contract CappedSTOStorage { mapping (address => uint256) public investors; -} \ No newline at end of file +} diff --git a/contracts/modules/STO/PreSale/PreSaleSTO.sol b/contracts/modules/STO/PreSale/PreSaleSTO.sol index 6311ddbfb..c23190f3c 100644 --- a/contracts/modules/STO/PreSale/PreSaleSTO.sol +++ b/contracts/modules/STO/PreSale/PreSaleSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../STO.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/modules/STO/PreSale/PreSaleSTOFactory.sol b/contracts/modules/STO/PreSale/PreSaleSTOFactory.sol index a1cbbc50c..de2654276 100644 --- a/contracts/modules/STO/PreSale/PreSaleSTOFactory.sol +++ b/contracts/modules/STO/PreSale/PreSaleSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./PreSaleSTOProxy.sol"; diff --git a/contracts/modules/STO/PreSale/PreSaleSTOProxy.sol b/contracts/modules/STO/PreSale/PreSaleSTOProxy.sol index 1de8630d2..c2d3268ad 100644 --- a/contracts/modules/STO/PreSale/PreSaleSTOProxy.sol +++ b/contracts/modules/STO/PreSale/PreSaleSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "../../../Pausable.sol"; diff --git a/contracts/modules/STO/PreSale/PreSaleSTOStorage.sol b/contracts/modules/STO/PreSale/PreSaleSTOStorage.sol index f1b008259..8ff56cd77 100644 --- a/contracts/modules/STO/PreSale/PreSaleSTOStorage.sol +++ b/contracts/modules/STO/PreSale/PreSaleSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the PreSaleSTO storage @@ -7,4 +7,4 @@ contract PreSaleSTOStorage { mapping (address => uint256) public investors; -} \ No newline at end of file +} diff --git a/contracts/modules/STO/STO.sol b/contracts/modules/STO/STO.sol index d80c9d139..af68cca4c 100644 --- a/contracts/modules/STO/STO.sol +++ b/contracts/modules/STO/STO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../Module.sol"; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -12,11 +12,6 @@ import "../../interfaces/ISTO.sol"; contract STO is ISTO, STOStorage, Module { using SafeMath for uint256; - enum FundRaiseType {ETH, POLY, SC} - - // Event - event SetFundRaiseTypes(FundRaiseType[] _fundRaiseTypes); - /** * @notice Returns funds raised by the STO */ diff --git a/contracts/modules/STO/USDTiered/USDTieredSTO.sol b/contracts/modules/STO/USDTiered/USDTieredSTO.sol index a85294b3d..ab99ec905 100644 --- a/contracts/modules/STO/USDTiered/USDTieredSTO.sol +++ b/contracts/modules/STO/USDTiered/USDTieredSTO.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../STO.sol"; import "../../../interfaces/IPolymathRegistry.sol"; @@ -22,7 +22,6 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { event SetAllowBeneficialInvestments(bool _allowed); event SetNonAccreditedLimit(address _investor, uint256 _limit); - event SetAccredited(address _investor, bool _accredited); event TokenPurchase( address indexed _purchaser, address indexed _beneficiary, @@ -126,8 +125,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @dev Modifies fund raise types * @param _fundRaiseTypes Array of fund raise types to allow */ - function modifyFunding(FundRaiseType[] calldata _fundRaiseTypes) external { - _onlySecurityTokenOwner(); + function modifyFunding(FundRaiseType[] calldata _fundRaiseTypes) external withPerm(OPERATOR) { _isSTOStarted(); _setFundRaiseType(_fundRaiseTypes); } @@ -137,8 +135,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @param _nonAccreditedLimitUSD max non accredited invets limit * @param _minimumInvestmentUSD overall minimum investment limit */ - function modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) external { - _onlySecurityTokenOwner(); + function modifyLimits(uint256 _nonAccreditedLimitUSD, uint256 _minimumInvestmentUSD) external withPerm(OPERATOR) { _isSTOStarted(); _modifyLimits(_nonAccreditedLimitUSD, _minimumInvestmentUSD); } @@ -157,8 +154,8 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { uint256[] calldata _tokensPerTierDiscountPoly ) external + withPerm(OPERATOR) { - _onlySecurityTokenOwner(); _isSTOStarted(); _modifyTiers(_ratePerTier, _ratePerTierDiscountPoly, _tokensPerTierTotal, _tokensPerTierDiscountPoly); } @@ -168,8 +165,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @param _startTime start time of sto * @param _endTime end time of sto */ - function modifyTimes(uint256 _startTime, uint256 _endTime) external { - _onlySecurityTokenOwner(); + function modifyTimes(uint256 _startTime, uint256 _endTime) external withPerm(OPERATOR) { _isSTOStarted(); _modifyTimes(_startTime, _endTime); } @@ -275,8 +271,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @notice Finalizes the STO and mint remaining tokens to treasury address * @notice Treasury wallet address must be whitelisted to successfully finalize */ - function finalize() external { - _onlySecurityTokenOwner(); + function finalize() external withPerm(ADMIN) { require(!isFinalized, "STO is finalized"); isFinalized = true; uint256 tempReturned; @@ -306,8 +301,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @param _investors Array of investor addresses to modify * @param _nonAccreditedLimit Array of uints specifying non-accredited limits */ - function changeNonAccreditedLimit(address[] calldata _investors, uint256[] calldata _nonAccreditedLimit) external { - _onlySecurityTokenOwner(); + function changeNonAccreditedLimit(address[] calldata _investors, uint256[] calldata _nonAccreditedLimit) external withPerm(OPERATOR) { //nonAccreditedLimitUSDOverride require(_investors.length == _nonAccreditedLimit.length, "Length mismatch"); for (uint256 i = 0; i < _investors.length; i++) { @@ -337,8 +331,7 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @notice Function to set allowBeneficialInvestments (allow beneficiary to be different to funder) * @param _allowBeneficialInvestments Boolean to allow or disallow beneficial investments */ - function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) external { - _onlySecurityTokenOwner(); + function changeAllowBeneficialInvestments(bool _allowBeneficialInvestments) external withPerm(OPERATOR) { require(_allowBeneficialInvestments != allowBeneficialInvestments); allowBeneficialInvestments = _allowBeneficialInvestments; emit SetAllowBeneficialInvestments(allowBeneficialInvestments); @@ -727,6 +720,9 @@ contract USDTieredSTO is USDTieredSTOStorage, STO { * @notice Return the permissions flag that are associated with STO */ function getPermissions() public view returns(bytes32[] memory allPermissions) { + bytes32[] memory allPermissions = new bytes32[](2); + allPermissions[0] = OPERATOR; + allPermissions[1] = ADMIN; return allPermissions; } diff --git a/contracts/modules/STO/USDTiered/USDTieredSTOFactory.sol b/contracts/modules/STO/USDTiered/USDTieredSTOFactory.sol index eb47c90d9..7d55a2632 100644 --- a/contracts/modules/STO/USDTiered/USDTieredSTOFactory.sol +++ b/contracts/modules/STO/USDTiered/USDTieredSTOFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./USDTieredSTOProxy.sol"; import "../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/STO/USDTiered/USDTieredSTOProxy.sol b/contracts/modules/STO/USDTiered/USDTieredSTOProxy.sol index c091d78ac..4bb3caf5d 100644 --- a/contracts/modules/STO/USDTiered/USDTieredSTOProxy.sol +++ b/contracts/modules/STO/USDTiered/USDTieredSTOProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./USDTieredSTOStorage.sol"; diff --git a/contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol b/contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol index 339fbb00f..f5db99ad5 100644 --- a/contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol +++ b/contracts/modules/STO/USDTiered/USDTieredSTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; @@ -8,7 +8,7 @@ import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; contract USDTieredSTOStorage { bytes32 internal constant INVESTORSKEY = 0xdf3a8dd24acdd05addfc6aeffef7574d2de3f844535ec91e8e0f3e45dba96731; //keccak256(abi.encodePacked("INVESTORS")) - + ///////////// // Storage // ///////////// diff --git a/contracts/modules/TransferManager/BTM/BlacklistTransferManager.sol b/contracts/modules/TransferManager/BTM/BlacklistTransferManager.sol index 7aee159a3..e66a3a22c 100644 --- a/contracts/modules/TransferManager/BTM/BlacklistTransferManager.sol +++ b/contracts/modules/TransferManager/BTM/BlacklistTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../TransferManager.sol"; import "./BlacklistTransferManagerStorage.sol"; @@ -443,11 +443,11 @@ contract BlacklistTransferManager is BlacklistTransferManagerStorage, TransferMa uint256 currentBalance = (msg.sender == address(securityToken)) ? (securityToken.balanceOf(_tokenHolder)).add(_additionalBalance) : securityToken.balanceOf(_tokenHolder); if (paused && _partition == UNLOCKED) return currentBalance; - + (Result success, ) = verifyTransfer(_tokenHolder, address(0), 0, "0x0"); if ((_partition == LOCKED && success == Result.INVALID) || (_partition == UNLOCKED && success != Result.INVALID)) return currentBalance; - else + else return 0; } diff --git a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerFactory.sol b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerFactory.sol index 3549afd4b..2d9216d7c 100644 --- a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./BlacklistTransferManagerProxy.sol"; diff --git a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerProxy.sol b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerProxy.sol index fc99fc4d5..8914ba0fa 100644 --- a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./BlacklistTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol index c8f460164..229c1a994 100644 --- a/contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/BTM/BlacklistTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the CountTransferManager storage diff --git a/contracts/modules/TransferManager/CTM/CountTransferManager.sol b/contracts/modules/TransferManager/CTM/CountTransferManager.sol index f56395003..30e86850b 100644 --- a/contracts/modules/TransferManager/CTM/CountTransferManager.sol +++ b/contracts/modules/TransferManager/CTM/CountTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../TransferManager.sol"; import "./CountTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/CTM/CountTransferManagerFactory.sol b/contracts/modules/TransferManager/CTM/CountTransferManagerFactory.sol index 85828daeb..878304272 100644 --- a/contracts/modules/TransferManager/CTM/CountTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/CTM/CountTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./CountTransferManagerProxy.sol"; diff --git a/contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol b/contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol index 488f78dc8..8a302309b 100644 --- a/contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/CTM/CountTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./CountTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol b/contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol index bc755d301..cd262a4ab 100644 --- a/contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/CTM/CountTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the CountTransferManager storage diff --git a/contracts/modules/TransferManager/GTM/GeneralTransferManager.sol b/contracts/modules/TransferManager/GTM/GeneralTransferManager.sol index 6571286ab..607ab2d7c 100644 --- a/contracts/modules/TransferManager/GTM/GeneralTransferManager.sol +++ b/contracts/modules/TransferManager/GTM/GeneralTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../TransferManager.sol"; import "../../../libraries/Encoder.sol"; diff --git a/contracts/modules/TransferManager/GTM/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GTM/GeneralTransferManagerFactory.sol index 423e9abe9..606f334fc 100644 --- a/contracts/modules/TransferManager/GTM/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GTM/GeneralTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./GeneralTransferManagerProxy.sol"; import "../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/TransferManager/GTM/GeneralTransferManagerProxy.sol b/contracts/modules/TransferManager/GTM/GeneralTransferManagerProxy.sol index fd44b9fbf..3cde10800 100644 --- a/contracts/modules/TransferManager/GTM/GeneralTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/GTM/GeneralTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./GeneralTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/GTM/GeneralTransferManagerStorage.sol b/contracts/modules/TransferManager/GTM/GeneralTransferManagerStorage.sol index 4e61eb75f..911af513c 100644 --- a/contracts/modules/TransferManager/GTM/GeneralTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/GTM/GeneralTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Transfer Manager module for core transfer validation functionality diff --git a/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol b/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol index b150c13d7..d8a0d7855 100644 --- a/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol +++ b/contracts/modules/TransferManager/LTM/LockUpTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../TransferManager/TransferManager.sol"; import "./LockUpTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/LTM/LockUpTransferManagerFactory.sol b/contracts/modules/TransferManager/LTM/LockUpTransferManagerFactory.sol index 3b7c76a52..913436884 100644 --- a/contracts/modules/TransferManager/LTM/LockUpTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/LTM/LockUpTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./LockUpTransferManagerProxy.sol"; import "../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol b/contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol index cd198f478..8d627cc73 100644 --- a/contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/LTM/LockUpTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./LockUpTransferManagerStorage.sol"; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; diff --git a/contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol b/contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol index c24bee80e..aaaf855da 100644 --- a/contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/LTM/LockUpTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Wallet for core vesting escrow functionality diff --git a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManager.sol b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManager.sol index 1d44d6d6a..c63e03a3c 100644 --- a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManager.sol +++ b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerFactory.sol b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerFactory.sol index 030c75470..2d9cdf8ec 100644 --- a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./ManualApprovalTransferManagerProxy.sol"; diff --git a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerProxy.sol b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerProxy.sol index 74e19d75c..c2997b254 100644 --- a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./ManualApprovalTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol index e4a5aa6c6..b97293968 100644 --- a/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/MATM/ManualApprovalTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the ManualApprovalTransferManager storage diff --git a/contracts/modules/TransferManager/PTM/PercentageTransferManager.sol b/contracts/modules/TransferManager/PTM/PercentageTransferManager.sol index 379df21ea..1a28969e1 100644 --- a/contracts/modules/TransferManager/PTM/PercentageTransferManager.sol +++ b/contracts/modules/TransferManager/PTM/PercentageTransferManager.sol @@ -5,7 +5,7 @@ * higher than the intended limit. */ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../TransferManager.sol"; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; diff --git a/contracts/modules/TransferManager/PTM/PercentageTransferManagerFactory.sol b/contracts/modules/TransferManager/PTM/PercentageTransferManagerFactory.sol index b9312807a..ba2c0684a 100644 --- a/contracts/modules/TransferManager/PTM/PercentageTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/PTM/PercentageTransferManagerFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../UpgradableModuleFactory.sol"; import "./PercentageTransferManagerProxy.sol"; diff --git a/contracts/modules/TransferManager/PTM/PercentageTransferManagerProxy.sol b/contracts/modules/TransferManager/PTM/PercentageTransferManagerProxy.sol index 2aaac7809..840da18b2 100644 --- a/contracts/modules/TransferManager/PTM/PercentageTransferManagerProxy.sol +++ b/contracts/modules/TransferManager/PTM/PercentageTransferManagerProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./PercentageTransferManagerStorage.sol"; diff --git a/contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol b/contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol index c5a8c8976..018d2134f 100644 --- a/contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol +++ b/contracts/modules/TransferManager/PTM/PercentageTransferManagerStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Contract used to store layout for the PercentageTransferManager storage diff --git a/contracts/modules/TransferManager/TransferManager.sol b/contracts/modules/TransferManager/TransferManager.sol index 7423349b5..54607cca5 100644 --- a/contracts/modules/TransferManager/TransferManager.sol +++ b/contracts/modules/TransferManager/TransferManager.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../Module.sol"; import "../../interfaces/ITransferManager.sol"; @@ -20,9 +20,14 @@ contract TransferManager is ITransferManager, Module { /** * @notice return the amount of tokens for a given user as per the partition + * @dev returning the balance of token holder against the UNLOCKED partition. + * This condition is valid only when the base contract doesn't implement the + * `getTokensByPartition()` function. */ - function getTokensByPartition(bytes32 /*_partition*/, address /*_tokenHolder*/, uint256 /*_additionalBalance*/) external view returns(uint256) { - return 0; + function getTokensByPartition(bytes32 _partition, address _tokenHolder, uint256 /*_additionalBalance*/) external view returns(uint256) { + if (_partition == UNLOCKED) + return ISecurityToken(securityToken).balanceOf(_tokenHolder); + return uint256(0); } } diff --git a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol index 1ad636188..c2c229342 100644 --- a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol +++ b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTM.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "openzeppelin-solidity/contracts/math/Math.sol"; @@ -10,7 +10,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager { using SafeMath for uint256; // Emit when the token holder is added/removed from the exemption list - event ChangedExemptWalletList(address indexed _wallet, bool _change); + event ChangedExemptWalletList(address indexed _wallet, bool _exempted); // Emit when the new individual restriction is added corresponds to new token holders event AddIndividualRestriction( address indexed _holder, @@ -186,12 +186,12 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager { /** * @notice Add/Remove wallet address from the exempt list * @param _wallet Ethereum wallet/contract address that need to be exempted - * @param _change Boolean value used to add (i.e true) or remove (i.e false) from the list + * @param _exempted Boolean value used to add (i.e true) or remove (i.e false) from the list */ - function changeExemptWalletList(address _wallet, bool _change) public withPerm(ADMIN) { + function changeExemptWalletList(address _wallet, bool _exempted) public withPerm(ADMIN) { require(_wallet != address(0)); - require((exemptions.exemptIndex[_wallet] == 0) == _change); - if (_change) { + require((exemptions.exemptIndex[_wallet] == 0) == _exempted); + if (_exempted) { exemptions.exemptAddresses.push(_wallet); exemptions.exemptIndex[_wallet] = exemptions.exemptAddresses.length; } else { @@ -200,7 +200,7 @@ contract VolumeRestrictionTM is VolumeRestrictionTMStorage, TransferManager { delete exemptions.exemptIndex[_wallet]; exemptions.exemptAddresses.length--; } - emit ChangedExemptWalletList(_wallet, _change); + emit ChangedExemptWalletList(_wallet, _exempted); } /** diff --git a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMFactory.sol b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMFactory.sol index 12af369e1..25a92ffdb 100644 --- a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMFactory.sol +++ b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./VolumeRestrictionTMProxy.sol"; import "../../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMProxy.sol b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMProxy.sol index 4fcb37f1c..f084e8c02 100644 --- a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMProxy.sol +++ b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../../proxy/OwnedUpgradeabilityProxy.sol"; import "./VolumeRestrictionTMStorage.sol"; diff --git a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMStorage.sol b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMStorage.sol index 293aa5810..febd4fc10 100644 --- a/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMStorage.sol +++ b/contracts/modules/TransferManager/VRTM/VolumeRestrictionTMStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Storage layout for VolumeRestrictionTM diff --git a/contracts/modules/UpgradableModuleFactory.sol b/contracts/modules/UpgradableModuleFactory.sol index cd4f74524..f09d467fd 100644 --- a/contracts/modules/UpgradableModuleFactory.sol +++ b/contracts/modules/UpgradableModuleFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./ModuleFactory.sol"; import "../interfaces/IModuleRegistry.sol"; diff --git a/contracts/modules/Wallet/VestingEscrowWallet.sol b/contracts/modules/Wallet/VestingEscrowWallet.sol index 20893ff06..3fe28d1ec 100644 --- a/contracts/modules/Wallet/VestingEscrowWallet.sol +++ b/contracts/modules/Wallet/VestingEscrowWallet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/math/SafeMath.sol"; import "./Wallet.sol"; diff --git a/contracts/modules/Wallet/VestingEscrowWalletFactory.sol b/contracts/modules/Wallet/VestingEscrowWalletFactory.sol index bf5dc48dd..725de9e08 100644 --- a/contracts/modules/Wallet/VestingEscrowWalletFactory.sol +++ b/contracts/modules/Wallet/VestingEscrowWalletFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./VestingEscrowWalletProxy.sol"; import "../UpgradableModuleFactory.sol"; diff --git a/contracts/modules/Wallet/VestingEscrowWalletProxy.sol b/contracts/modules/Wallet/VestingEscrowWalletProxy.sol index b3073e5e2..05b74c77d 100644 --- a/contracts/modules/Wallet/VestingEscrowWalletProxy.sol +++ b/contracts/modules/Wallet/VestingEscrowWalletProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../../proxy/OwnedUpgradeabilityProxy.sol"; import "./VestingEscrowWalletStorage.sol"; diff --git a/contracts/modules/Wallet/VestingEscrowWalletStorage.sol b/contracts/modules/Wallet/VestingEscrowWalletStorage.sol index 98c0e50ec..1c8b27a9f 100644 --- a/contracts/modules/Wallet/VestingEscrowWalletStorage.sol +++ b/contracts/modules/Wallet/VestingEscrowWalletStorage.sol @@ -1,10 +1,10 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Wallet for core vesting escrow functionality */ contract VestingEscrowWalletStorage { - + struct Schedule { // Name of the template bytes32 templateName; diff --git a/contracts/modules/Wallet/Wallet.sol b/contracts/modules/Wallet/Wallet.sol index 0e89bb8e0..0b8b48002 100644 --- a/contracts/modules/Wallet/Wallet.sol +++ b/contracts/modules/Wallet/Wallet.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../Module.sol"; diff --git a/contracts/oracles/MakerDAOOracle.sol b/contracts/oracles/MakerDAOOracle.sol index 01d26f1e1..1db3d956b 100644 --- a/contracts/oracles/MakerDAOOracle.sol +++ b/contracts/oracles/MakerDAOOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IOracle.sol"; import "../external/IMedianizer.sol"; diff --git a/contracts/oracles/PolyOracle.sol b/contracts/oracles/PolyOracle.sol index 7345e5395..367f19b0c 100644 --- a/contracts/oracles/PolyOracle.sol +++ b/contracts/oracles/PolyOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../external/oraclizeAPI.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; diff --git a/contracts/oracles/StableOracle.sol b/contracts/oracles/StableOracle.sol index 3dabf26d2..aaa8014e5 100644 --- a/contracts/oracles/StableOracle.sol +++ b/contracts/oracles/StableOracle.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IOracle.sol"; import "openzeppelin-solidity/contracts/ownership/Ownable.sol"; diff --git a/contracts/proxy/ModuleRegistryProxy.sol b/contracts/proxy/ModuleRegistryProxy.sol index 168905a56..9c286993f 100644 --- a/contracts/proxy/ModuleRegistryProxy.sol +++ b/contracts/proxy/ModuleRegistryProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../storage/EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; diff --git a/contracts/proxy/OwnedUpgradeabilityProxy.sol b/contracts/proxy/OwnedUpgradeabilityProxy.sol index f81fc289d..7e3b837f2 100644 --- a/contracts/proxy/OwnedUpgradeabilityProxy.sol +++ b/contracts/proxy/OwnedUpgradeabilityProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./UpgradeabilityProxy.sol"; diff --git a/contracts/proxy/Proxy.sol b/contracts/proxy/Proxy.sol index ac9d471ca..aa19442ca 100644 --- a/contracts/proxy/Proxy.sol +++ b/contracts/proxy/Proxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Proxy diff --git a/contracts/proxy/SecurityTokenRegistryProxy.sol b/contracts/proxy/SecurityTokenRegistryProxy.sol index 906797985..4a30439e8 100644 --- a/contracts/proxy/SecurityTokenRegistryProxy.sol +++ b/contracts/proxy/SecurityTokenRegistryProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../storage/EternalStorage.sol"; import "./OwnedUpgradeabilityProxy.sol"; diff --git a/contracts/proxy/UpgradeabilityProxy.sol b/contracts/proxy/UpgradeabilityProxy.sol index dc702dae9..59949f90d 100644 --- a/contracts/proxy/UpgradeabilityProxy.sol +++ b/contracts/proxy/UpgradeabilityProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./Proxy.sol"; import "openzeppelin-solidity/contracts/utils/Address.sol"; diff --git a/contracts/storage/EternalStorage.sol b/contracts/storage/EternalStorage.sol index a3b914b60..e7ff6acb5 100644 --- a/contracts/storage/EternalStorage.sol +++ b/contracts/storage/EternalStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract EternalStorage { /// @notice Internal mappings used to store all kinds on data into the contract diff --git a/contracts/storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol b/contracts/storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol index eeafa0743..94fc0962b 100644 --- a/contracts/storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol +++ b/contracts/storage/modules/Checkpoint/Dividend/DividendCheckpointStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Holds the storage variable for the DividendCheckpoint modules (i.e ERC20, Ether) diff --git a/contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol b/contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol index 868e9d4db..d4b728572 100644 --- a/contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol +++ b/contracts/storage/modules/Checkpoint/Voting/VotingCheckpointStorage.sol @@ -1,8 +1,8 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; contract VotingCheckpointStorage { mapping(address => uint256) defaultExemptIndex; address[] defaultExemptedVoters; - -} \ No newline at end of file + +} diff --git a/contracts/storage/modules/ModuleStorage.sol b/contracts/storage/modules/ModuleStorage.sol index cfd7d26bb..9e34f16df 100644 --- a/contracts/storage/modules/ModuleStorage.sol +++ b/contracts/storage/modules/ModuleStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol"; import "../../interfaces/ISecurityToken.sol"; diff --git a/contracts/storage/modules/STO/ISTOStorage.sol b/contracts/storage/modules/STO/ISTOStorage.sol index 4ff7b9294..ccddb7e7f 100644 --- a/contracts/storage/modules/STO/ISTOStorage.sol +++ b/contracts/storage/modules/STO/ISTOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Storage layout for the ISTO contract @@ -21,4 +21,4 @@ contract ISTOStorage { // Final amount of tokens sold uint256 public totalTokensSold; -} \ No newline at end of file +} diff --git a/contracts/storage/modules/STO/STOStorage.sol b/contracts/storage/modules/STO/STOStorage.sol index 87ae2c3e0..e28a932fc 100644 --- a/contracts/storage/modules/STO/STOStorage.sol +++ b/contracts/storage/modules/STO/STOStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /** * @title Storage layout for the STO contract diff --git a/contracts/tokens/OZStorage.sol b/contracts/tokens/OZStorage.sol index b61cf0ec0..051601005 100644 --- a/contracts/tokens/OZStorage.sol +++ b/contracts/tokens/OZStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; /* * @dev It is the contract that contains the storage items related to the ERC20 contract implementaiton diff --git a/contracts/tokens/STFactory.sol b/contracts/tokens/STFactory.sol index 3aabe6466..2f01f7e96 100644 --- a/contracts/tokens/STFactory.sol +++ b/contracts/tokens/STFactory.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./SecurityTokenProxy.sol"; import "../proxy/OwnedUpgradeabilityProxy.sol"; @@ -138,6 +138,7 @@ contract STFactory is ISTFactory, Ownable { * @notice Used to set a new token logic contract * @param _version Version of upgraded module * @param _logicContract Address of deployed module logic contract referenced from proxy + * @param _initializationData Initialization data that used to intialize value in the securityToken * @param _upgradeData Data to be passed in call to upgradeToAndCall when a token upgrades its module */ function setLogicContract(string calldata _version, address _logicContract, bytes calldata _initializationData, bytes calldata _upgradeData) external onlyOwner { diff --git a/contracts/tokens/STGetter.sol b/contracts/tokens/STGetter.sol index 027e91d75..d4810d948 100644 --- a/contracts/tokens/STGetter.sol +++ b/contracts/tokens/STGetter.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "./OZStorage.sol"; import "./SecurityTokenStorage.sol"; @@ -224,7 +224,7 @@ contract STGetter is OZStorage, SecurityTokenStorage { * @notice Return all partitions * @return List of partitions */ - function partitionsOf(address /*_tokenHolder*/) external view returns (bytes32[] memory) { + function partitionsOf(address /*_tokenHolder*/) external pure returns (bytes32[] memory) { bytes32[] memory result = new bytes32[](2); result[0] = UNLOCKED; result[1] = LOCKED; diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index ce0f97c79..26ee2b7ef 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../proxy/Proxy.sol"; import "../interfaces/IModule.sol"; @@ -41,7 +41,8 @@ contract SecurityToken is ERC20, ReentrancyGuard, SecurityTokenStorage, IERC1594 bytes32 _label, bool _archived ); - + // Emit when Module get upgraded from the securityToken + event ModuleUpgraded(uint8[] _types, address _module); // Emit when the token details get updated event UpdateTokenDetails(string _oldDetails, string _newDetails); // Emit when the token name get updated @@ -419,7 +420,7 @@ contract SecurityToken is ERC20, ReentrancyGuard, SecurityTokenStorage, IERC1594 * @return bool success */ function transfer(address _to, uint256 _value) public returns(bool success) { - transferWithData(_to, _value, ""); + _transferWithData(msg.sender, _to, _value, ""); return true; } @@ -484,13 +485,20 @@ contract SecurityToken is ERC20, ReentrancyGuard, SecurityTokenStorage, IERC1594 return _balanceOfByPartition(_partition, _tokenHolder, 0); } - function _balanceOfByPartition(bytes32 _partition, address _tokenHolder, uint256 _additionalBalance) internal view returns(uint256 max) { + function _balanceOfByPartition(bytes32 _partition, address _tokenHolder, uint256 _additionalBalance) internal view returns(uint256 partitionBalance) { address[] memory tms = modules[TRANSFER_KEY]; uint256 amount; for (uint256 i = 0; i < tms.length; i++) { amount = ITransferManager(tms[i]).getTokensByPartition(_partition, _tokenHolder, _additionalBalance); - if (max < amount) { - max = amount; + // In UNLOCKED partition we are returning the minimum of all the unlocked balances + if (_partition == UNLOCKED) { + if (amount < partitionBalance || i == 0) + partitionBalance = amount; + } + // In locked partition we are returning the maximum of all the Locked balances + else { + if (partitionBalance < amount) + partitionBalance = amount; } } } diff --git a/contracts/tokens/SecurityTokenProxy.sol b/contracts/tokens/SecurityTokenProxy.sol index 0c1487b03..8a5eb8d09 100644 --- a/contracts/tokens/SecurityTokenProxy.sol +++ b/contracts/tokens/SecurityTokenProxy.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../proxy/OwnedUpgradeabilityProxy.sol"; import "./OZStorage.sol"; diff --git a/contracts/tokens/SecurityTokenStorage.sol b/contracts/tokens/SecurityTokenStorage.sol index 263c02b4f..4651d0e25 100644 --- a/contracts/tokens/SecurityTokenStorage.sol +++ b/contracts/tokens/SecurityTokenStorage.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.5.0; +pragma solidity 0.5.8; import "../interfaces/IDataStore.sol"; import "../interfaces/IModuleRegistry.sol"; diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index e90e3d1a1..bad99d981 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -994,7 +994,7 @@ contract("CappedSTO", async (accounts) => { it("Should get the listed permissions", async () => { let tx = await I_CappedSTO_Array_POLY[0].getPermissions.call(); - assert.equal(tx.length, 0); + assert.equal(tx.length, 1); }); it("Should get the metrics of the STO", async () => { diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index c4ca7cc50..ac27f4ba2 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -392,7 +392,7 @@ contract("USDTieredSTO", async (accounts) => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions"); }); it("Should attach the paid STO factory -- failed because of no tokens", async () => { @@ -581,7 +581,7 @@ contract("USDTieredSTO", async (accounts) => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions"); }); it("Should successfully attach the third STO module to the security token", async () => { diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index 7364f813d..e51bf4ac6 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -362,7 +362,7 @@ contract("USDTieredSTO Sim", async (accounts) => { _tokensPerTierTotal[stoId].length, "Incorrect number of tiers" ); - assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(0), "Incorrect number of permissions"); + assert.equal((await I_USDTieredSTO_Array[stoId].getPermissions()).length, new BN(2), "Incorrect number of permissions"); }); it("Should successfully prepare the STO", async () => { diff --git a/test/zc_plcr_voting_checkpoint.js b/test/zc_plcr_voting_checkpoint.js index f1fd4a040..09c04a138 100644 --- a/test/zc_plcr_voting_checkpoint.js +++ b/test/zc_plcr_voting_checkpoint.js @@ -363,7 +363,7 @@ contract("PLCRVotingCheckpoint", async (accounts) => { let tx = await I_PLCRVotingCheckpoint.changeBallotExemptedVotersList(new BN(0), account_investor1, true, {from: token_owner}); assert.equal((tx.logs[0].args._ballotId).toString(), 0); assert.equal(tx.logs[0].args._voter, account_investor1); - assert.equal(tx.logs[0].args._change, true); + assert.equal(tx.logs[0].args._exempt, true); }); it("\t\t Should fail to add voter in ballot exemption list -- doing the same change again", async() => { @@ -426,7 +426,7 @@ contract("PLCRVotingCheckpoint", async (accounts) => { it("\t\t Should add the voter in to the default exemption list", async() => { let tx = await I_PLCRVotingCheckpoint.changeDefaultExemptedVotersList(account_investor3, true, {from: token_owner}); assert.equal(tx.logs[0].args._voter, account_investor3); - assert.equal(tx.logs[0].args._change, true); + assert.equal(tx.logs[0].args._exempt, true); }); it("\t\t Should fail to add voter in default exemption list -- doing the same change again", async() => { diff --git a/test/zd_weighted_vote_checkpoint.js b/test/zd_weighted_vote_checkpoint.js index a0d67bdf2..5cdf4c423 100644 --- a/test/zd_weighted_vote_checkpoint.js +++ b/test/zd_weighted_vote_checkpoint.js @@ -308,7 +308,7 @@ contract("WeightedVoteCheckpoint", async (accounts) => { let tx = await I_WeightedVoteCheckpoint.changeBallotExemptedVotersList(new BN(0), account_investor2, true, {from: token_owner}); assert.equal((tx.logs[0].args._ballotId).toString(), 0); assert.equal(tx.logs[0].args._voter, account_investor2); - assert.equal(tx.logs[0].args._change, true); + assert.equal(tx.logs[0].args._exempt, true); }); it("\t\t Should fail to add voter in ballot exemption list -- doing the same change again", async() => { @@ -355,7 +355,7 @@ contract("WeightedVoteCheckpoint", async (accounts) => { it("\t\t Should add the voter in to the default exemption list", async() => { let tx = await I_WeightedVoteCheckpoint.changeDefaultExemptedVotersList(account_investor1, true, {from: token_owner}); assert.equal(tx.logs[0].args._voter, account_investor1); - assert.equal(tx.logs[0].args._change, true); + assert.equal(tx.logs[0].args._exempt, true); }); it("\t\t Should fail to add voter in default exemption list -- doing the same change again", async() => {