Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions contracts/ModuleRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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];
}
}
}
}

}
2 changes: 2 additions & 0 deletions contracts/interfaces/IModuleFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/IModuleRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ contract IModuleRegistry {

function registerModule(address _moduleFactory) external returns(bool);

function getTagByModuleType(uint8 _moduleType) public view returns(bytes32[]);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
8 changes: 8 additions & 0 deletions contracts/modules/STO/CappedSTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
7 changes: 7 additions & 0 deletions contracts/modules/STO/DummySTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


}
8 changes: 8 additions & 0 deletions test/helpers/contracts/TestSTOFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}