diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index 38d2c6b1d..c6498b744 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -18,6 +18,7 @@ contract ModuleRegistry is IModuleRegistry, Ownable { mapping (address => address[]) public reputation; mapping (uint8 => address[]) public moduleList; mapping (address => bool) public verified; + mapping (uint8 => bytes32[]) public availableTags; address public securityTokenRegistry; @@ -78,4 +79,38 @@ contract ModuleRegistry is IModuleRegistry, Ownable { securityTokenRegistry = _securityTokenRegistry; } + /** + * @dev Use to get all the tags releated to the functionality of the Module Factory. + * @param _moduleType Type of module + */ + function getTagByModuleType(uint8 _moduleType) public view returns(bytes32[]) { + return availableTags[_moduleType]; + } + + /** + * @dev Add the tag for specified Module Factory + * @param _moduleType Type of module. + * @param _tag List of tags + */ + function addTagByModuleType(uint8 _moduleType, bytes32[] _tag) public onlyOwner { + for (uint8 i = 0; i < _tag.length; i++) { + availableTags[_moduleType].push(_tag[i]); + } + } + + /** + * @dev remove the tag for specified Module Factory + * @param _moduleType Type of module. + * @param _removedTags List of tags + */ + function removeTagByModuleType(uint8 _moduleType, bytes32[] _removedTags) public onlyOwner { + for (uint8 i = 0; i < availableTags[_moduleType].length; i++) { + for (uint8 j = 0; j < _removedTags.length; j++) { + if (availableTags[_moduleType][i] == _removedTags[j]) { + delete availableTags[_moduleType][i]; + } + } + } + } + } diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index f27906de5..3a38271a7 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -28,6 +28,8 @@ contract IModuleFactory is Ownable { function getTitle() public view returns(string); function getInstructions() public view returns (string); + + function getTags() public view returns (bytes32[]); //Pull function sig from _data function getSig(bytes _data) internal pure returns (bytes4 sig) { diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index 0b6c430c6..5780aad7e 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -9,4 +9,6 @@ contract IModuleRegistry { function registerModule(address _moduleFactory) external returns(bool); + function getTagByModuleType(uint8 _moduleType) public view returns(bytes32[]); + } diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index 80e8e6a69..fffef141c 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -42,4 +42,8 @@ contract GeneralPermissionManagerFactory is IModuleFactory { return "Add and remove permissions for the SecurityToken and associated modules. Permission types should be encoded as bytes32 values, and attached using the withPerm modifier to relevant functions.No initFunction required."; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](1); + return availableTags; + } } diff --git a/contracts/modules/STO/CappedSTOFactory.sol b/contracts/modules/STO/CappedSTOFactory.sol index 0bc9f5428..2b03b5ca2 100644 --- a/contracts/modules/STO/CappedSTOFactory.sol +++ b/contracts/modules/STO/CappedSTOFactory.sol @@ -48,5 +48,13 @@ contract CappedSTOFactory is IModuleFactory { return "Initialises a capped STO. Init parameters are _startTime (time STO starts), _endTime (time STO ends), _cap (cap in tokens for STO), _rate (POLY/ETH to token rate), _fundRaiseType (whether you are raising in POLY or ETH), _polyToken (address of POLY token), _fundsReceiver (address which will receive funds)"; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](4); + availableTags[0] = "Capped"; + availableTags[1] = "Non-refundable"; + availableTags[2] = "POLY"; + availableTags[3] = "ETH"; + return availableTags; + } } diff --git a/contracts/modules/STO/DummySTOFactory.sol b/contracts/modules/STO/DummySTOFactory.sol index a3ec20dc7..11fd81fee 100644 --- a/contracts/modules/STO/DummySTOFactory.sol +++ b/contracts/modules/STO/DummySTOFactory.sol @@ -49,4 +49,11 @@ contract DummySTOFactory is IModuleFactory { return "Dummy STO - you can mint tokens at will"; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](4); + availableTags[0] = "Dummy"; + availableTags[1] = "Non-refundable"; + availableTags[2] = "ETH"; + return availableTags; + } } diff --git a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol index ebdd17c7f..91f227445 100644 --- a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol @@ -46,4 +46,10 @@ contract ExchangeTransferManagerFactory is IModuleFactory { return "Allows an exchange to whitelist users for depositing / withdrawing from an exchange address. Init function takes exchange address as a parameter and users are added via modifyWhitelist."; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](2); + availableTags[0] = "Exchange"; + availableTags[1] = "Transfer Restriction"; + return availableTags; + } } diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index b7e23081b..20f6db136 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -42,5 +42,12 @@ contract GeneralTransferManagerFactory is IModuleFactory { return "Allows an issuer to maintain a time based whitelist of authorised token holders.Addresses are added via modifyWhitelist, and take a fromTime (the time from which they can send tokens) and a toTime (the time from which they can receive tokens). There are additional flags, allowAllWhitelistIssuances, allowAllWhitelistTransfers & allowAllTransfers which allow you to set corresponding contract level behaviour. Init function takes no parameters."; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](2); + availableTags[0] = "General"; + availableTags[1] = "Transfer Restriction"; + return availableTags; + } + } diff --git a/test/helpers/contracts/TestSTOFactory.sol b/test/helpers/contracts/TestSTOFactory.sol index 40db6a6f7..67e5abc82 100644 --- a/test/helpers/contracts/TestSTOFactory.sol +++ b/test/helpers/contracts/TestSTOFactory.sol @@ -48,4 +48,12 @@ contract TestSTOFactory is IModuleFactory { return "Test STO - you can mint tokens at will"; } + function getTags() public view returns(bytes32[]) { + bytes32[] memory availableTags = new bytes32[](4); + availableTags[0] = "Test"; + availableTags[1] = "Non-refundable"; + availableTags[2] = "ETH"; + return availableTags; + } + }