From 37c59f7e2085bb3d1a34f126f3ef7494be40b6d7 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 19:14:50 +0100 Subject: [PATCH 1/7] WIP --- contracts/ModuleRegistry.sol | 86 +++++++++++-------- contracts/interfaces/IModuleRegistry.sol | 54 ++++++------ .../interfaces/ISecurityTokenRegistry.sol | 2 +- 3 files changed, 76 insertions(+), 66 deletions(-) diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index c6b150385..a41f78cde 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -33,8 +33,6 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { // contains the list of verified modules mapping (address => bool) public verified; - // Contains the list of the available tags corresponding to each module type - mapping (uint8 => bytes32[]) public availableTags; */ /////////// @@ -70,7 +68,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @notice Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPausedOrOwner() { - if (msg.sender == getAddress(Encoder.getKey("owner"))) + if (msg.sender == getAddress(Encoder.getKey("owner"))) _; else { require(!getBool(Encoder.getKey("paused")), "Already paused"); @@ -106,7 +104,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { function initialize(address _polymathRegistry, address _owner) external payable { require(!getBool(Encoder.getKey("initialised"))); - require(_owner != address(0) && _polymathRegistry != address(0), "0x address is in-valid"); + require(_owner != address(0) && _polymathRegistry != address(0), "0x address is invalid"); set(Encoder.getKey("polymathRegistry"), _polymathRegistry); set(Encoder.getKey("owner"), _owner); set(Encoder.getKey("initialised"), true); @@ -144,6 +142,9 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _moduleFactory is the address of the module factory to be registered */ function registerModule(address _moduleFactory) external whenNotPausedOrOwner { + if (IFeatureRegistry(getAddress(Encoder.getKey('featureRegistry'))).getFeatureStatus("customModulesAllowed")) { + require(msg.sender == getAddress(Encoder.getKey("owner")), "Only owner allowed to register modules"); + } require(getUint(Encoder.getKey('registry', _moduleFactory)) == 0, "Module factory should not be pre-registered"); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); uint8 moduleType = moduleFactory.getType(); @@ -172,7 +173,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { // pop from array and re-order if (index != last) { // moduleList[moduleType][index] = temp; - setArrayIndexValue(Encoder.getKey('moduleList', moduleType), index, temp); + setArrayIndexValue(Encoder.getKey('moduleList', moduleType), index, temp); set(Encoder.getKey('moduleListIndex', temp), index); } deleteArrayAddress(Encoder.getKey('moduleList', moduleType), last); @@ -196,48 +197,61 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _moduleFactory is the address of the module factory to be verified * @return bool */ - function verifyModule(address _moduleFactory, bool _verified) external onlyOwner returns(bool) { + function verifyModule(address _moduleFactory, bool _verified) external onlyOwner { require(getUint(Encoder.getKey('registry', _moduleFactory)) != uint256(0), "Module factory must be registered"); set(Encoder.getKey('verified', _moduleFactory), _verified); emit ModuleVerified(_moduleFactory, _verified); - return true; } /** - * @notice Adds a list of tags for the specified Module Factory - * @dev This function is susceptible to hit the block gas limit if too many tags get added. - * @param _moduleType is the module type. - * @param _tag is the list of tags to add. + * @notice Returns all the tags related to the a module type which are valid for the given token + * @param _moduleType is the module type + * @param _securityToken is the token + * @return list of tags + * @return corresponding list of module factories */ - function addTagByModuleType(uint8 _moduleType, bytes32[] _tag) external onlyOwner { - for (uint8 i = 0; i < _tag.length; i++) { - pushArray(Encoder.getKey('availableTags', uint256(_moduleType)), _tag[i]); - } - } + function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[], address[]) { + address[] memory modules = getModulesByTypeAndToken(_moduleType, _securityToken); + return _tagsByModules(modules); + } /** - * @notice Removes the tag for specified Module Factory - * @dev This function is susceptible to hit the block gas limit if too many tags get removed. - * @param _moduleType is the module type. - * @param _removedTags is the list of tags to remove + * @notice Returns all the tags related to the a module type which are valid for the given token + * @param _moduleType is the module type + * @return list of tags + * @return corresponding list of module factories */ - function removeTagByModuleType(uint8 _moduleType, bytes32[] _removedTags) external onlyOwner { - for (uint8 i = 0; i < getArrayBytes32(Encoder.getKey('availableTags', uint256(_moduleType))).length; i++) { - for (uint8 j = 0; j < _removedTags.length; j++) { - if (getArrayBytes32(Encoder.getKey('availableTags', uint256(_moduleType)))[i] == _removedTags[j]) { - deleteArrayBytes32(Encoder.getKey('availableTags', uint256(_moduleType)), uint256(i)); - } - } - } + function getTagsByType(uint8 _moduleType) external view returns(bytes32[], address[]) { + address[] memory modules = getModulesByType(_moduleType); + return _tagsByModules(modules); } /** - * @notice Returns all the tags related to the functionality of the entered Module Factory. - * @param _moduleType is the module type - * @return bytes32 array + * @notice Returns all the tags related to the modules provided + * @param _modules modules to return tags for + * @return list of tags + * @return corresponding list of module factories */ - function getTagByModuleType(uint8 _moduleType) public view returns(bytes32[]) { - return getArrayBytes32(Encoder.getKey('availableTags', uint256(_moduleType))); + function _tagsByModules(address[] _modules) internal view returns(bytes32[], address[]) { + uint256 counter = 0; + uint256 i; + uint256 j; + for (i = 0; i < _modules.length; i++) { + counter = counter + IModuleFactory(_modules[i]).getTags().length; + } + bytes32[] memory tags = new bytes32[](counter); + address[] memory modules = new address[](counter); + bytes32[] memory tempTags; + counter = 0; + for (i = 0; i < _modules.length; i++) { + tempTags = IModuleFactory(_modules[i]).getTags(); + for (j = 0; j < tempTags.length; j++) { + tags[counter] = tempTags[j]; + modules[counter] = _modules[i]; + counter++; + } + } + return (tags, modules); } /** @@ -245,7 +259,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _factoryAddress is the address of the module factory * @return address array which contains the list of securityTokens that use that module factory */ - function getReputationOfFactory(address _factoryAddress) external view returns(address[]) { + function getReputationByFactory(address _factoryAddress) external view returns(address[]) { return getArrayAddress(Encoder.getKey('reputation', _factoryAddress)); } @@ -254,7 +268,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _moduleType Type of Module * @return address array that contains the list of addresses of module factory contracts. */ - function getModuleListOfType(uint8 _moduleType) external view returns(address[]) { + function getModulesByType(uint8 _moduleType) public view returns(address[]) { return getArrayAddress(Encoder.getKey('moduleList', uint256(_moduleType))); } @@ -264,7 +278,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { * @param _securityToken is the address of SecurityToken * @return address array that contains the list of available addresses of module factory contracts. */ - function getAvailableModulesOfType(uint8 _moduleType, address _securityToken) external view returns (address[]) { + function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) public view returns (address[]) { uint256 _len = getArrayAddress(Encoder.getKey('moduleList', uint256(_moduleType))).length; address[] memory _addressList = getArrayAddress(Encoder.getKey('moduleList', uint256(_moduleType))); uint256 counter = 0; diff --git a/contracts/interfaces/IModuleRegistry.sol b/contracts/interfaces/IModuleRegistry.sol index 59763bd57..a5276c7a1 100644 --- a/contracts/interfaces/IModuleRegistry.sol +++ b/contracts/interfaces/IModuleRegistry.sol @@ -23,56 +23,52 @@ interface IModuleRegistry { */ function removeModule(address _moduleFactory) external; - /** - * @notice Use to get all the tags releated to the functionality of the Module Factory. - * @param _moduleType Type of module - */ - function getTagByModuleType(uint8 _moduleType) external view returns(bytes32[]); - /** * @notice Called by Polymath to verify modules for SecurityToken to use. * @notice A module can not be used by an ST unless first approved/verified by Polymath * @notice (The only exception to this is that the author of the module is the owner of the ST) * @param _moduleFactory is the address of the module factory to be registered - * @return bool */ - function verifyModule(address _moduleFactory, bool _verified) external returns(bool); + function verifyModule(address _moduleFactory, bool _verified) external; /** - * @notice Add the tag for specified Module Factory - * @param _moduleType Type of module. - * @param _tag List of tags + * @notice Used to get the reputation of a Module Factory + * @param _factoryAddress address of the Module Factory + * @return address array which has the list of securityToken's uses that module factory */ - function addTagByModuleType(uint8 _moduleType, bytes32[] _tag) external; + function getReputationByFactory(address _factoryAddress) external view returns(address[]); - /** - * @notice remove a tag for a Module Factory - * @param _moduleType Type of module. - * @param _removedTags List of tags - */ - function removeTagByModuleType(uint8 _moduleType, bytes32[] _removedTags) external; + /** + * @notice Returns all the tags related to the a module type which are valid for the given token + * @param _moduleType is the module type + * @param _securityToken is the token + * @return list of tags + * @return corresponding list of module factories + */ + function getTagsByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns(bytes32[], address[]); /** - * @notice Used to get the reputation of a Module Factory - * @param _factoryAddress address of the Module Factory - * @return address array which has the list of securityToken's uses that module factory + * @notice Returns all the tags related to the a module type which are valid for the given token + * @param _moduleType is the module type + * @return list of tags + * @return corresponding list of module factories */ - function getReputationOfFactory(address _factoryAddress) external view returns(address[]); + function getTagsByType(uint8 _moduleType) external view returns(bytes32[], address[]); /** - * @notice Use to get the list of Module Factory addresses for a given module type + * @notice Returns the list of addresses of Module Factory of a particular type * @param _moduleType Type of Module - * @return address array thal contains the list of addresses of module factory contracts. + * @return address array that contains the list of addresses of module factory contracts. */ - function getModuleListOfType(uint8 _moduleType) external view returns(address[]); + function getModulesByType(uint8 _moduleType) external view returns(address[]); /** - * @notice Use to get the list of available Module factory addresses for a particular type - * @param _moduleType Type of Module - * @param _securityToken Address of securityToken + * @notice Returns the list of available Module factory addresses of a particular type for a given token. + * @param _moduleType is the module type to look for + * @param _securityToken is the address of SecurityToken * @return address array that contains the list of available addresses of module factory contracts. */ - function getAvailableModulesOfType(uint8 _moduleType, address _securityToken) external view returns (address[]); + function getModulesByTypeAndToken(uint8 _moduleType, address _securityToken) external view returns (address[]); /** * @notice Use to get the latest contract address of the regstries diff --git a/contracts/interfaces/ISecurityTokenRegistry.sol b/contracts/interfaces/ISecurityTokenRegistry.sol index 444fb5375..d7ec8f9f0 100644 --- a/contracts/interfaces/ISecurityTokenRegistry.sol +++ b/contracts/interfaces/ISecurityTokenRegistry.sol @@ -84,7 +84,7 @@ interface ISecurityTokenRegistry { /** * @notice get Protocol version */ - function getProtocolVersion() public view returns(uint8[]); + function getProtocolVersion() external view returns(uint8[]); /** * @notice Use to get the ticker list as per the owner From fefbb87d8217315a802be55c19c7478e7ee4cf14 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 22:04:37 +0100 Subject: [PATCH 2/7] Updates --- CHANGELOG.md | 8 +- migrations/2_deploy_contracts.js | 46 +++---- test/k_module_registry.js | 170 +++++++++++------------- test/t_security_token_registry_proxy.js | 2 +- test/u_module_registry_proxy.js | 8 +- 5 files changed, 113 insertions(+), 121 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 045db881c..1da8b2497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file. [__1.5.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __15-08-18__ ## Added +* Added `getTagsByType`, `getTagsByTypeAndToken`, `getModulesByType`, `getModulesByTypeAndToken` to MR +* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR * Added `getTokensByOwner` to STR * Added withholding tax to ether & erc20 dividends * Generalised MakerDAO oracle to allow different instances referencing different currencies @@ -24,10 +26,10 @@ All notable changes to this project will be documented in this file. ## Fixed * Generalize the STO varaible names and added them in `ISTO.sol` to use the common standard in all STOs. * Generalize the event when any new token get registered with the polymath ecosystem. `LogNewSecurityToken` should emit _ticker, _name, _securityTokenAddress, _owner, _addedAt, _registrant respectively. #230 - -## Removed + +## Removed * Remove `swarmHash` from the `registerTicker(), addCustomTicker(), generateSecurityToken(), addCustomSecurityToken()` functions of TickerRegistry.sol and SecurityTokenRegistry.sol. #230 -* Remove `Log` prefix from all the event present in the ecosystem. +* Remove `Log` prefix from all the event present in the ecosystem. ====== diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 9b9c5eb64..97124b804 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -164,6 +164,29 @@ const functionSignatureProxyMR = { // D) Deploy the ManualApprovalTransferManagerFactory Contract (Factory used to generate the ManualApprovalTransferManager contract use // to manual approve the transfer that will overcome the other transfer restrictions) return deployer.deploy(ManualApprovalTransferManagerFactory, PolyToken, 0, 0, 0, {from: PolymathAccount}); + }).then(() => { + // H) Deploy the STVersionProxy001 Contract which contains the logic of deployment of securityToken. + return deployer.deploy(STFactory, GeneralTransferManagerFactory.address, {from: PolymathAccount}); + }).then(() => { + // K) Deploy the FeatureRegistry contract to control feature switches + return deployer.deploy(FeatureRegistry, PolymathRegistry.address, {from: PolymathAccount}); + }).then(() => { + // Assign the address into the FeatureRegistry key + return polymathRegistry.changeAddress("FeatureRegistry", FeatureRegistry.address, {from: PolymathAccount}); + }).then(() => { + // J) Deploy the SecurityTokenRegistry contract (Used to hold the deployed secuirtyToken details. It also act as the interface to deploy the SecurityToken) + return deployer.deploy(SecurityTokenRegistry, {from: PolymathAccount}) + }).then(()=> { + return deployer.deploy(SecurityTokenRegistryProxy, {from: PolymathAccount}); + }).then(() => { + let bytesProxy = web3.eth.abi.encodeFunctionCall(functionSignatureProxy, [PolymathRegistry.address, STFactory.address, initRegFee, initRegFee, PolyToken, PolymathAccount]); + SecurityTokenRegistryProxy.at(SecurityTokenRegistryProxy.address).upgradeToAndCall("1.0.0", SecurityTokenRegistry.address, bytesProxy, {from: PolymathAccount}); + }).then(() => { + // Assign the address into the SecurityTokenRegistry key + return polymathRegistry.changeAddress("SecurityTokenRegistry", SecurityTokenRegistryProxy.address, {from: PolymathAccount}); + }).then(() => { + // Update all addresses into the registry contract by calling the function updateFromregistry + return moduleRegistry.updateFromRegistry({from: PolymathAccount}); }).then(() => { // D) Register the PercentageTransferManagerFactory in the ModuleRegistry to make the factory available at the protocol level. // So any securityToken can use that factory to generate the PercentageTransferManager contract. @@ -227,29 +250,6 @@ const functionSignatureProxyMR = { // contract, Factory should comes under the verified list of factories or those factories deployed by the securityToken issuers only. // Here it gets verified because it is deployed by the third party account (Polymath Account) not with the issuer accounts. return moduleRegistry.verifyModule(ManualApprovalTransferManagerFactory.address, true, {from: PolymathAccount}); - }).then(() => { - // H) Deploy the STVersionProxy001 Contract which contains the logic of deployment of securityToken. - return deployer.deploy(STFactory, GeneralTransferManagerFactory.address, {from: PolymathAccount}); - }).then(() => { - // K) Deploy the FeatureRegistry contract to control feature switches - return deployer.deploy(FeatureRegistry, PolymathRegistry.address, {from: PolymathAccount}); - }).then(() => { - // Assign the address into the FeatureRegistry key - return polymathRegistry.changeAddress("FeatureRegistry", FeatureRegistry.address, {from: PolymathAccount}); - }).then(() => { - // J) Deploy the SecurityTokenRegistry contract (Used to hold the deployed secuirtyToken details. It also act as the interface to deploy the SecurityToken) - return deployer.deploy(SecurityTokenRegistry, {from: PolymathAccount}) - }).then(()=> { - return deployer.deploy(SecurityTokenRegistryProxy, {from: PolymathAccount}); - }).then(() => { - let bytesProxy = web3.eth.abi.encodeFunctionCall(functionSignatureProxy, [PolymathRegistry.address, STFactory.address, initRegFee, initRegFee, PolyToken, PolymathAccount]); - SecurityTokenRegistryProxy.at(SecurityTokenRegistryProxy.address).upgradeToAndCall("1.0.0", SecurityTokenRegistry.address, bytesProxy, {from: PolymathAccount}); - }).then(() => { - // Assign the address into the SecurityTokenRegistry key - return polymathRegistry.changeAddress("SecurityTokenRegistry", SecurityTokenRegistryProxy.address, {from: PolymathAccount}); - }).then(() => { - // Update all addresses into the registry contract by calling the function updateFromregistry - return moduleRegistry.updateFromRegistry({from: PolymathAccount}); }).then(() => { // M) Deploy the CappedSTOFactory (Use to generate the CappedSTO contract which will used to collect the funds ). return deployer.deploy(CappedSTOFactory, PolyToken, cappedSTOSetupCost, 0, 0, {from: PolymathAccount}) diff --git a/test/k_module_registry.js b/test/k_module_registry.js index 2cda2da9b..34007d27d 100644 --- a/test/k_module_registry.js +++ b/test/k_module_registry.js @@ -129,7 +129,7 @@ contract('ModuleRegistry', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); assert.notEqual( @@ -178,7 +178,7 @@ contract('ModuleRegistry', accounts => { await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, {from: account_polymath}); I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); - + assert.notEqual( I_FeatureRegistry.address.valueOf(), @@ -276,11 +276,11 @@ contract('ModuleRegistry', accounts => { assert.equal(tx.logs[0].args._moduleFactory, I_GeneralTransferManagerFactory.address, "Should be the same address"); assert.equal(tx.logs[0].args._owner, account_polymath, "Should be the right owner"); - let _list = await I_MRProxied.getModuleListOfType(transferManagerKey); + let _list = await I_MRProxied.getModulesByType(transferManagerKey); assert.equal(_list.length, 1, "Length should be 1"); assert.equal(_list[0], I_GeneralTransferManagerFactory.address); - let _reputation = await I_MRProxied.getReputationOfFactory(I_GeneralTransferManagerFactory.address); + let _reputation = await I_MRProxied.getReputationByFactory(I_GeneralTransferManagerFactory.address); assert.equal(_reputation.length, 0); }); @@ -368,7 +368,7 @@ contract('ModuleRegistry', accounts => { }) describe("Test cases for the useModule function of the module registry", async() => { - + it("Deploy the securityToken", async() => { await I_PolyToken.getTokens(web3.utils.toWei("500"), account_issuer); await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("500"), {from: account_issuer}); @@ -392,30 +392,30 @@ contract('ModuleRegistry', accounts => { } assert.ok(errorThrown, message); }); - + it("Should fail to add module because custom modules not allowed", async() => { I_CappedSTOFactory2 = await CappedSTOFactory.new(I_PolyToken.address, 0, 0, 0, { from: token_owner }); - + assert.notEqual( I_CappedSTOFactory2.address.valueOf(), "0x0000000000000000000000000000000000000000", "CappedSTOFactory contract was not deployed" ); - + let tx = await I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner }); - + assert.equal( tx.logs[0].args._moduleFactory, I_CappedSTOFactory2.address, "CappedSTOFactory is not registerd successfully" ); - + assert.equal(tx.logs[0].args._owner, token_owner); - + startTime = latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - + let errorThrown = false; try { tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner, gas: 60000000 }); @@ -426,20 +426,20 @@ contract('ModuleRegistry', accounts => { } assert.ok(errorThrown, message); }); - + it("Should switch customModulesAllowed to true", async() => { assert.equal(false, await I_FeatureRegistry.getFeatureStatus.call("customModulesAllowed"), "Custom modules should be dissabled by default."); let tx = await I_FeatureRegistry.setFeatureStatus("customModulesAllowed", true, { from: account_polymath }); assert.equal(true, await I_FeatureRegistry.getFeatureStatus.call("customModulesAllowed"), "Custom modules should be switched to true."); }); - + it("Should successfully add module because custom modules switched on", async() => { startTime = latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - + let tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner, gas: 60000000 }); - + assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( web3.utils.toAscii(tx.logs[2].args._name) @@ -447,10 +447,10 @@ contract('ModuleRegistry', accounts => { "CappedSTO", "CappedSTOFactory module was not added" ); - let _reputation = await I_MRProxied.getReputationOfFactory.call(I_CappedSTOFactory2.address); + let _reputation = await I_MRProxied.getReputationByFactory.call(I_CappedSTOFactory2.address); assert.equal(_reputation.length, 1); }); - + it("Should successfully add verified module", async() => { I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, 0, 0, 0, {from: account_polymath}); await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, {from: account_polymath}); @@ -461,7 +461,7 @@ contract('ModuleRegistry', accounts => { it("Should failed in adding the TestSTOFactory module because not compatible with the current protocol version --lower", async() => { I_TestSTOFactory = await TestSTOFactory.new(I_PolyToken.address, 0, 0, 0, {from: account_polymath}); - await I_MRProxied.registerModule(I_TestSTOFactory.address, {from: token_owner}); + await I_MRProxied.registerModule(I_TestSTOFactory.address, {from: account_polymath}); await I_MRProxied.verifyModule(I_TestSTOFactory.address, true, {from: account_polymath}); // Taking the snapshot the revert the changes from here let id = await takeSnapshot(); @@ -513,59 +513,49 @@ contract('ModuleRegistry', accounts => { }); - describe("Test cases for the tag functions", async() => { - - it("Should fail in adding the tag. Because msg.sender is not the owner", async() => { - let errorThrown = false; - try { - await I_MRProxied.addTagByModuleType(3,["Non-Refundable","Capped","ETH","POLY"],{from: account_temp}); - } catch(error) { - console.log(` tx revert -> msg.sender should be account_polymath`.grey); - errorThrown = true; - ensureException(error); - } - assert.ok(errorThrown, message); - }); - - it("Should successfully add the tag", async() => { - await I_MRProxied.addTagByModuleType(3,["Non-Refundable","Capped","ETH","POLY"],{from: account_polymath}); - let tags = await I_MRProxied.getTagByModuleType.call(3); - assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ''),"Non-Refundable"); - }); - - it("Should fail in removing the tag from the list", async() => { - let errorThrown = false; - try { - await I_MRProxied.removeTagByModuleType(3,["Capped", "ETH"], {from: account_investor1}); - } catch(error) { - console.log(` tx revert -> msg.sender should be account_polymath`.grey); - errorThrown = true; - ensureException(error); - } - assert.ok(errorThrown, message); - }); - - it("Should remove the tag from the list", async() => { - await I_MRProxied.removeTagByModuleType(3,["Capped", "ETH"], {from:account_polymath}); - let tags = await I_MRProxied.getTagByModuleType.call(3); - assert.equal(web3.utils.toAscii(tags[1]).replace(/\u0000/g, ''),"POLY"); - }); - }); - - describe("Test case for the getAvailableModulesOfType()", async() => { + describe("Test case for the getModulesByTypeAndToken()", async() => { it("Should get the list of available modules when the customModulesAllowed", async() => { - let _list = await I_MRProxied.getAvailableModulesOfType.call(3, I_SecurityToken.address); + let _list = await I_MRProxied.getModulesByTypeAndToken.call(3, I_SecurityToken.address); assert.equal(_list[0], I_CappedSTOFactory2.address); }) it("Should get the list of available modules when the customModulesAllowed is not allowed", async() => { await I_FeatureRegistry.setFeatureStatus("customModulesAllowed", false, { from: account_polymath }); - let _list = await I_MRProxied.getAvailableModulesOfType.call(3, I_SecurityToken.address); + let _list = await I_MRProxied.getModulesByTypeAndToken.call(3, I_SecurityToken.address); assert.equal(_list.length, 0); }) }) + describe("Test cases for getters", async() => { + + it("Check getter - ", async() => { + console.log("getModulesByType:") + for (let i = 0; i < 5; i++) { + let _list = await I_MRProxied.getModulesByType.call(i); + console.log("Type: " + i + ":" + _list); + } + console.log("getModulesByTypeAndToken:") + for (let i = 0; i < 5; i++) { + let _list = await I_MRProxied.getModulesByTypeAndToken.call(i, I_SecurityToken.address); + console.log("Type: " + i + ":" + _list); + } + console.log("getTagsByType:") + for (let i = 0; i < 5; i++) { + let _list = await I_MRProxied.getTagsByType.call(i); + console.log("Type: " + i + ":" + _list[1]); + console.log("Type: " + i + ":" + _list[0].map(x => web3.utils.toAscii(x))); + } + console.log("getTagsByTypeAndToken:") + for (let i = 0; i < 5; i++) { + let _list = await I_MRProxied.getTagsByTypeAndToken.call(i, I_SecurityToken.address); + console.log("Type: " + i + ":" + _list[1]); + console.log("Type: " + i + ":" + _list[0].map(x => web3.utils.toAscii(x))); + } + }) + + }); + describe("Test cases for removeModule()", async() => { it("Should fail if msg.sender not curator or owner", async() => { @@ -579,59 +569,59 @@ contract('ModuleRegistry', accounts => { } assert.ok(errorThrown, message); }); - + it("Should successfully remove module and delete data if msg.sender is curator", async() => { let snap = await takeSnapshot(); - - let sto1 = (await I_MRProxied.getModuleListOfType.call(3))[0]; - let sto2 = (await I_MRProxied.getModuleListOfType.call(3))[1]; - + + let sto1 = (await I_MRProxied.getModulesByType.call(3))[0]; + let sto2 = (await I_MRProxied.getModulesByType.call(3))[1]; + assert.equal(sto1,I_CappedSTOFactory1.address); assert.equal(sto2,I_CappedSTOFactory2.address); - assert.equal((await I_MRProxied.getModuleListOfType.call(3)).length, 3); - + assert.equal((await I_MRProxied.getModulesByType.call(3)).length, 3); + let tx = await I_MRProxied.removeModule(sto1, { from: account_polymath }); - + assert.equal(tx.logs[0].args._moduleFactory, sto1, "Event is not properly emitted for _moduleFactory"); assert.equal(tx.logs[0].args._decisionMaker, account_polymath, "Event is not properly emitted for _decisionMaker"); - - let sto2_end = (await I_MRProxied.getModuleListOfType.call(3))[1]; - + + let sto2_end = (await I_MRProxied.getModulesByType.call(3))[1]; + // re-ordering assert.equal(sto2_end,sto2); // delete related data assert.equal(await I_MRProxied.getUintValues.call(web3.utils.soliditySha3("registry", sto1)), 0); - assert.equal(await I_MRProxied.getReputationOfFactory.call(sto1), 0); - assert.equal((await I_MRProxied.getModuleListOfType.call(3)).length, 2); + assert.equal(await I_MRProxied.getReputationByFactory.call(sto1), 0); + assert.equal((await I_MRProxied.getModulesByType.call(3)).length, 2); assert.equal(await I_MRProxied.getBoolValues.call(web3.utils.soliditySha3("verified", sto1)), false); - + await revertToSnapshot(snap); }); - + it("Should successfully remove module and delete data if msg.sender is owner", async() => { - let sto1 = (await I_MRProxied.getModuleListOfType.call(3))[0]; - let sto2 = (await I_MRProxied.getModuleListOfType.call(3))[1]; - + let sto1 = (await I_MRProxied.getModulesByType.call(3))[0]; + let sto2 = (await I_MRProxied.getModulesByType.call(3))[1]; + assert.equal(sto1,I_CappedSTOFactory1.address); assert.equal(sto2,I_CappedSTOFactory2.address); - assert.equal((await I_MRProxied.getModuleListOfType.call(3)).length, 3); - + assert.equal((await I_MRProxied.getModulesByType.call(3)).length, 3); + let tx = await I_MRProxied.removeModule(sto2, { from: token_owner }); - + assert.equal(tx.logs[0].args._moduleFactory, sto2, "Event is not properly emitted for _moduleFactory"); assert.equal(tx.logs[0].args._decisionMaker, token_owner, "Event is not properly emitted for _decisionMaker"); - - let sto1_end = (await I_MRProxied.getModuleListOfType.call(3))[0]; - + + let sto1_end = (await I_MRProxied.getModulesByType.call(3))[0]; + // re-ordering assert.equal(sto1_end,sto1); // delete related data assert.equal(await I_MRProxied.getUintValues.call(web3.utils.soliditySha3("registry", sto2)), 0); - assert.equal(await I_MRProxied.getReputationOfFactory.call(sto2), 0); - assert.equal((await I_MRProxied.getModuleListOfType.call(3)).length, 2); + assert.equal(await I_MRProxied.getReputationByFactory.call(sto2), 0); + assert.equal((await I_MRProxied.getModulesByType.call(3)).length, 2); assert.equal(await I_MRProxied.getBoolValues.call(web3.utils.soliditySha3("verified", sto2)), false); }); - + it("Should fail if module already removed", async() => { let errorThrown = false; try { @@ -643,7 +633,7 @@ contract('ModuleRegistry', accounts => { } assert.ok(errorThrown, message); }); - + }); describe("Test cases for IRegistry functionality", async() => { @@ -703,4 +693,4 @@ contract('ModuleRegistry', accounts => { }); }); -}); \ No newline at end of file +}); diff --git a/test/t_security_token_registry_proxy.js b/test/t_security_token_registry_proxy.js index dc258f670..cb313cb9d 100644 --- a/test/t_security_token_registry_proxy.js +++ b/test/t_security_token_registry_proxy.js @@ -83,7 +83,7 @@ contract ("SecurityTokenRegistryProxy", accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index 82583d594..f79731b8c 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -85,7 +85,7 @@ contract ("ModuleRegistryProxy", accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -196,7 +196,7 @@ contract ("ModuleRegistryProxy", accounts => { it("Should add the tags successfuly", async() => { await I_MRProxied.addTagByModuleType(3,["Non-Refundable","Capped","ETH","POLY"],{from: account_polymath}); - let tags = await I_MRProxied.getTagByModuleType.call(3); + let tags = await I_MRProxied.getTagsByType.call(3); assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ''),"Non-Refundable"); }) }) @@ -288,7 +288,7 @@ contract ("ModuleRegistryProxy", accounts => { describe("Execute functionality of the implementation contract on the earlier storage", async() => { it("Should get the previous data", async() => { - let _data = await I_MRProxied.getTagByModuleType.call(3); + let _data = await I_MRProxied.getTagsByType.call(3); assert.equal(web3.utils.toUtf8(_data[0]), "Non-Refundable"); assert.equal(web3.utils.toUtf8(_data[1]), "Capped"); assert.equal(web3.utils.toUtf8(_data[2]), "ETH"); @@ -296,7 +296,7 @@ contract ("ModuleRegistryProxy", accounts => { it("Should alter the old storage", async() => { await I_MRProxied.addMoreTags(3, ["DAI", "USDTiered"], {from: account_polymath}); - let _data = await I_MRProxied.getTagByModuleType.call(3); + let _data = await I_MRProxied.getTagsByType.call(3); assert.equal(_data.length, 6, "Should give the updated length"); }); }) From 626083a563c3f83b616f18f49d36a91ea27af7ac Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 22:35:28 +0100 Subject: [PATCH 3/7] More fixes for tests --- contracts/ModuleRegistry.sol | 5 +++- contracts/mocks/MockModuleRegistry.sol | 19 ++++++++++++++ contracts/mocks/ModuleRegistryMock.sol | 18 ------------- test/b_capped_sto.js | 4 +-- test/i_Issuance.js | 6 ++--- test/o_security_token.js | 4 +-- test/u_module_registry_proxy.js | 36 ++++++++++---------------- 7 files changed, 44 insertions(+), 48 deletions(-) create mode 100644 contracts/mocks/MockModuleRegistry.sol delete mode 100644 contracts/mocks/ModuleRegistryMock.sol diff --git a/contracts/ModuleRegistry.sol b/contracts/ModuleRegistry.sol index b745e9395..f0249e2fd 100644 --- a/contracts/ModuleRegistry.sol +++ b/contracts/ModuleRegistry.sol @@ -133,7 +133,7 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { } } - function _isCompatibleModule(address _moduleFactory, address _securityToken) internal returns(bool) { + function _isCompatibleModule(address _moduleFactory, address _securityToken) internal view returns(bool) { uint8[] memory _latestVersion = ISecurityToken(_securityToken).getVersion(); uint8[] memory _lowerBound = IModuleFactory(_moduleFactory).getLowerSTVersionBounds(); uint8[] memory _upperBound = IModuleFactory(_moduleFactory).getUpperSTVersionBounds(); @@ -148,6 +148,9 @@ contract ModuleRegistry is IModuleRegistry, EternalStorage { */ function registerModule(address _moduleFactory) external whenNotPausedOrOwner { if (IFeatureRegistry(getAddress(Encoder.getKey('featureRegistry'))).getFeatureStatus("customModulesAllowed")) { + require(msg.sender == IOwnable(_moduleFactory).owner() || msg.sender == getAddress(Encoder.getKey('owner')), + "msg.sender must be the Module Factory owner or registry curator"); + } else { require(msg.sender == getAddress(Encoder.getKey("owner")), "Only owner allowed to register modules"); } require(getUint(Encoder.getKey('registry', _moduleFactory)) == 0, "Module factory should not be pre-registered"); diff --git a/contracts/mocks/MockModuleRegistry.sol b/contracts/mocks/MockModuleRegistry.sol new file mode 100644 index 000000000..23af59d58 --- /dev/null +++ b/contracts/mocks/MockModuleRegistry.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.4.24; + +import "../ModuleRegistry.sol"; + +/** + * @title Registry contract for issuers to register their security tokens + */ +contract MockModuleRegistry is ModuleRegistry { + + /// @notice It is dummy functionality + /// Alert! Alert! Do not use it for the mainnet release + function addMoreReputation(address _moduleFactory, address[] _tokens) public onlyOwner { + for (uint8 i = 0; i < _tokens.length; i++) { + pushArray(Encoder.getKey('reputation', _moduleFactory), _tokens[i]); + } + } + + +} diff --git a/contracts/mocks/ModuleRegistryMock.sol b/contracts/mocks/ModuleRegistryMock.sol deleted file mode 100644 index 18551dd20..000000000 --- a/contracts/mocks/ModuleRegistryMock.sol +++ /dev/null @@ -1,18 +0,0 @@ -pragma solidity ^0.4.24; - -import "../ModuleRegistry.sol"; - -/** - * @title Registry contract for issuers to register their security tokens - */ -contract ModuleRegistryMock is ModuleRegistry { - - /// @notice It is dummy functionality - /// Alert! Alert! Do not use it for the mainnet release - function addMoreTags(uint8 _moduleType, bytes32[] _tag) public onlyOwner { - for (uint8 i = 0; i < _tag.length; i++) { - pushArray(Encoder.getKey('availableTags', uint256(_moduleType)), _tag[i]); - } - } - -} \ No newline at end of file diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index 36f5bd41e..553544d48 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -139,7 +139,7 @@ contract('CappedSTO', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -188,7 +188,7 @@ contract('CappedSTO', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: token_owner }); + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); // Step 8: Deploy the STFactory contract diff --git a/test/i_Issuance.js b/test/i_Issuance.js index d2691674e..63884d2d3 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -120,14 +120,14 @@ contract('Issuance', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); let bytesMRProxy = encodeProxyCall(MRProxyParameters, [I_PolymathRegistry.address, account_polymath]); await I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesMRProxy, {from: account_polymath}); I_MRProxied = await ModuleRegistry.at(I_ModuleRegistryProxy.address); - + // STEP 4: Deploy the GeneralTransferManagerFactory I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, 0, 0, 0, {from:account_polymath}); @@ -169,7 +169,7 @@ contract('Issuance', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: token_owner }); + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); // Step 8: Deploy the STFactory contract diff --git a/test/o_security_token.js b/test/o_security_token.js index 8e4223f7d..a09dae907 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -139,7 +139,7 @@ contract('SecurityToken', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -188,7 +188,7 @@ contract('SecurityToken', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: token_owner }); + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); // Step 6: Deploy the STFactory contract diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index f79731b8c..b6fcc5db5 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -5,7 +5,7 @@ const SecurityTokenRegistry = artifacts.require("./SecurityTokenRegistry.sol"); const SecurityTokenRegistryProxy = artifacts.require("./SecurityTokenRegistryProxy.sol"); const GeneralTransferManagerFactory = artifacts.require("./GeneralTransferManagerFactory.sol"); const GeneralPermissionManagerFactory = artifacts.require('./GeneralPermissionManagerFactory.sol'); -const ModuleRegistryMock = artifacts.require("./ModuleRegistryMock.sol"); +const MockModuleRegistry = artifacts.require("./MockModuleRegistry.sol"); const OwnedUpgradeabilityProxy = artifacts.require('./OwnedUpgradeabilityProxy.sol'); const PolymathRegistry = artifacts.require('./PolymathRegistry.sol') const ModuleRegistry = artifacts.require('./ModuleRegistry.sol') @@ -26,7 +26,7 @@ contract ("ModuleRegistryProxy", accounts => { let I_SecurityTokenRegistryProxy; let I_GeneralTransferManagerFactory; let I_GeneralPermissionManagerfactory; - let I_ModuleRegistryMock; + let I_MockModuleRegistry; let I_STFactory; let I_PolymathRegistry; let I_ModuleRegistryProxy; @@ -160,7 +160,6 @@ contract ("ModuleRegistryProxy", accounts => { // Step 3: Deploy the STFactory contract - I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); assert.notEqual( @@ -194,20 +193,15 @@ contract ("ModuleRegistryProxy", accounts => { }); - it("Should add the tags successfuly", async() => { - await I_MRProxied.addTagByModuleType(3,["Non-Refundable","Capped","ETH","POLY"],{from: account_polymath}); - let tags = await I_MRProxied.getTagsByType.call(3); - assert.equal(web3.utils.toAscii(tags[0]).replace(/\u0000/g, ''),"Non-Refundable"); - }) }) describe("Upgrade the imlplementation address", async() => { it("Should upgrade the version and implementation address -- fail bad owner", async() => { let errorThrown = false; - I_ModuleRegistryMock = await ModuleRegistryMock.new({from: account_polymath}); + I_MockModuleRegistry = await MockModuleRegistry.new({from: account_polymath}); try { - await I_ModuleRegistryProxy.upgradeTo("1.1.0", I_ModuleRegistryMock.address, {from: account_temp}); + await I_ModuleRegistryProxy.upgradeTo("1.1.0", I_MockModuleRegistry.address, {from: account_temp}); } catch(error) { console.log(` tx -> revert bad owner of the proxy contract`); errorThrown = true; @@ -255,7 +249,7 @@ contract ("ModuleRegistryProxy", accounts => { it("Should upgrade the version and implementation address -- same version as previous is not allowed", async() => { let errorThrown = false; try { - await I_ModuleRegistryProxy.upgradeTo("1.0.0", I_ModuleRegistryMock.address, {from: account_polymath}); + await I_ModuleRegistryProxy.upgradeTo("1.0.0", I_MockModuleRegistry.address, {from: account_polymath}); } catch(error) { console.log(` tx -> revert same version as previous is not allowed`); errorThrown = true; @@ -267,7 +261,7 @@ contract ("ModuleRegistryProxy", accounts => { it("Should upgrade the version and implementation address -- empty version string is not allowed", async() => { let errorThrown = false; try { - await I_ModuleRegistryProxy.upgradeTo("", I_ModuleRegistryMock.address, {from: account_polymath}); + await I_ModuleRegistryProxy.upgradeTo("", I_MockModuleRegistry.address, {from: account_polymath}); } catch(error) { console.log(` tx -> revert empty version string is not allowed`); errorThrown = true; @@ -277,27 +271,25 @@ contract ("ModuleRegistryProxy", accounts => { }); it("Should upgrade the version and the implementation address successfully", async() => { - await I_ModuleRegistryProxy.upgradeTo("1.1.0", I_ModuleRegistryMock.address, {from: account_polymath}); + await I_ModuleRegistryProxy.upgradeTo("1.1.0", I_MockModuleRegistry.address, {from: account_polymath}); let c = OwnedUpgradeabilityProxy.at(I_ModuleRegistryProxy.address); assert.equal((web3.utils.toAscii(await readStorage(c.address, 11)).replace(/\u0000/g, '')).replace(/\n/, ''), "1.1.0", "Version mis-match"); - assert.equal(await readStorage(c.address, 12), I_ModuleRegistryMock.address, "Implemnted address is not matched"); - I_MRProxied = await ModuleRegistryMock.at(I_ModuleRegistryProxy.address); + assert.equal(await readStorage(c.address, 12), I_MockModuleRegistry.address, "Implemnted address is not matched"); + I_MRProxied = await MockModuleRegistry.at(I_ModuleRegistryProxy.address); }); }); describe("Execute functionality of the implementation contract on the earlier storage", async() => { it("Should get the previous data", async() => { - let _data = await I_MRProxied.getTagsByType.call(3); - assert.equal(web3.utils.toUtf8(_data[0]), "Non-Refundable"); - assert.equal(web3.utils.toUtf8(_data[1]), "Capped"); - assert.equal(web3.utils.toUtf8(_data[2]), "ETH"); + let _data = await I_MRProxied.getReputationByFactory.call(I_GeneralTransferManagerFactory.address); + assert.equal(_data.length, 0, "Should give the original length"); }); it("Should alter the old storage", async() => { - await I_MRProxied.addMoreTags(3, ["DAI", "USDTiered"], {from: account_polymath}); - let _data = await I_MRProxied.getTagsByType.call(3); - assert.equal(_data.length, 6, "Should give the updated length"); + await I_MRProxied.addMoreReputation(I_GeneralTransferManagerFactory.address, [account_polymath, account_temp], {from: account_polymath}); + let _data = await I_MRProxied.getReputationByFactory.call(I_GeneralTransferManagerFactory.address); + assert.equal(_data.length, 2, "Should give the updated length"); }); }) From c993c5f5c505fc38fa874679523022d2d57ccf21 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 22:50:08 +0100 Subject: [PATCH 4/7] Fix every test case (sigh) --- test/b_capped_sto.js | 31 +++++++------- test/c_checkpoints.js | 22 +++++----- test/d_count_transfer_manager.js | 43 ++++++++++--------- test/e_erc20_dividends.js | 38 ++++++++--------- test/f_ether_dividends.js | 48 +++++++++++----------- test/g_general_permission_manager.js | 38 ++++++++--------- test/h_general_transfer_manager.js | 40 +++++++++--------- test/i_Issuance.js | 28 ++++++------- test/j_manual_approval_transfer_manager.js | 46 ++++++++++----------- test/l_percentage_transfer_manager.js | 40 +++++++++--------- test/m_presale_sto.js | 30 +++++++------- test/n_security_token_registry.js | 24 +++++------ test/o_security_token.js | 24 +++++------ test/p_usd_tiered_sto.js | 31 +++++++------- test/q_usd_tiered_sto_sim.js | 33 +++++++-------- test/r_concurrent_STO.js | 43 +++++++++---------- test/s_v130_to_v140_upgrade.js | 26 ++++++------ test/t_security_token_registry_proxy.js | 8 ++-- test/u_module_registry_proxy.js | 9 ++-- 19 files changed, 303 insertions(+), 299 deletions(-) diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index 553544d48..11a797933 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -177,20 +177,6 @@ contract('CappedSTO', accounts => { "CappedSTOFactory contract was not deployed" ); - // STEP 7: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -224,6 +210,23 @@ contract('CappedSTO', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 7: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + console.log(await I_MRProxied.owner()); + console.log(account_polymath); + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); + + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/c_checkpoints.js b/test/c_checkpoints.js index 0f317765e..d40996a66 100644 --- a/test/c_checkpoints.js +++ b/test/c_checkpoints.js @@ -105,7 +105,7 @@ contract('Checkpoints', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -133,16 +133,6 @@ contract('Checkpoints', accounts => { "GeneralDelegateManagerFactory contract was not deployed" ); - // STEP 6: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - // Step 7: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -176,6 +166,16 @@ contract('Checkpoints', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 6: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/d_count_transfer_manager.js b/test/d_count_transfer_manager.js index 309e4bdaa..4b65e249a 100644 --- a/test/d_count_transfer_manager.js +++ b/test/d_count_transfer_manager.js @@ -117,9 +117,9 @@ contract('CountTransferManager', accounts => { "0x0000000000000000000000000000000000000000", "FeatureRegistry contract was not deployed", ); - + // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -164,24 +164,6 @@ contract('CountTransferManager', accounts => { "CountTransferManagerFactory contract was not deployed" ); - // STEP 8: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the CountTransferManagerFactory - await I_MRProxied.registerModule(I_CountTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the Paid CountTransferManagerFactory - await I_MRProxied.registerModule(P_CountTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_CountTransferManagerFactory.address, true, { from: account_polymath }); - // Step 9: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address); @@ -207,8 +189,8 @@ contract('CountTransferManager', accounts => { I_SecurityTokenRegistryProxy = await SecurityTokenRegistryProxy.new({from: account_polymath}); let bytesProxy = encodeProxyCall(STRProxyParameters, [I_PolymathRegistry.address, I_STFactory.address, initRegFee, initRegFee, I_PolyToken.address, account_polymath]); await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, {from: account_polymath}); - I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); - + I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); + // Step 12: update the registries addresses from the PolymathRegistry contract await I_PolymathRegistry.changeAddress("PolyToken", I_PolyToken.address, {from: account_polymath}) await I_PolymathRegistry.changeAddress("ModuleRegistry", I_ModuleRegistryProxy.address, {from: account_polymath}); @@ -216,6 +198,23 @@ contract('CountTransferManager', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 8: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the CountTransferManagerFactory + await I_MRProxied.registerModule(I_CountTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the Paid CountTransferManagerFactory + await I_MRProxied.registerModule(P_CountTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_CountTransferManagerFactory.address, true, { from: account_polymath }); // Printing all the contract addresses console.log(` diff --git a/test/e_erc20_dividends.js b/test/e_erc20_dividends.js index 395afbec2..82125d688 100644 --- a/test/e_erc20_dividends.js +++ b/test/e_erc20_dividends.js @@ -113,7 +113,7 @@ contract('ERC20DividendCheckpoint', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -157,24 +157,6 @@ contract('ERC20DividendCheckpoint', accounts => { "ERC20DividendCheckpointFactory contract was not deployed" ); - // STEP 8: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the ERC20DividendCheckpointFactory - await I_MRProxied.registerModule(I_ERC20DividendCheckpointFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_ERC20DividendCheckpointFactory.address, true, { from: account_polymath }); - - // (C) : Register the Paid ERC20DividendCheckpointFactory - await I_MRProxied.registerModule(P_ERC20DividendCheckpointFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_ERC20DividendCheckpointFactory.address, true, { from: account_polymath }); - // Step 9: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address); @@ -208,6 +190,24 @@ contract('ERC20DividendCheckpoint', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 8: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the ERC20DividendCheckpointFactory + await I_MRProxied.registerModule(I_ERC20DividendCheckpointFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_ERC20DividendCheckpointFactory.address, true, { from: account_polymath }); + + // (C) : Register the Paid ERC20DividendCheckpointFactory + await I_MRProxied.registerModule(P_ERC20DividendCheckpointFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_ERC20DividendCheckpointFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/f_ether_dividends.js b/test/f_ether_dividends.js index 00a8852a2..0e7468075 100644 --- a/test/f_ether_dividends.js +++ b/test/f_ether_dividends.js @@ -113,7 +113,7 @@ contract('EtherDividendCheckpoint', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -157,24 +157,6 @@ contract('EtherDividendCheckpoint', accounts => { "EtherDividendCheckpointFactory contract was not deployed" ); - // STEP 5: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the EtherDividendCheckpointFactory - await I_MRProxied.registerModule(I_EtherDividendCheckpointFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_EtherDividendCheckpointFactory.address, true, { from: account_polymath }); - - // (C) : Register the Paid EtherDividendCheckpointFactory - await I_MRProxied.registerModule(P_EtherDividendCheckpointFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_EtherDividendCheckpointFactory.address, true, { from: account_polymath }); - // Step 6: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -184,23 +166,23 @@ contract('EtherDividendCheckpoint', accounts => { "0x0000000000000000000000000000000000000000", "STFactory contract was not deployed", ); - + // Step 7: Deploy the SecurityTokenRegistry contract - + I_SecurityTokenRegistry = await SecurityTokenRegistry.new({from: account_polymath }); - + assert.notEqual( I_SecurityTokenRegistry.address.valueOf(), "0x0000000000000000000000000000000000000000", "SecurityTokenRegistry contract was not deployed", ); - + // Step 8: Deploy the proxy and attach the implementation contract to it. I_SecurityTokenRegistryProxy = await SecurityTokenRegistryProxy.new({from: account_polymath}); let bytesProxy = encodeProxyCall(STRProxyParameters, [I_PolymathRegistry.address, I_STFactory.address, initRegFee, initRegFee, I_PolyToken.address, account_polymath]); await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, {from: account_polymath}); I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); - + // Step 9: update the registries addresses from the PolymathRegistry contract await I_PolymathRegistry.changeAddress("PolyToken", I_PolyToken.address, {from: account_polymath}) await I_PolymathRegistry.changeAddress("ModuleRegistry", I_ModuleRegistryProxy.address, {from: account_polymath}); @@ -208,6 +190,24 @@ contract('EtherDividendCheckpoint', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the EtherDividendCheckpointFactory + await I_MRProxied.registerModule(I_EtherDividendCheckpointFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_EtherDividendCheckpointFactory.address, true, { from: account_polymath }); + + // (C) : Register the Paid EtherDividendCheckpointFactory + await I_MRProxied.registerModule(P_EtherDividendCheckpointFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_EtherDividendCheckpointFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/g_general_permission_manager.js b/test/g_general_permission_manager.js index 118dca77f..6e483d203 100644 --- a/test/g_general_permission_manager.js +++ b/test/g_general_permission_manager.js @@ -123,7 +123,7 @@ contract('GeneralPermissionManager', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -171,24 +171,6 @@ contract('GeneralPermissionManager', accounts => { "DummySTOFactory contract was not deployed" ); - // STEP 8: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the Paid GeneralDelegateManagerFactory - await I_MRProxied.registerModule(P_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); - // Step 8: Deploy the STFactory contract @@ -223,6 +205,24 @@ contract('GeneralPermissionManager', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 8: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the Paid GeneralDelegateManagerFactory + await I_MRProxied.registerModule(P_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/h_general_transfer_manager.js b/test/h_general_transfer_manager.js index cda17f0cb..190ab54ad 100644 --- a/test/h_general_transfer_manager.js +++ b/test/h_general_transfer_manager.js @@ -124,7 +124,7 @@ contract('GeneralTransferManager', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -163,20 +163,6 @@ contract('GeneralTransferManager', accounts => { "DummySTOFactory contract was not deployed" ); - // STEP 5: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -186,23 +172,23 @@ contract('GeneralTransferManager', accounts => { "0x0000000000000000000000000000000000000000", "STFactory contract was not deployed", ); - + // Step 9: Deploy the SecurityTokenRegistry contract - + I_SecurityTokenRegistry = await SecurityTokenRegistry.new({from: account_polymath }); - + assert.notEqual( I_SecurityTokenRegistry.address.valueOf(), "0x0000000000000000000000000000000000000000", "SecurityTokenRegistry contract was not deployed", ); - + // Step 10: Deploy the proxy and attach the implementation contract to it. I_SecurityTokenRegistryProxy = await SecurityTokenRegistryProxy.new({from: account_polymath}); let bytesProxy = encodeProxyCall(STRProxyParameters, [I_PolymathRegistry.address, I_STFactory.address, initRegFee, initRegFee, I_PolyToken.address, account_polymath]); await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, {from: account_polymath}); I_STRProxied = await SecurityTokenRegistry.at(I_SecurityTokenRegistryProxy.address); - + // Step 11: update the registries addresses from the PolymathRegistry contract await I_PolymathRegistry.changeAddress("PolyToken", I_PolyToken.address, {from: account_polymath}) await I_PolymathRegistry.changeAddress("ModuleRegistry", I_ModuleRegistryProxy.address, {from: account_polymath}); @@ -210,6 +196,20 @@ contract('GeneralTransferManager', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/i_Issuance.js b/test/i_Issuance.js index 63884d2d3..4cfe448d3 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -158,20 +158,6 @@ contract('Issuance', accounts => { "CappedSTOFactory contract was not deployed" ); - // STEP 7: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -205,6 +191,20 @@ contract('Issuance', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 7: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/j_manual_approval_transfer_manager.js b/test/j_manual_approval_transfer_manager.js index b9517b8c9..78953fa24 100644 --- a/test/j_manual_approval_transfer_manager.js +++ b/test/j_manual_approval_transfer_manager.js @@ -117,7 +117,7 @@ contract('ManualApprovalTransferManager', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -169,28 +169,6 @@ contract('ManualApprovalTransferManager', accounts => { "CountTransferManagerFactory contract was not deployed" ); - // STEP 9: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the ManualApprovalTransferManagerFactory - await I_MRProxied.registerModule(I_ManualApprovalTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_ManualApprovalTransferManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the ManualApprovalTransferManagerFactory - await I_MRProxied.registerModule(P_ManualApprovalTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_ManualApprovalTransferManagerFactory.address, true, { from: account_polymath }); - - // (D) : Register the CountTransferManagerFactory - await I_MRProxied.registerModule(I_CountTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, true, { from: account_polymath }); - // Step 10: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -224,6 +202,28 @@ contract('ManualApprovalTransferManager', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 9: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the ManualApprovalTransferManagerFactory + await I_MRProxied.registerModule(I_ManualApprovalTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_ManualApprovalTransferManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the ManualApprovalTransferManagerFactory + await I_MRProxied.registerModule(P_ManualApprovalTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_ManualApprovalTransferManagerFactory.address, true, { from: account_polymath }); + + // (D) : Register the CountTransferManagerFactory + await I_MRProxied.registerModule(I_CountTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_CountTransferManagerFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/l_percentage_transfer_manager.js b/test/l_percentage_transfer_manager.js index 23ec5b8d4..92504c4c2 100644 --- a/test/l_percentage_transfer_manager.js +++ b/test/l_percentage_transfer_manager.js @@ -122,14 +122,14 @@ contract('PercentageTransferManager', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); let bytesMRProxy = encodeProxyCall(MRProxyParameters, [I_PolymathRegistry.address, account_polymath]); await I_ModuleRegistryProxy.upgradeToAndCall("1.0.0", I_ModuleRegistry.address, bytesMRProxy, {from: account_polymath}); I_MRProxied = await ModuleRegistry.at(I_ModuleRegistryProxy.address); - + // STEP 4(a): Deploy the GeneralTransferManagerFactory I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, 0, 0, 0, {from:account_polymath}); @@ -167,24 +167,6 @@ contract('PercentageTransferManager', accounts => { ); - // STEP 5: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the PercentageTransferManagerFactory - await I_MRProxied.registerModule(I_PercentageTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_PercentageTransferManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the Paid PercentageTransferManagerFactory - await I_MRProxied.registerModule(P_PercentageTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(P_PercentageTransferManagerFactory.address, true, { from: account_polymath }); - // Step 6: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -218,6 +200,24 @@ contract('PercentageTransferManager', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the PercentageTransferManagerFactory + await I_MRProxied.registerModule(I_PercentageTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_PercentageTransferManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the Paid PercentageTransferManagerFactory + await I_MRProxied.registerModule(P_PercentageTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(P_PercentageTransferManagerFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index c14156f2d..ff3d8ffdf 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -112,7 +112,7 @@ contract('PreSaleSTO', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -150,20 +150,6 @@ contract('PreSaleSTO', accounts => { "PreSaleSTOFactory contract was not deployed" ); - // STEP 5: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: token_owner }); - await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -197,6 +183,20 @@ contract('PreSaleSTO', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: token_owner }); + await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index a53378c8b..196186646 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -131,7 +131,7 @@ contract('SecurityTokenRegistry', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -160,16 +160,6 @@ contract('SecurityTokenRegistry', accounts => { ); - // STEP 4: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - // Step 6: Deploy the STversionProxy contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -203,7 +193,7 @@ contract('SecurityTokenRegistry', accounts => { "SecurityTokenRegistry contract was not deployed", ); - // Step 9 (a): Deploy the proxy + // Step 9 (a): Deploy the proxy I_SecurityTokenRegistryProxy = await SecurityTokenRegistryProxy.new({from: account_polymath}); let bytesProxy = encodeProxyCall(STRProxyParameters, [I_PolymathRegistry.address, I_STFactory.address, initRegFee, initRegFee, I_PolyToken.address, account_polymath]); await I_SecurityTokenRegistryProxy.upgradeToAndCall("1.0.0", I_SecurityTokenRegistry.address, bytesProxy, {from: account_polymath}); @@ -230,6 +220,16 @@ contract('SecurityTokenRegistry', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 4: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + console.log(` --------------------- Polymath Network Smart Contracts: --------------------- PolymathRegistry: ${PolymathRegistry.address} diff --git a/test/o_security_token.js b/test/o_security_token.js index a09dae907..255948627 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -179,18 +179,6 @@ contract('SecurityToken', accounts => { // STEP 5: Register the Modules with the ModuleRegistry contract - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); - // Step 6: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); @@ -223,6 +211,18 @@ contract('SecurityToken', accounts => { await I_PolymathRegistry.changeAddress("FeatureRegistry", I_FeatureRegistry.address, {from: account_polymath}); await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index 0f0fbd6e7..4be82a435 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -225,7 +225,7 @@ contract('USDTieredSTO', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from: POLYMATH}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from: POLYMATH}); @@ -266,20 +266,6 @@ contract('USDTieredSTO', accounts => { "USDTieredSTOFactory contract was not deployed" ); - // STEP 7: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); - await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : POLYMATH }); @@ -313,6 +299,21 @@ contract('USDTieredSTO', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: POLYMATH}); await I_MRProxied.updateFromRegistry({from: POLYMATH}); + + // STEP 7: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); + await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); + // Step 12: Deploy & Register Mock Oracles I_USDOracle = await MockOracle.new(0, "ETH", "USD", USDETH, { from: POLYMATH }); // 500 dollars per POLY I_POLYOracle = await MockOracle.new(I_PolyToken.address, "POLY", "USD", USDPOLY, { from: POLYMATH }); // 25 cents per POLY diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index f8ce2c1ea..965479485 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -195,7 +195,7 @@ contract('USDTieredSTO Sim', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from: POLYMATH}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from: POLYMATH}); @@ -228,29 +228,16 @@ contract('USDTieredSTO Sim', accounts => { I_USDTieredSTOProxyFactory = await USDTieredSTOProxyFactory.new({ from: POLYMATH }); // STEP 6: Deploy the USDTieredSTOFactory - + I_USDTieredSTOFactory = await USDTieredSTOFactory.new(I_PolyToken.address, STOSetupCost, 0, 0, I_USDTieredSTOProxyFactory.address, { from: ISSUER }); - + assert.notEqual( I_USDTieredSTOFactory.address.valueOf(), "0x0000000000000000000000000000000000000000", "USDTieredSTOFactory contract was not deployed" ); - - - // STEP 7: Register the Modules with the ModuleRegistry contract - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); - - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); - await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); // Step 8: Deploy the STFactory contract @@ -285,6 +272,20 @@ contract('USDTieredSTO Sim', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: POLYMATH}); await I_MRProxied.updateFromRegistry({from: POLYMATH}); + // STEP 7: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); + + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); + await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); + // Step 12: Deploy & Register Mock Oracles I_USDOracle = await MockOracle.new(0, "ETH", "USD", USDETH, { from: POLYMATH }); // 500 dollars per POLY I_POLYOracle = await MockOracle.new(I_PolyToken.address, "POLY", "USD", USDPOLY, { from: POLYMATH }); // 25 cents per POLY diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index 91b7ab7d5..e4a39b9e3 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -78,7 +78,7 @@ contract('Concurrent STO', accounts => { const MRProxyParameters = ['address', 'address']; const DummySTOParameters = ['uint256', 'uint256', 'uint256', 'string']; const PresaleSTOParameters = ['uint256']; - + before(async() => { // Accounts setup account_polymath = accounts[0]; @@ -106,7 +106,7 @@ contract('Concurrent STO', accounts => { }); // STEP 3: Deploy the ModuleRegistry - + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); // Step 3 (b): Deploy the proxy and attach the implementation contract to it I_ModuleRegistryProxy = await ModuleRegistryProxy.new({from:account_polymath}); @@ -146,25 +146,6 @@ contract('Concurrent STO', accounts => { "CappedSTOFactory contract was not deployed" ); - // STEP 5: Register the Modules with the ModuleRegistry contract - - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); - - // (C) : Register the STO Factories - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_issuer }); - await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); - - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_issuer }); - await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); - - await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: account_issuer }); - await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); // Step 8: Deploy the STFactory contract @@ -199,6 +180,26 @@ contract('Concurrent STO', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STO Factories + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_issuer }); + await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); + + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_issuer }); + await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); + + await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: account_issuer }); + await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` --------------------- Polymath Network Smart Contracts: --------------------- diff --git a/test/s_v130_to_v140_upgrade.js b/test/s_v130_to_v140_upgrade.js index 6c1fa9102..4db50ca9f 100644 --- a/test/s_v130_to_v140_upgrade.js +++ b/test/s_v130_to_v140_upgrade.js @@ -164,19 +164,6 @@ contract('Upgrade from v1.3.0 to v1.4.0', accounts => { "CappedSTOFactory contract was not deployed" ); - // STEP 6: Register the Modules with the ModuleRegistry contract - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); - - // (B) : Register the GeneralDelegateManagerFactory - await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); - - // (C) : Register the CappedSTOFactory - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: POLYMATH }); - await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: POLYMATH }); - // Step 8: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : POLYMATH }); assert.notEqual( @@ -220,6 +207,19 @@ contract('Upgrade from v1.3.0 to v1.4.0', accounts => { await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_STRProxied.address, {from: POLYMATH}); await I_MRProxied.updateFromRegistry({from: POLYMATH}); + // STEP 6: Register the Modules with the ModuleRegistry contract + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: POLYMATH }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); + + // (C) : Register the CappedSTOFactory + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: POLYMATH }); + await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: POLYMATH }); + // Step 12: Mint tokens to ISSUERs await I_PolyToken.getTokens(REGFEE * 2, ISSUER1); await I_PolyToken.getTokens(REGFEE * 2, ISSUER2); diff --git a/test/t_security_token_registry_proxy.js b/test/t_security_token_registry_proxy.js index cb313cb9d..2dcafde5c 100644 --- a/test/t_security_token_registry_proxy.js +++ b/test/t_security_token_registry_proxy.js @@ -103,10 +103,6 @@ contract ("SecurityTokenRegistryProxy", accounts => { // Register the Modules with the ModuleRegistry contract - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - // Step 3: Deploy the STFactory contract @@ -135,6 +131,10 @@ contract ("SecurityTokenRegistryProxy", accounts => { await I_PolymathRegistry.changeAddress("FeatureRegistry", I_FeatureRegistry.address, {from: account_polymath}); await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index b6fcc5db5..133d9394c 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -110,6 +110,10 @@ contract ("ModuleRegistryProxy", accounts => { await I_PolymathRegistry.changeAddress("FeatureRegistry", I_FeatureRegistry.address, {from: account_polymath}); await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + // Printing all the contract addresses console.log(` @@ -154,11 +158,6 @@ contract ("ModuleRegistryProxy", accounts => { // Register the Modules with the ModuleRegistry contract - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - - // Step 3: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); From 5a01e07eccfd832148a1b8b02cee53d037c25cf6 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 23:04:07 +0100 Subject: [PATCH 5/7] More test fixes --- test/k_module_registry.js | 22 +++++----------------- test/m_presale_sto.js | 2 +- test/n_security_token_registry.js | 2 +- test/p_usd_tiered_sto.js | 2 +- test/q_usd_tiered_sto_sim.js | 2 +- test/r_concurrent_STO.js | 6 +++--- test/u_module_registry_proxy.js | 9 +++++---- 7 files changed, 17 insertions(+), 28 deletions(-) diff --git a/test/k_module_registry.js b/test/k_module_registry.js index 34007d27d..bc728259f 100644 --- a/test/k_module_registry.js +++ b/test/k_module_registry.js @@ -393,7 +393,7 @@ contract('ModuleRegistry', accounts => { assert.ok(errorThrown, message); }); - it("Should fail to add module because custom modules not allowed", async() => { + it("Should fail to register module because custom modules not allowed", async() => { I_CappedSTOFactory2 = await CappedSTOFactory.new(I_PolyToken.address, 0, 0, 0, { from: token_owner }); assert.notEqual( @@ -402,29 +402,17 @@ contract('ModuleRegistry', accounts => { "CappedSTOFactory contract was not deployed" ); - let tx = await I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner }); - - assert.equal( - tx.logs[0].args._moduleFactory, - I_CappedSTOFactory2.address, - "CappedSTOFactory is not registerd successfully" - ); - - assert.equal(tx.logs[0].args._owner, token_owner); - - startTime = latestTime() + duration.seconds(5000); - endTime = startTime + duration.days(30); - let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); let errorThrown = false; try { - tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner, gas: 60000000 }); + let tx = await I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner }); } catch(error) { errorThrown = true; console.log(` tx revert -> Module is un-verified`.grey); ensureException(error); } assert.ok(errorThrown, message); + }); it("Should switch customModulesAllowed to true", async() => { @@ -437,8 +425,8 @@ contract('ModuleRegistry', accounts => { startTime = latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = encodeModuleCall(STOParameters, [startTime, endTime, cap, rate, fundRaiseType, account_fundsReceiver]); - - let tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner, gas: 60000000 }); + let tx = await I_MRProxied.registerModule(I_CappedSTOFactory2.address, { from: token_owner }); + tx = await I_SecurityToken.addModule(I_CappedSTOFactory2.address, bytesSTO, 0, 0, { from: token_owner, gas: 60000000 }); assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index ff3d8ffdf..acc04642d 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -194,7 +194,7 @@ contract('PreSaleSTO', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: token_owner }); + await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); // Printing all the contract addresses diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index 196186646..1ce5a875d 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -181,7 +181,7 @@ contract('SecurityTokenRegistry', accounts => { ); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: token_owner }); + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); // Step 9: Deploy the SecurityTokenRegistry diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index 4be82a435..1acc0ef7d 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -311,7 +311,7 @@ contract('USDTieredSTO', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); + await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: POLYMATH }); await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); // Step 12: Deploy & Register Mock Oracles diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index 965479485..cd00ccb8d 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -283,7 +283,7 @@ contract('USDTieredSTO Sim', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: POLYMATH }); // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: ISSUER }); + await I_MRProxied.registerModule(I_USDTieredSTOFactory.address, { from: POLYMATH }); await I_MRProxied.verifyModule(I_USDTieredSTOFactory.address, true, { from: POLYMATH }); // Step 12: Deploy & Register Mock Oracles diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index e4a39b9e3..c86d53a43 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -191,13 +191,13 @@ contract('Concurrent STO', accounts => { await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); // (C) : Register the STO Factories - await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_issuer }); + await I_MRProxied.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_CappedSTOFactory.address, true, { from: account_polymath }); - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_issuer }); + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_DummySTOFactory.address, true, { from: account_polymath }); - await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: account_issuer }); + await I_MRProxied.registerModule(I_PreSaleSTOFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_PreSaleSTOFactory.address, true, { from: account_polymath }); // Printing all the contract addresses diff --git a/test/u_module_registry_proxy.js b/test/u_module_registry_proxy.js index 133d9394c..b6fcc5db5 100644 --- a/test/u_module_registry_proxy.js +++ b/test/u_module_registry_proxy.js @@ -110,10 +110,6 @@ contract ("ModuleRegistryProxy", accounts => { await I_PolymathRegistry.changeAddress("FeatureRegistry", I_FeatureRegistry.address, {from: account_polymath}); await I_PolymathRegistry.changeAddress("SecurityTokenRegistry", I_SecurityTokenRegistryProxy.address, {from: account_polymath}); await I_MRProxied.updateFromRegistry({from: account_polymath}); - // (A) : Register the GeneralTransferManagerFactory - await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); - // Printing all the contract addresses console.log(` @@ -158,6 +154,11 @@ contract ("ModuleRegistryProxy", accounts => { // Register the Modules with the ModuleRegistry contract + // (A) : Register the GeneralTransferManagerFactory + await I_MRProxied.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_MRProxied.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // Step 3: Deploy the STFactory contract I_STFactory = await STFactory.new(I_GeneralTransferManagerFactory.address, {from : account_polymath }); From 0658566d8302dd11c11a8045f41c34f480b756e6 Mon Sep 17 00:00:00 2001 From: Adam Dossa Date: Mon, 1 Oct 2018 23:14:57 +0100 Subject: [PATCH 6/7] Last fix --- test/n_security_token_registry.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index 1ce5a875d..e51bea0bd 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -180,9 +180,6 @@ contract('SecurityTokenRegistry', accounts => { "TestSTOFactory contract was not deployed" ); - // (C) : Register the STOFactory - await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); - // Step 9: Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new({from: account_polymath }); @@ -230,6 +227,9 @@ contract('SecurityTokenRegistry', accounts => { await I_MRProxied.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); await I_MRProxied.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + // (C) : Register the STOFactory + await I_MRProxied.registerModule(I_DummySTOFactory.address, { from: account_polymath }); + console.log(` --------------------- Polymath Network Smart Contracts: --------------------- PolymathRegistry: ${PolymathRegistry.address} From 259a4de2af919cd703bcfb67bf0c2aadc6cead82 Mon Sep 17 00:00:00 2001 From: satyam Date: Tue, 2 Oct 2018 12:11:19 +0530 Subject: [PATCH 7/7] small changelog fix --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1da8b2497..52e0d50da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ All notable changes to this project will be documented in this file. ## Added * Added `getTagsByType`, `getTagsByTypeAndToken`, `getModulesByType`, `getModulesByTypeAndToken` to MR -* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR * Added `getTokensByOwner` to STR * Added withholding tax to ether & erc20 dividends * Generalised MakerDAO oracle to allow different instances referencing different currencies @@ -29,7 +28,8 @@ All notable changes to this project will be documented in this file. ## Removed * Remove `swarmHash` from the `registerTicker(), addCustomTicker(), generateSecurityToken(), addCustomSecurityToken()` functions of TickerRegistry.sol and SecurityTokenRegistry.sol. #230 -* Remove `Log` prefix from all the event present in the ecosystem. +* Remove `Log` prefix from all the event present in the ecosystem. +* Removed `addTagByModuleType` & `removeTagsByModuleType` from MR. ======