diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..52031de51 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sol linguist-language=Solidity diff --git a/CHANGELOG.md b/CHANGELOG.md index fe73d68c9..e0c8e4a2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. ## [Unreleased](https://github.com/PolymathNetwork/polymath-core/compare/npm-publish-2...master) +[__0.4.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __09-04-18__ + +## Added +* Issuer can see the list of lock and unlocked modules by accessing the public mapping **modulesLocked**. + +## Changed +* Now `IModuleFactory` contract takes PolyToken address to intialize the contract. So each and every module factory takes polytoken address to intialize there constructor. +* No modules will be replacable now. Terminology got changed, In this release we make the module lockable. So owner of the modules can +make the module locable with a boolean value. `True` signifies the lock it means that module can't be unlocked or no one can change that module. `False` represent the module could be changed if issuer wants. + +*** + [__0.3.1__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __06-04-18__ ## Added diff --git a/README.md b/README.md index aa59b7b8f..aca885df5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/PolymathNetwork/polymath-core.svg?token=rqsL7PsbwLxrskjYAHpq&branch=master)](https://travis-ci.com/PolymathNetwork/polymath-core) +[![Build Status](https://travis-ci.org/PolymathNetwork/polymath-core.svg?branch=master)](https://travis-ci.org/PolymathNetwork/polymath-core) ![Polymath](Polymath.png) @@ -170,8 +170,8 @@ http://solidity.readthedocs.io/en/develop/style-guide.html # Links -[Polymath](https://polymath.network) -[Ethereum](https://www.ethereum.org/) -[Solidity](https://solidity.readthedocs.io/en/develop/) -[Truffle](http://truffleframework.com/) -[Testrpc](https://github.com/ethereumjs/testrpc) +- [Polymath Website](https://polymath.network) +- [Ethereum Project](https://www.ethereum.org/) +- [Solidity Docs](https://solidity.readthedocs.io/en/develop/) +- [Truffle Framework](http://truffleframework.com/) +- [Ganache CLI / TestRPC](https://github.com/trufflesuite/ganache-cli) diff --git a/contracts/TickerRegistry.sol b/contracts/TickerRegistry.sol index d445e5f79..217c80426 100644 --- a/contracts/TickerRegistry.sol +++ b/contracts/TickerRegistry.sol @@ -124,7 +124,7 @@ contract TickerRegistry is ITickerRegistry, Ownable, Util { } /** - * @dev To re-intialize the token symbol details if symbol validity expires + * @dev To re-initialize the token symbol details if symbol validity expires * @param _symbol token symbol */ function expiryCheck(string _symbol) internal returns(bool) { diff --git a/contracts/interfaces/IModuleFactory.sol b/contracts/interfaces/IModuleFactory.sol index 46da5663e..e9ef7fa4b 100644 --- a/contracts/interfaces/IModuleFactory.sol +++ b/contracts/interfaces/IModuleFactory.sol @@ -9,6 +9,10 @@ contract IModuleFactory is Ownable { ERC20 public polyToken; + function IModuleFactory(address _polyAddress) public { + polyToken = ERC20(_polyAddress); + } + //Should create an instance of the Module, or throw function deploy(bytes _data) external returns(address); diff --git a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol index 46d9dcfae..558c78e7f 100644 --- a/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol +++ b/contracts/modules/PermissionManager/GeneralPermissionManagerFactory.sol @@ -6,8 +6,14 @@ import "../../interfaces/IModuleFactory.sol"; contract GeneralPermissionManagerFactory is IModuleFactory { + function GeneralPermissionManagerFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + function deploy(bytes /* _data */) external returns(address) { - //polyToken.transferFrom(msg.sender, owner, getCost()); + polyToken.transferFrom(msg.sender, owner, getCost()); return address(new GeneralPermissionManager(msg.sender)); } diff --git a/contracts/modules/STO/CappedSTOFactory.sol b/contracts/modules/STO/CappedSTOFactory.sol index 0491a9e91..ded1f51b3 100644 --- a/contracts/modules/STO/CappedSTOFactory.sol +++ b/contracts/modules/STO/CappedSTOFactory.sol @@ -7,8 +7,14 @@ import "../../interfaces/IModule.sol"; contract CappedSTOFactory is IModuleFactory { + function CappedSTOFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + function deploy(bytes _data) external returns(address) { - //polyToken.transferFrom(msg.sender, owner, getCost()); + polyToken.transferFrom(msg.sender, owner, getCost()); //Check valid bytes - can only call module init function CappedSTO cappedSTO = new CappedSTO(msg.sender); //Checks that _data is valid (not calling anything it shouldn't) diff --git a/contracts/modules/STO/DummySTOFactory.sol b/contracts/modules/STO/DummySTOFactory.sol index 07bf93223..dc66ecc98 100644 --- a/contracts/modules/STO/DummySTOFactory.sol +++ b/contracts/modules/STO/DummySTOFactory.sol @@ -7,8 +7,15 @@ import "../../interfaces/IModule.sol"; contract DummySTOFactory is IModuleFactory { + function DummySTOFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + + function deploy(bytes _data) external returns(address) { - //polyToken.transferFrom(msg.sender, owner, getCost()); + polyToken.transferFrom(msg.sender, owner, getCost()); //Check valid bytes - can only call module init function DummySTO dummySTO = new DummySTO(msg.sender); //Checks that _data is valid (not calling anything it shouldn't) diff --git a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol index 09d0a2103..dd28dd9f9 100644 --- a/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/ExchangeTransferManagerFactory.sol @@ -6,8 +6,14 @@ import "../../interfaces/IModuleFactory.sol"; contract ExchangeTransferManagerFactory is IModuleFactory { + function ExchangeTransferManagerFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + function deploy(bytes _data) external returns(address) { - //polyToken.transferFrom(msg.sender, owner, getCost()); + polyToken.transferFrom(msg.sender, owner, getCost()); ExchangeTransferManager exchangeTransferManager = new ExchangeTransferManager(msg.sender); require(getSig(_data) == exchangeTransferManager.getInitFunction()); require(address(exchangeTransferManager).call(_data)); diff --git a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol index d8f1427e4..f6623f9bd 100644 --- a/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol +++ b/contracts/modules/TransferManager/GeneralTransferManagerFactory.sol @@ -6,8 +6,14 @@ import "../../interfaces/IModuleFactory.sol"; contract GeneralTransferManagerFactory is IModuleFactory { + function GeneralTransferManagerFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + function deploy(bytes /* _data */) external returns(address) { - //polyToken.transferFrom(msg.sender, owner, getCost()); + polyToken.transferFrom(msg.sender, owner, getCost()); return address(new GeneralTransferManager(msg.sender)); } diff --git a/contracts/tokens/STVersionProxy001.sol b/contracts/tokens/STVersionProxy001.sol index 1f9b50641..b295a3f6d 100644 --- a/contracts/tokens/STVersionProxy001.sol +++ b/contracts/tokens/STVersionProxy001.sol @@ -33,10 +33,10 @@ contract STVersionProxy001 is ISTProxy { ); if (addPermissionManager) { - SecurityToken(newSecurityTokenAddress).addModule(permissionManagerFactory, "", 0, 0, true); + SecurityToken(newSecurityTokenAddress).addModule(permissionManagerFactory, "", 0, 0, false); } if (addTransferManager) { - SecurityToken(newSecurityTokenAddress).addModule(transferManagerFactory, "", 0, 0, true); + SecurityToken(newSecurityTokenAddress).addModule(transferManagerFactory, "", 0, 0, false); } SecurityToken(newSecurityTokenAddress).transferOwnership(_issuer); diff --git a/contracts/tokens/STVersionProxy002.sol b/contracts/tokens/STVersionProxy002.sol index 3eb0d29cf..2c2bfac64 100644 --- a/contracts/tokens/STVersionProxy002.sol +++ b/contracts/tokens/STVersionProxy002.sol @@ -31,10 +31,10 @@ contract STVersionProxy002 is ISTProxy { ); if (addPermissionManager) { - SecurityToken(newSecurityTokenAddress).addModule(permissionManagerFactory, "", 0, 0, true); + SecurityToken(newSecurityTokenAddress).addModule(permissionManagerFactory, "", 0, 0, false); } if (addTransferManager) { - SecurityToken(newSecurityTokenAddress).addModule(transferManagerFactory, "", 0, 0, true); + SecurityToken(newSecurityTokenAddress).addModule(transferManagerFactory, "", 0, 0, false); } SecurityToken(newSecurityTokenAddress).transferOwnership(_issuer); diff --git a/contracts/tokens/SecurityToken.sol b/contracts/tokens/SecurityToken.sol index 7e5a475f0..388867045 100644 --- a/contracts/tokens/SecurityToken.sol +++ b/contracts/tokens/SecurityToken.sol @@ -32,7 +32,6 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { struct ModuleData { bytes32 name; address moduleAddress; - bool replaceable; } address public moduleRegistry; @@ -43,6 +42,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { // Module list should be order agnostic! mapping (uint8 => ModuleData[]) public modules; + mapping (uint8 => bool) public modulesLocked; uint8 public constant MAX_MODULES = 10; @@ -96,9 +96,9 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { bytes _data, uint256 _maxCost, uint256 _budget, - bool _replaceable + bool _locked ) external onlyOwner { - _addModule(_moduleFactory, _data, _maxCost, _budget, _replaceable); + _addModule(_moduleFactory, _data, _maxCost, _budget, _locked); } /** @@ -108,22 +108,20 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { * @param _moduleFactory is the address of the module factory to be added * @param _data is data packed into bytes used to further configure the module (See STO usage) * @param _maxCost max amount of POLY willing to pay to module. (WIP) - * @param _replaceable whether or not the module is supposed to be replaceable + * @param _locked whether or not the module is supposed to be locked */ //You are allowed to add a new moduleType if: // - there is no existing module of that type yet added // - the last member of the module list is replacable - function _addModule(address _moduleFactory, bytes _data, uint256 _maxCost, uint256 _budget, bool _replaceable) internal { + function _addModule(address _moduleFactory, bytes _data, uint256 _maxCost, uint256 _budget, bool _locked) internal { //Check that module exists in registry - will throw otherwise IModuleRegistry(moduleRegistry).useModule(_moduleFactory); IModuleFactory moduleFactory = IModuleFactory(_moduleFactory); require(modules[moduleFactory.getType()].length < MAX_MODULES); uint256 moduleCost = moduleFactory.getCost(); require(moduleCost <= _maxCost); - //Check that this module has not already been set as non-replaceable - if (modules[moduleFactory.getType()].length != 0) { - require(modules[moduleFactory.getType()][modules[moduleFactory.getType()].length - 1].replaceable); - } + //Check that this module has not already been set as locked + require(!modulesLocked[moduleFactory.getType()]); //Approve fee for module require(polyToken.approve(_moduleFactory, moduleCost)); //Creates instance of module from factory @@ -131,7 +129,8 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { //Approve ongoing budget require(polyToken.approve(module, _budget)); //Add to SecurityToken module map - modules[moduleFactory.getType()].push(ModuleData(moduleFactory.getName(), module, _replaceable)); + modules[moduleFactory.getType()].push(ModuleData(moduleFactory.getName(), module)); + modulesLocked[moduleFactory.getType()] = _locked; //Emit log event emit LogModuleAdded(moduleFactory.getType(), moduleFactory.getName(), _moduleFactory, module, moduleCost, _budget, now); } @@ -144,7 +143,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { function removeModule(uint8 _moduleType, uint8 _moduleIndex) external onlyOwner { require(_moduleIndex < modules[_moduleType].length); require(modules[_moduleType][_moduleIndex].moduleAddress != address(0)); - require(modules[_moduleType][_moduleIndex].replaceable); + require(!modulesLocked[_moduleType]); //Take the last member of the list, and replace _moduleIndex with this, then shorten the list by one emit LogModuleRemoved(_moduleType, modules[_moduleType][_moduleIndex].moduleAddress, now); modules[_moduleType][_moduleIndex] = modules[_moduleType][modules[_moduleType].length - 1]; @@ -156,7 +155,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { return ( modules[_moduleType][_index].name, modules[_moduleType][_index].moduleAddress, - modules[_moduleType][_index].replaceable + modulesLocked[_moduleType] ); }else { return ("", address(0), false); @@ -173,7 +172,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { } /** - * @dev allows owner to approve more POLY to one of the modules + * @dev allows owner to approve more POLY to one of the modules */ function changeModuleBudget(uint8 _moduleType, uint8 _moduleIndex, uint256 _budget) public onlyOwner { require(_moduleType != 0); @@ -183,7 +182,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { } /** - * @dev Overladed version of the transfer function + * @dev Overloaded version of the transfer function */ function transfer(address _to, uint256 _value) public returns (bool success) { require(verifyTransfer(msg.sender, _to, _value)); @@ -191,7 +190,7 @@ contract SecurityToken is ISecurityToken, StandardToken, DetailedERC20 { } /** - * @dev Overladed version of the transferFrom function + * @dev Overloaded version of the transferFrom function */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { require(verifyTransfer(_from, _to, _value)); diff --git a/demo/ST20Generator.js b/demo/ST20Generator.js index 5325a4e27..123c0f1ab 100644 --- a/demo/ST20Generator.js +++ b/demo/ST20Generator.js @@ -462,7 +462,7 @@ async function step_STO_Launch(){ }, [startTime, endTime, web3.utils.toWei(cap, 'ether'), rate,0,0,wallet]); try{ - await securityToken.methods.addModule(cappedSTOFactoryAddress, bytesSTO, 0,0, false).send({ from: Issuer, gas:2500000, gasPrice:DEFAULT_GAS_PRICE}) + await securityToken.methods.addModule(cappedSTOFactoryAddress, bytesSTO, 0,0, true).send({ from: Issuer, gas:2500000, gasPrice:DEFAULT_GAS_PRICE}) .on('transactionHash', function(hash){ console.log(` Your transaction is being processed. Please wait... diff --git a/migrations/2_deploy_contracts.js b/migrations/2_deploy_contracts.js index 421cebb09..8701828a8 100644 --- a/migrations/2_deploy_contracts.js +++ b/migrations/2_deploy_contracts.js @@ -18,9 +18,6 @@ var BigNumber = require('bignumber.js'); const Web3 = require('web3'); var web3; - - - const zero = "0x0000000000000000000000000000000000000000"; const totalSupply = 100000; const name = "TEST POLY"; @@ -51,8 +48,8 @@ module.exports = function (deployer, network, accounts) { return deployer.deploy(PolyTokenFaucet).then(() => { return deployer.deploy(ModuleRegistry, {from: PolymathAccount}).then(() => { return ModuleRegistry.deployed().then((moduleRegistry) => { - return deployer.deploy(GeneralTransferManagerFactory, {from: PolymathAccount}).then(() => { - return deployer.deploy(GeneralPermissionManagerFactory, {from: PolymathAccount}).then(() => { + return deployer.deploy(GeneralTransferManagerFactory, PolyTokenFaucet.address, {from: PolymathAccount}).then(() => { + return deployer.deploy(GeneralPermissionManagerFactory, PolyTokenFaucet.address, {from: PolymathAccount}).then(() => { return deployer.deploy(PolyToken).then(() => { return moduleRegistry.registerModule(GeneralTransferManagerFactory.address, {from: PolymathAccount}).then(() => { return moduleRegistry.registerModule(GeneralPermissionManagerFactory.address, {from: PolymathAccount}).then(() => { @@ -64,9 +61,9 @@ module.exports = function (deployer, network, accounts) { return TickerRegistry.deployed().then((tickerRegistry) => { return tickerRegistry.setTokenRegistry(SecurityTokenRegistry.address, {from: PolymathAccount}).then(() => { return moduleRegistry.setTokenRegistry(SecurityTokenRegistry.address, {from: PolymathAccount}).then(() => { - return deployer.deploy(DummySTOFactory, {from: PolymathAccount}).then(() => { + return deployer.deploy(DummySTOFactory, PolyTokenFaucet.address, {from: PolymathAccount}).then(() => { return moduleRegistry.registerModule(DummySTOFactory.address, {from: PolymathAccount}).then(() => { - return deployer.deploy(CappedSTOFactory, {from: PolymathAccount}).then(() => { + return deployer.deploy(CappedSTOFactory, PolyTokenFaucet.address, {from: PolymathAccount}).then(() => { return moduleRegistry.registerModule(CappedSTOFactory.address, {from: PolymathAccount}).then(() => { console.log("\n") console.log("----- Polymath Core Contracts -----"); diff --git a/package.json b/package.json index 3a898a162..4c9ae3dd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polymath-core", - "version": "0.3.1", + "version": "0.4.0", "description": "Polymath Network Core Smart Contracts", "main": "truffle.js", "directories": { @@ -53,6 +53,7 @@ "bignumber.js": "^6.0.0", "readline-sync": "^1.4.9", "truffle-contract": "^3.0.4", + "truffle-hdwallet-provider": "0.0.3", "truffle-hdwallet-provider-privkey": "^0.1.0", "web3": "^1.0.0-beta.33", "zeppelin-solidity": "1.7.0" diff --git a/test/Issuance.js b/test/Issuance.js index 2b83b7b2a..882f9434b 100644 --- a/test/Issuance.js +++ b/test/Issuance.js @@ -40,7 +40,7 @@ contract('SecurityToken', accounts => { // investor Details let fromTime = latestTime(); let toTime = latestTime() + duration.days(15); - + // Contract Instance Declaration let I_GeneralPermissionManagerFactory; let I_GeneralTransferManagerFactory; @@ -115,6 +115,9 @@ contract('SecurityToken', accounts => { // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -127,7 +130,7 @@ contract('SecurityToken', accounts => { // STEP 2: Deploy the GeneralTransferManagerFactory - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -137,7 +140,7 @@ contract('SecurityToken', accounts => { // STEP 3: Deploy the GeneralDelegateManagerFactory - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -147,7 +150,7 @@ contract('SecurityToken', accounts => { // STEP 4: Deploy the CappedSTOFactory - I_CappedSTOFactory = await CappedSTOFactory.new({ from: token_owner }); + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: token_owner }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -188,8 +191,6 @@ contract('SecurityToken', accounts => { "STVersion contract was not deployed", ); - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); // Step 8: Deploy the SecurityTokenRegistry @@ -239,17 +240,17 @@ contract('SecurityToken', accounts => { it("POLYMATH: Should generate the new security token with the same symbol as registered above", async () => { let tx = await I_SecurityTokenRegistry.generateSecurityToken(name, symbol, decimals, tokenDetails, { from: account_polymath }); - + // Verify the successful generation of the security token assert.equal(tx.logs[1].args._ticker, symbol, "SecurityToken doesn't get deployed"); - + I_SecurityToken = SecurityToken.at(tx.logs[1].args._securityTokenAddress); - + const LogAddModule = await I_SecurityToken.allEvents(); const log = await new Promise(function(resolve, reject) { LogAddModule.watch(function(error, log){ resolve(log);}); }); - + // Verify that GeneralPermissionManager module get added successfully or not assert.equal(log.args._type.toNumber(), permissionManagerKey); assert.equal( @@ -263,16 +264,16 @@ contract('SecurityToken', accounts => { it("POLYMATH: Should intialize the auto attached modules", async () => { let moduleData = await I_SecurityToken.modules(transferManagerKey, 0); I_GeneralTransferManager = GeneralTransferManager.at(moduleData[1]); - + assert.notEqual( I_GeneralTransferManager.address.valueOf(), "0x0000000000000000000000000000000000000000", "GeneralTransferManager contract was not deployed", ); - + moduleData = await I_SecurityToken.modules(permissionManagerKey, 0); I_GeneralPermissionManager = GeneralPermissionManager.at(moduleData[1]); - + assert.notEqual( I_GeneralPermissionManager.address.valueOf(), "0x0000000000000000000000000000000000000000", @@ -283,7 +284,7 @@ contract('SecurityToken', accounts => { it("POLYMATH: Should successfully attach the STO factory with the security token", async () => { // STEP 4: Deploy the CappedSTOFactory - I_CappedSTOFactory = await CappedSTOFactory.new({ from: account_polymath }); + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: account_polymath }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -295,17 +296,17 @@ contract('SecurityToken', accounts => { await I_ModuleRegistry.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [(latestTime() + duration.seconds(5000)), (latestTime() + duration.days(30)), cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); - - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: account_polymath, gas: 2500000 }); - - assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); + + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: account_polymath, gas: 2500000 }); + + assert.equal(tx.logs[3].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "CappedSTO", "CappedSTOFactory module was not added" ); - I_CappedSTO = CappedSTO.at(tx.logs[2].args._module); + I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); }); }); @@ -327,7 +328,7 @@ contract('SecurityToken', accounts => { await I_GeneralPermissionManager.addPermission(account_delegate, delegateDetails, { from: account_polymath}); // Providing the permission to the delegate await I_GeneralPermissionManager.changePermission(account_delegate, I_GeneralTransferManager.address, TM_Perm, true, { from: account_polymath }); - + assert.isTrue(await I_GeneralPermissionManager.checkPermission(account_delegate, I_GeneralTransferManager.address, TM_Perm)); }); @@ -341,7 +342,7 @@ contract('SecurityToken', accounts => { describe("Operations on the STO", async() => { it("Should Buy the tokens", async() => { balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); - + // Jump time await increaseTime(5000); // Fallback transaction @@ -351,16 +352,16 @@ contract('SecurityToken', accounts => { gas: 210000, value: web3.utils.toWei('1', 'ether') }); - + assert.equal( (await I_CappedSTO.fundsRaised.call()) .dividedBy(new BigNumber(10).pow(18)) .toNumber(), 1 ); - + assert.equal(await I_CappedSTO.getNumberInvestors.call(), 1); - + assert.equal( (await I_SecurityToken.balanceOf(account_investor1)) .dividedBy(new BigNumber(10).pow(18)) @@ -368,13 +369,13 @@ contract('SecurityToken', accounts => { 1000 ); }); - + it("Verification of the event Token Purchase", async() => { let TokenPurchase = I_CappedSTO.allEvents(); let log = await new Promise(function(resolve, reject) { TokenPurchase.watch(function(error, log){ resolve(log);}) }); - + assert.equal(log.args.purchaser, account_investor1, "Wrong address of the investor"); assert.equal( (log.args.amount) @@ -405,16 +406,16 @@ contract('SecurityToken', accounts => { gas: 210000, value: web3.utils.toWei('1', 'ether') }); - + assert.equal( (await I_CappedSTO.fundsRaised.call()) .dividedBy(new BigNumber(10).pow(18)) .toNumber(), 2 ); - + assert.equal(await I_CappedSTO.getNumberInvestors.call(), 2); - + assert.equal( (await I_SecurityToken.balanceOf(account_investor2)) .dividedBy(new BigNumber(10).pow(18)) @@ -424,4 +425,4 @@ contract('SecurityToken', accounts => { }) }); }); -}); \ No newline at end of file +}); diff --git a/test/capped_sto.js b/test/capped_sto.js index dd44c3e37..718765411 100644 --- a/test/capped_sto.js +++ b/test/capped_sto.js @@ -121,6 +121,9 @@ contract('CappedSTO', accounts => { // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -133,7 +136,7 @@ contract('CappedSTO', accounts => { // STEP 2: Deploy the GeneralTransferManagerFactory - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -143,7 +146,7 @@ contract('CappedSTO', accounts => { // STEP 3: Deploy the GeneralDelegateManagerFactory - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -153,7 +156,7 @@ contract('CappedSTO', accounts => { // STEP 4: Deploy the CappedSTOFactory - I_CappedSTOFactory = await CappedSTOFactory.new({ from: token_owner }); + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: token_owner }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -194,9 +197,6 @@ contract('CappedSTO', accounts => { "STVersion contract was not deployed", ); - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); - // Step 8: Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new( @@ -288,7 +288,7 @@ contract('CappedSTO', accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [startTime, endTime, cap, 0, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); let errorThrown = false; try { - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 2500000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 2500000 }); } catch(error) { console.log(`Tx Failed because of rate is ${0}. Test Passed Successfully`); errorThrown = true; @@ -301,7 +301,7 @@ contract('CappedSTO', accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [ Math.floor(Date.now()/1000 + 100000), Math.floor(Date.now()/1000 + 1000), cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); let errorThrown = false; try { - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 2500000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 2500000 }); } catch(error) { errorThrown = true; console.log(`Tx Failed because of startTime is greater than endTime. Test Passed Successfully`); @@ -314,28 +314,28 @@ contract('CappedSTO', accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [ startTime, endTime, 0, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); let errorThrown = false; try { - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 2500000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 2500000 }); } catch(error) { console.log(`Tx Failed because the Cap is equal to ${0}. Test Passed Successfully`); errorThrown = true; ensureException(error); } - assert.ok(errorThrown, message); + assert.ok(errorThrown, message); }); it("Should successfully attach the STO factory with the security token", async () => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [startTime, endTime, cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 2500000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 2500000 }); - assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); + assert.equal(tx.logs[3].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "CappedSTO", "CappedSTOFactory module was not added" ); - I_CappedSTO = CappedSTO.at(tx.logs[2].args._module); + I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); }); }); @@ -599,16 +599,16 @@ contract('CappedSTO', accounts => { it("POLY: Should successfully attach the STO factory with the security token", async () => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [P_startTime, P_endTime, P_cap, P_rate, P_fundRaiseType, I_PolyFaucet.address, account_fundsReceiver]); - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 2500000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 2500000 }); - assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); + assert.equal(tx.logs[3].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "CappedSTO", "CappedSTOFactory module was not added" ); - I_CappedSTO = CappedSTO.at(tx.logs[2].args._module); + I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); }); }); @@ -784,10 +784,10 @@ contract('CappedSTO', accounts => { ); } catch(error) { console.log(`failed Because STO get expired reached`); - errorThrown = true; + errorThrown = true; ensureException(error); } - assert.ok(errorThrown, message); + assert.ok(errorThrown, message); }); it("Should fundRaised value equal to the raised value in the funds receiver wallet", async() => { diff --git a/test/exchange_transfer_manager.js b/test/exchange_transfer_manager.js index 41c869bd1..8ec3f0c38 100644 --- a/test/exchange_transfer_manager.js +++ b/test/exchange_transfer_manager.js @@ -101,6 +101,9 @@ contract('ExchangeTransferManager', accounts => { // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -113,7 +116,7 @@ contract('ExchangeTransferManager', accounts => { // STEP 2a: Deploy the GeneralTransferManagerFactory - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -123,7 +126,7 @@ contract('ExchangeTransferManager', accounts => { // STEP 2b: Deploy the ExchangeTransferManagerFactory - I_ExchangeTransferManagerFactory = await ExchangeTransferManagerFactory.new({from:account_polymath}); + I_ExchangeTransferManagerFactory = await ExchangeTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_ExchangeTransferManagerFactory.address.valueOf(), @@ -133,7 +136,7 @@ contract('ExchangeTransferManager', accounts => { // STEP 3: Deploy the GeneralDelegateManagerFactory - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -143,7 +146,7 @@ contract('ExchangeTransferManager', accounts => { // STEP 4: Deploy the DummySTOFactory - I_DummySTOFactory = await DummySTOFactory.new({from:account_polymath}); + I_DummySTOFactory = await DummySTOFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_DummySTOFactory.address.valueOf(), @@ -189,9 +192,6 @@ contract('ExchangeTransferManager', accounts => { "STVersion contract was not deployed", ); - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); - // Step 8: Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new( @@ -278,15 +278,15 @@ contract('ExchangeTransferManager', accounts => { }); it("Should successfully attach the STO factory with the security token", async () => { - const tx = await I_SecurityToken.addModule(I_DummySTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner }); - assert.equal(tx.logs[2].args._type.toNumber(), stoKey, "DummySTO doesn't get deployed"); + const tx = await I_SecurityToken.addModule(I_DummySTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner }); + assert.equal(tx.logs[3].args._type.toNumber(), stoKey, "DummySTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "DummySTO", "DummySTOFactory module was not added" ); - I_DummySTO = DummySTO.at(tx.logs[2].args._module); + I_DummySTO = DummySTO.at(tx.logs[3].args._module); }); }); @@ -346,14 +346,14 @@ contract('ExchangeTransferManager', accounts => { }, [account_exchange]); const tx = await I_SecurityToken.addModule(I_ExchangeTransferManagerFactory.address, bytesExchange, 0, 0, true, { from: token_owner }); - assert.equal(tx.logs[2].args._type.toNumber(), transferManagerKey, "ExchangeTransferManager doesn't get deployed"); + assert.equal(tx.logs[3].args._type.toNumber(), transferManagerKey, "ExchangeTransferManager doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "ExchangeTransferManager", "ExchangeTransferManager module was not added" ); - I_ExchangeTransferManager = ExchangeTransferManager.at(tx.logs[2].args._module); + I_ExchangeTransferManager = ExchangeTransferManager.at(tx.logs[3].args._module); // Add exchange address to General Transfer Manager whitelist @@ -415,7 +415,7 @@ contract('ExchangeTransferManager', accounts => { web3.utils.toWei('1', 'ether') ); }); - + }); }); diff --git a/test/helpers/contracts/TestSTOFactory.sol b/test/helpers/contracts/TestSTOFactory.sol new file mode 100644 index 000000000..c6a269572 --- /dev/null +++ b/test/helpers/contracts/TestSTOFactory.sol @@ -0,0 +1,50 @@ +pragma solidity ^0.4.21; + +import "../../../contracts/modules/STO/DummySTO.sol"; +import "../../../contracts/interfaces/IModuleFactory.sol"; +import "../../../contracts/interfaces/IModule.sol"; + + +contract TestSTOFactory is IModuleFactory { + + function TestSTOFactory(address _polyAddress) public + IModuleFactory(_polyAddress) + { + + } + + function deploy(bytes _data) external returns(address) { + //polyToken.transferFrom(msg.sender, owner, getCost()); + //Check valid bytes - can only call module init function + DummySTO dummySTO = new DummySTO(msg.sender); + //Checks that _data is valid (not calling anything it shouldn't) + require(getSig(_data) == dummySTO.getInitFunction()); + require(address(dummySTO).call(_data)); + return address(dummySTO); + } + + function getCost() public view returns(uint256) { + return uint256(1000 * 10 ** 18); + } + + function getType() public view returns(uint8) { + return 3; + } + + function getName() public view returns(bytes32) { + return "TestSTO"; + } + + function getDescription() public view returns(string) { + return "Test STO"; + } + + function getTitle() public view returns(string) { + return "Test STO"; + } + + function getInstructions() public view returns(string) { + return "Test STO - you can mint tokens at will"; + } + +} diff --git a/test/module_registry.js b/test/module_registry.js index 75ec22cdf..179dbf14f 100644 --- a/test/module_registry.js +++ b/test/module_registry.js @@ -39,7 +39,7 @@ contract('ModuleRegistry', accounts => { // investor Details let fromTime = latestTime(); let toTime = latestTime() + duration.days(15); - + let ID_snap; let message = "Transaction Should fail!"; // Contract Instance Declaration @@ -119,9 +119,12 @@ contract('ModuleRegistry', accounts => { account_delegate = accounts[5]; account_temp = accounts[8]; token_owner = account_issuer; - + // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -144,9 +147,6 @@ contract('ModuleRegistry', accounts => { // Step 7: Deploy the STversionProxy contract - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); - // Step 9: Deploy the token Faucet I_PolyFaucet = await PolyTokenFaucet.new(); @@ -160,8 +160,8 @@ contract('ModuleRegistry', accounts => { }); it("Should successfully deployed the Module Fatories", async () => { - - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -169,8 +169,8 @@ contract('ModuleRegistry', accounts => { "GeneralTransferManagerFactory contract was not deployed" ); - - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -178,8 +178,8 @@ contract('ModuleRegistry', accounts => { "GeneralDelegateManagerFactory contract was not deployed" ); - - I_CappedSTOFactory = await CappedSTOFactory.new({ from: account_polymath }); + + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: account_polymath }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -187,7 +187,7 @@ contract('ModuleRegistry', accounts => { "CappedSTOFactory contract was not deployed" ); - I_DummySTOFactory = await DummySTOFactory.new({ from: account_temp }); + I_DummySTOFactory = await DummySTOFactory.new(I_PolyToken.address, { from: account_temp }); assert.notEqual( I_DummySTOFactory.address.valueOf(), @@ -201,7 +201,7 @@ contract('ModuleRegistry', accounts => { it("Should succssfully registered the module", async() => { let tx = await I_ModuleRegistry.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); - + assert.equal( tx.logs[0].args._moduleFactory, I_GeneralTransferManagerFactory.address, @@ -211,7 +211,7 @@ contract('ModuleRegistry', accounts => { assert.equal(tx.logs[0].args._owner, account_polymath); tx = await I_ModuleRegistry.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); - + assert.equal( tx.logs[0].args._moduleFactory, I_GeneralPermissionManagerFactory.address, @@ -221,7 +221,7 @@ contract('ModuleRegistry', accounts => { assert.equal(tx.logs[0].args._owner, account_polymath); tx = await I_ModuleRegistry.registerModule(I_CappedSTOFactory.address, { from: account_polymath }); - + assert.equal( tx.logs[0].args._moduleFactory, I_CappedSTOFactory.address, @@ -322,7 +322,7 @@ contract('ModuleRegistry', accounts => { "0x0000000000000000000000000000000000000000", "STVersion contract was not deployed", ); - + // Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new( @@ -429,7 +429,7 @@ contract('ModuleRegistry', accounts => { let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [startTime, endTime, cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); let errorThrown = false; try { - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 5000000 }); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 5000000 }); } catch(error) { errorThrown = true; console.log(`Tx get failed. Because module is un-verified`); @@ -439,7 +439,7 @@ contract('ModuleRegistry', accounts => { }); it("Should successfully add the CappedSTO module. Because module is deployed by the owner of ST", async() => { - I_CappedSTOFactory = await CappedSTOFactory.new({ from: token_owner }); + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: token_owner }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -448,7 +448,7 @@ contract('ModuleRegistry', accounts => { ); let tx = await I_ModuleRegistry.registerModule(I_CappedSTOFactory.address, { from: token_owner }); - + assert.equal( tx.logs[0].args._moduleFactory, I_CappedSTOFactory.address, @@ -460,12 +460,12 @@ contract('ModuleRegistry', accounts => { startTime = latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [startTime, endTime, cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); - - tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 5000000 }); - - assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); + + tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 5000000 }); + + assert.equal(tx.logs[3].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "CappedSTO", "CappedSTOFactory module was not added" @@ -473,4 +473,4 @@ contract('ModuleRegistry', accounts => { }); }); - }); \ No newline at end of file + }); diff --git a/test/security_token.js b/test/security_token.js index 6acba8063..2ce0b9ae4 100644 --- a/test/security_token.js +++ b/test/security_token.js @@ -38,7 +38,7 @@ contract('SecurityToken', accounts => { // investor Details let fromTime = latestTime(); let toTime = latestTime() + duration.days(100); - + let ID_snap; const message = "Transaction Should Fail!!"; @@ -119,9 +119,12 @@ contract('SecurityToken', accounts => { account_delegate = accounts[5]; account_temp = accounts[8]; token_owner = account_issuer; - + // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -134,7 +137,7 @@ contract('SecurityToken', accounts => { // STEP 2: Deploy the GeneralTransferManagerFactory - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -144,7 +147,7 @@ contract('SecurityToken', accounts => { // STEP 3: Deploy the GeneralDelegateManagerFactory - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -154,7 +157,7 @@ contract('SecurityToken', accounts => { // STEP 4: Deploy the CappedSTOFactory - I_CappedSTOFactory = await CappedSTOFactory.new({ from: token_owner }); + I_CappedSTOFactory = await CappedSTOFactory.new(I_PolyToken.address, { from: token_owner }); assert.notEqual( I_CappedSTOFactory.address.valueOf(), @@ -195,9 +198,6 @@ contract('SecurityToken', accounts => { "STVersion contract was not deployed", ); - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); - // Step 8: Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new( @@ -289,17 +289,16 @@ contract('SecurityToken', accounts => { startTime = latestTime() + duration.seconds(5000); endTime = startTime + duration.days(30); let bytesSTO = web3.eth.abi.encodeFunctionCall(functionSignature, [startTime, endTime, cap, rate, fundRaiseType, I_PolyToken.address, account_fundsReceiver]); - - const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, false, { from: token_owner, gas: 5000000 }); - assert.equal(tx.logs[2].args._type, stoKey, "CappedSTO doesn't get deployed"); + const tx = await I_SecurityToken.addModule(I_CappedSTOFactory.address, bytesSTO, 0, 0, true, { from: token_owner, gas: 5000000 }); + assert.equal(tx.logs[3].args._type, stoKey, "CappedSTO doesn't get deployed"); assert.equal( - web3.utils.toAscii(tx.logs[2].args._name) + web3.utils.toAscii(tx.logs[3].args._name) .replace(/\u0000/g, ''), "CappedSTO", "CappedSTOFactory module was not added" ); - I_CappedSTO = CappedSTO.at(tx.logs[2].args._module); + I_CappedSTO = CappedSTO.at(tx.logs[3].args._module); }); }); @@ -308,7 +307,7 @@ contract('SecurityToken', accounts => { let moduleData = await I_SecurityToken.getModule.call(stoKey, 0); assert.equal(web3.utils.toAscii(moduleData[0]).replace(/\u0000/g, ''), "CappedSTO"); assert.equal(moduleData[1], I_CappedSTO.address); - assert.isFalse(moduleData[2]); + assert.isTrue(moduleData[2]); }); it("Should fails in removing the module from the securityToken", async() => { @@ -339,7 +338,7 @@ contract('SecurityToken', accounts => { let key = await takeSnapshot(); let tx = await I_SecurityToken.removeModule(transferManagerKey, 0, { from : token_owner }); assert.equal(tx.logs[0].args._type, transferManagerKey); - assert.equal(tx.logs[0].args._module, I_GeneralTransferManager.address); + assert.equal(tx.logs[0].args._module, I_GeneralTransferManager.address); await revertToSnapshot(key); }); @@ -347,7 +346,7 @@ contract('SecurityToken', accounts => { let moduleData = await I_SecurityToken.getModule.call(transferManagerKey, 0); assert.equal(web3.utils.toAscii(moduleData[0]).replace(/\u0000/g, ''), "GeneralTransferManager"); assert.equal(moduleData[1], I_GeneralTransferManager.address); - assert.isTrue(moduleData[2]); + assert.isFalse(moduleData[2]); }); it("Should change the budget of the module", async() => { @@ -363,7 +362,7 @@ contract('SecurityToken', accounts => { it("Should Buy the tokens", async() => { balanceOfReceiver = await web3.eth.getBalance(account_fundsReceiver); // Add the Investor in to the whitelist - + let tx = await I_GeneralTransferManager.modifyWhitelist( account_investor1, fromTime, @@ -372,9 +371,9 @@ contract('SecurityToken', accounts => { from: account_issuer, gas: 500000 }); - + assert.equal(tx.logs[0].args._investor, account_investor1, "Failed in adding the investor in whitelist"); - + // Jump time await increaseTime(5000); // Fallback transaction @@ -384,16 +383,16 @@ contract('SecurityToken', accounts => { gas: 210000, value: web3.utils.toWei('1', 'ether') }); - + assert.equal( (await I_CappedSTO.fundsRaised.call()) .dividedBy(new BigNumber(10).pow(18)) .toNumber(), 1 ); - + assert.equal(await I_CappedSTO.getNumberInvestors.call(), 1); - + assert.equal( (await I_SecurityToken.balanceOf(account_investor1)) .dividedBy(new BigNumber(10).pow(18)) @@ -412,7 +411,7 @@ contract('SecurityToken', accounts => { ensureException(error); } assert.ok(errorThrown, message); - }); + }); it("Should fail to provide the permission to the delegate to change the transfer bools", async () => { let errorThrown = false; @@ -497,7 +496,7 @@ contract('SecurityToken', accounts => { from: account_issuer, gas: 500000 }); - + assert.equal(tx.logs[0].args._investor, account_investor2, "Failed in adding the investor in whitelist"); await I_SecurityToken.transfer(account_investor2, (10 * Math.pow(10, 18)), { from : account_investor1}); @@ -550,16 +549,16 @@ contract('SecurityToken', accounts => { gas: 210000, value: web3.utils.toWei('1', 'ether') }); - + assert.equal( (await I_CappedSTO.fundsRaised.call()) .dividedBy(new BigNumber(10).pow(18)) .toNumber(), 2 ); - + assert.equal(await I_CappedSTO.getNumberInvestors.call(), 2); - + assert.equal( (await I_SecurityToken.balanceOf(account_investor1)) .dividedBy(new BigNumber(10).pow(18)) @@ -596,10 +595,10 @@ contract('SecurityToken', accounts => { console.log(`non-whitelist investor is not allowed`); errorThrown = true; ensureException(error); - } + } assert.ok(errorThrown, message); }); }); - }); \ No newline at end of file + }); diff --git a/test/security_token_registry.js b/test/security_token_registry.js new file mode 100644 index 000000000..ee303a9c1 --- /dev/null +++ b/test/security_token_registry.js @@ -0,0 +1,411 @@ +import latestTime from './helpers/latestTime'; +import { duration, ensureException } from './helpers/utils'; +import { takeSnapshot, increaseTime, revertToSnapshot } from './helpers/time'; + +const TestSTOFactory = artifacts.require('./test/helpers/contracts/TestSTOFactory.sol'); +const DummySTO = artifacts.require('./DummySTO.sol'); +const ModuleRegistry = artifacts.require('./ModuleRegistry.sol'); +const SecurityToken = artifacts.require('./SecurityToken.sol'); +const SecurityTokenRegistry = artifacts.require('./SecurityTokenRegistry.sol'); +const TickerRegistry = artifacts.require('./TickerRegistry.sol'); +const STVersion = artifacts.require('./STVersionProxy001.sol'); +const STVersion002 = artifacts.require('./STVersionProxy002.sol'); +const GeneralPermissionManagerFactory = artifacts.require('./GeneralPermissionManagerFactory.sol'); +const GeneralTransferManagerFactory = artifacts.require('./GeneralTransferManagerFactory.sol'); +const GeneralTransferManager = artifacts.require('./GeneralTransferManager'); +const GeneralPermissionManager = artifacts.require('./GeneralPermissionManager'); +const PolyToken = artifacts.require('./PolyToken.sol'); +const PolyTokenFaucet = artifacts.require('./helpers/contracts/PolyTokenFaucet.sol'); + +const Web3 = require('web3'); +const BigNumber = require('bignumber.js'); +const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")) // Hardcoded development port + + +contract('SecurityTokenRegistry', accounts => { + + + // Accounts Variable declaration + let account_polymath; + let account_investor1; + let account_issuer; + let token_owner; + let account_investor2; + let account_fundsReceiver; + let account_delegate; + let account_temp; + + let balanceOfReceiver; + // investor Details + let fromTime = latestTime(); + let toTime = latestTime() + duration.days(100); + + let ID_snap; + const message = "Transaction Should Fail!!"; + + // Contract Instance Declaration + let I_GeneralPermissionManagerFactory; + let I_GeneralTransferManagerFactory; + let I_GeneralPermissionManager; + let I_GeneralTransferManager; + let I_ModuleRegistry; + let I_TickerRegistry; + let I_SecurityTokenRegistry; + let I_TestSTOFactory; + let I_STVersion; + let I_SecurityToken; + let I_DummySTO; + let I_PolyToken; + let I_PolyFaucet; + let I_STVersion002; + let I_SecurityToken002; + let I_STVersion003; + // SecurityToken Details (Launched ST on the behalf of the issuer) + const swarmHash = "dagwrgwgvwergwrvwrg"; + const name = "Demo Token"; + const symbol = "DET"; + const tokenDetails = "This is equity type of issuance"; + const decimals = 18; + + //Security Token Detials (Version 2) + const swarmHash2 = "dagwrgwgvwergwrvwrg"; + const name2 = "Demo2 Token"; + const symbol2 = "DET2"; + const tokenDetails2 = "This is equity type of issuance"; + + // Module key + const permissionManagerKey = 1; + const transferManagerKey = 2; + const stoKey = 3; + const budget = 0; + + // Capped STO details + const cap = new BigNumber(10000).times(new BigNumber(10).pow(18)); + const someString = "Hello string"; + const functionSignature = { + name: 'configure', + type: 'function', + inputs: [{ + type: 'uint256', + name: '_startTime' + },{ + type: 'uint256', + name: '_endTime' + },{ + type: 'uint256', + name: '_cap' + },{ + type: 'string', + name: '_someString' + }] + }; + + before(async() => { + // Accounts setup + account_polymath = accounts[0]; + account_issuer = accounts[1]; + account_investor1 = accounts[9]; + account_investor2 = accounts[6]; + account_fundsReceiver = accounts[4]; + account_delegate = accounts[5]; + account_temp = accounts[8]; + token_owner = account_issuer; + + // ----------- POLYMATH NETWORK Configuration ------------ + + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + + // STEP 1: Deploy the ModuleRegistry + + I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); + + assert.notEqual( + I_ModuleRegistry.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "ModuleRegistry contract was not deployed" + ); + + // STEP 2: Deploy the GeneralTransferManagerFactory + + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); + + assert.notEqual( + I_GeneralTransferManagerFactory.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "GeneralTransferManagerFactory contract was not deployed" + ); + + // STEP 3: Deploy the GeneralDelegateManagerFactory + + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); + + assert.notEqual( + I_GeneralPermissionManagerFactory.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "GeneralDelegateManagerFactory contract was not deployed" + ); + + // STEP 4: Deploy the CappedSTOFactory + + I_TestSTOFactory = await TestSTOFactory.new(I_PolyToken.address, { from: token_owner }); + + assert.notEqual( + I_TestSTOFactory.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "TestSTOFactory contract was not deployed" + ); + + // STEP 5: Register the Modules with the ModuleRegistry contract + + // (A) : Register the GeneralTransferManagerFactory + await I_ModuleRegistry.registerModule(I_GeneralTransferManagerFactory.address, { from: account_polymath }); + await I_ModuleRegistry.verifyModule(I_GeneralTransferManagerFactory.address, true, { from: account_polymath }); + + // (B) : Register the GeneralDelegateManagerFactory + await I_ModuleRegistry.registerModule(I_GeneralPermissionManagerFactory.address, { from: account_polymath }); + await I_ModuleRegistry.verifyModule(I_GeneralPermissionManagerFactory.address, true, { from: account_polymath }); + + // (C) : Register the STOFactory + await I_ModuleRegistry.registerModule(I_TestSTOFactory.address, { from: token_owner }); + + // Step 6: Deploy the TickerRegistry + + I_TickerRegistry = await TickerRegistry.new({ from: account_polymath }); + + assert.notEqual( + I_TickerRegistry.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "TickerRegistry contract was not deployed", + ); + + // Step 7: Deploy the STversionProxy contract + + I_STVersion = await STVersion.new(I_GeneralTransferManagerFactory.address, I_GeneralPermissionManagerFactory.address, {from : account_polymath }); + + assert.notEqual( + I_STVersion.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "STVersion contract was not deployed", + ); + + // Step 8: Deploy the token Faucet + I_PolyFaucet = await PolyTokenFaucet.new(); + + // Step 9: Deploy the SecurityTokenRegistry + + I_SecurityTokenRegistry = await SecurityTokenRegistry.new( + I_PolyFaucet.address, + I_ModuleRegistry.address, + I_TickerRegistry.address, + I_STVersion.address, + { + from: account_polymath + }); + + assert.notEqual( + I_SecurityTokenRegistry.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "SecurityTokenRegistry contract was not deployed", + ); + + // Step 8: Set the STR in TickerRegistry + await I_TickerRegistry.setTokenRegistry(I_SecurityTokenRegistry.address, {from: account_polymath}); + await I_ModuleRegistry.setTokenRegistry(I_SecurityTokenRegistry.address, {from: account_polymath}); + + + + // Printing all the contract addresses + console.log(`\nPolymath Network Smart Contracts Deployed:\n + ModuleRegistry: ${I_ModuleRegistry.address}\n + GeneralTransferManagerFactory: ${I_GeneralTransferManagerFactory.address}\n + GeneralPermissionManagerFactory: ${I_GeneralPermissionManagerFactory.address}\n + TestSTOFactory: ${I_TestSTOFactory.address}\n + TickerRegistry: ${I_TickerRegistry.address}\n + STVersionProxy_001: ${I_STVersion.address}\n + SecurityTokenRegistry: ${I_SecurityTokenRegistry.address}\n + `); + }); + + describe("Generate the SecurityToken", async() => { + + it("Should register the ticker before the generation of the security token", async () => { + let tx = await I_TickerRegistry.registerTicker(token_owner, symbol, name, swarmHash, { from : token_owner }); + assert.equal(tx.logs[0].args._owner, token_owner); + assert.equal(tx.logs[0].args._symbol, symbol); + }); + + it("Should generate the new security token with the same symbol as registered above", async () => { + let tx = await I_SecurityTokenRegistry.generateSecurityToken(name, symbol, decimals, tokenDetails, { from: token_owner }); + + // Verify the successful generation of the security token + assert.equal(tx.logs[1].args._ticker, symbol, "SecurityToken doesn't get deployed"); + + I_SecurityToken = SecurityToken.at(tx.logs[1].args._securityTokenAddress); + + const LogAddModule = await I_SecurityToken.allEvents(); + const log = await new Promise(function(resolve, reject) { + LogAddModule.watch(function(error, log){ resolve(log);}); + }); + + // Verify that GeneralPermissionManager module get added successfully or not + assert.equal(log.args._type.toNumber(), permissionManagerKey); + assert.equal( + web3.utils.toAscii(log.args._name) + .replace(/\u0000/g, ''), + "GeneralPermissionManager" + ); + LogAddModule.stopWatching(); + }); + + it("Should deploy the st vesrion 2", async() => { + // Step 7: Deploy the STversionProxy contract + + I_STVersion002 = await STVersion002.new(I_GeneralTransferManagerFactory.address, I_GeneralPermissionManagerFactory.address, {from : account_polymath }); + + assert.notEqual( + I_STVersion002.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "STVersion002 contract was not deployed", + ); + await I_SecurityTokenRegistry.setProtocolVersion(I_STVersion002.address, "0.2.0", { from: account_polymath }); + + assert.equal( + web3.utils.toAscii(await I_SecurityTokenRegistry.protocolVersion.call()) + .replace(/\u0000/g, ''), + "0.2.0" + ); + }); + + it("Should register the ticker before the generation of the security token", async () => { + let tx = await I_TickerRegistry.registerTicker(token_owner, symbol2, name2, swarmHash, { from : token_owner }); + assert.equal(tx.logs[0].args._owner, token_owner); + assert.equal(tx.logs[0].args._symbol, symbol2); + }); + + it("Should generate the new security token with version 2", async() => { + let tx = await I_SecurityTokenRegistry.generateSecurityToken(name2, symbol2, decimals, tokenDetails, { from: token_owner }); + + // Verify the successful generation of the security token + assert.equal(tx.logs[1].args._ticker, symbol2, "SecurityToken doesn't get deployed"); + + I_SecurityToken002 = SecurityToken.at(tx.logs[1].args._securityTokenAddress); + + const LogAddModule = await I_SecurityToken002.allEvents(); + const log = await new Promise(function(resolve, reject) { + LogAddModule.watch(function(error, log){ resolve(log);}); + }); + + // Verify that GeneralPermissionManager module get added successfully or not + assert.equal(log.args._type.toNumber(), permissionManagerKey); + assert.equal( + web3.utils.toAscii(log.args._name) + .replace(/\u0000/g, ''), + "GeneralPermissionManager" + ); + LogAddModule.stopWatching(); + }); + + it("Should deploy the st vesrion 3", async() => { + // Step 7: Deploy the STversionProxy contract + + I_STVersion003 = await STVersion002.new(I_GeneralTransferManagerFactory.address, I_GeneralPermissionManagerFactory.address, {from : account_polymath }); + + assert.notEqual( + I_STVersion003.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "STVersion002 contract was not deployed", + ); + await I_SecurityTokenRegistry.setProtocolVersion(I_STVersion003.address, "0.3.0", { from: account_polymath }); + + assert.equal( + web3.utils.toAscii(await I_SecurityTokenRegistry.protocolVersion.call()) + .replace(/\u0000/g, ''), + "0.3.0" + ); + }); + + it("Should register the ticker before the generation of the security token", async () => { + let tx = await I_TickerRegistry.registerTicker(token_owner, "DET3", name2, swarmHash, { from : token_owner }); + assert.equal(tx.logs[0].args._owner, token_owner); + assert.equal(tx.logs[0].args._symbol, "DET3"); + }); + + it("Should generate the new security token with version 3", async() => { + let tx = await I_SecurityTokenRegistry.generateSecurityToken(name2, "DET3", decimals, tokenDetails, { from: token_owner }); + + // Verify the successful generation of the security token + assert.equal(tx.logs[1].args._ticker, "DET3", "SecurityToken doesn't get deployed"); + + I_SecurityToken002 = SecurityToken.at(tx.logs[1].args._securityTokenAddress); + + const LogAddModule = await I_SecurityToken002.allEvents(); + const log = await new Promise(function(resolve, reject) { + LogAddModule.watch(function(error, log){ resolve(log);}); + }); + + // Verify that GeneralPermissionManager module get added successfully or not + assert.equal(log.args._type.toNumber(), permissionManagerKey); + assert.equal( + web3.utils.toAscii(log.args._name) + .replace(/\u0000/g, ''), + "GeneralPermissionManager" + ); + LogAddModule.stopWatching(); + }); + + it("Should intialize the auto attached modules", async () => { + let moduleData = await I_SecurityToken.modules(transferManagerKey, 0); + I_GeneralTransferManager = GeneralTransferManager.at(moduleData[1]); + + assert.notEqual( + I_GeneralTransferManager.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "GeneralTransferManager contract was not deployed", + ); + + moduleData = await I_SecurityToken.modules(permissionManagerKey, 0); + I_GeneralPermissionManager = GeneralPermissionManager.at(moduleData[1]); + + assert.notEqual( + I_GeneralPermissionManager.address.valueOf(), + "0x0000000000000000000000000000000000000000", + "GeneralDelegateManager contract was not deployed", + ); + }); + + it("Should successfully attach the STO factory with the security token", async () => { + let bytesSTO = web3.eth.abi.encodeFunctionCall( + functionSignature, + [ + (latestTime() + duration.seconds(500)), + (latestTime() + duration.days(30)), + cap, + someString, + ]); + + const tx = await I_SecurityToken.addModule( + I_TestSTOFactory.address, + bytesSTO, + (1000 * Math.pow(10, 18)), + (1000 * Math.pow(10, 18)), + false, + { + from: token_owner, + gas: 2500000 + }); + + assert.equal(tx.logs[2].args._type, stoKey, "TestSTO doesn't get deployed"); + assert.equal( + web3.utils.toAscii(tx.logs[2].args._name) + .replace(/\u0000/g, ''), + "TestSTO", + "TestSTOFactory module was not added" + ); + I_DummySTO = DummySTO.at(tx.logs[2].args._module); + }); + }); + + + +}); diff --git a/test/ticker_registry.js b/test/ticker_registry.js index 1e1037a67..579f45cb2 100644 --- a/test/ticker_registry.js +++ b/test/ticker_registry.js @@ -31,7 +31,7 @@ contract('TickerRegistry', accounts => { // investor Details let fromTime = latestTime(); let toTime = latestTime() + duration.days(100); - + let ID_snap; const message = "Transaction Should Fail!!"; @@ -70,16 +70,19 @@ contract('TickerRegistry', accounts => { let endTime; const cap = new BigNumber(10000).times(new BigNumber(10).pow(18)); const rate = 1000; - + before(async() => { // Accounts setup account_polymath = accounts[0]; account_issuer = accounts[1]; account_temp = accounts[8]; token_owner = account_issuer; - + // ----------- POLYMATH NETWORK Configuration ------------ + // Step 0: Deploy the Polytoken Contract + I_PolyToken = await PolyToken.new(); + // STEP 1: Deploy the ModuleRegistry I_ModuleRegistry = await ModuleRegistry.new({from:account_polymath}); @@ -92,7 +95,7 @@ contract('TickerRegistry', accounts => { // STEP 2: Deploy the GeneralTransferManagerFactory - I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new({from:account_polymath}); + I_GeneralTransferManagerFactory = await GeneralTransferManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralTransferManagerFactory.address.valueOf(), @@ -102,7 +105,7 @@ contract('TickerRegistry', accounts => { // STEP 3: Deploy the GeneralDelegateManagerFactory - I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new({from:account_polymath}); + I_GeneralPermissionManagerFactory = await GeneralPermissionManagerFactory.new(I_PolyToken.address, {from:account_polymath}); assert.notEqual( I_GeneralPermissionManagerFactory.address.valueOf(), @@ -140,9 +143,6 @@ contract('TickerRegistry', accounts => { "STVersion contract was not deployed", ); - // Step ANY: Deploy the Polytoken Contract - I_PolyToken = await PolyToken.new(); - // Step 8: Deploy the SecurityTokenRegistry I_SecurityTokenRegistry = await SecurityTokenRegistry.new( @@ -176,7 +176,7 @@ contract('TickerRegistry', accounts => { }); describe("Test cases for the TickerRegistry public variable", async () => { - + it("verify the securityTokenRegistry address", async() => { let str = await I_TickerRegistry.strAddress.call(); assert.equal(str, I_SecurityTokenRegistry.address); @@ -189,7 +189,7 @@ contract('TickerRegistry', accounts => { }); describe("Test cases for the registerTicker function", async() => { - + it("Should fail in regestering the ticker due to the symbol length is 0", async() => { let errorThrown = false; try { @@ -242,7 +242,7 @@ contract('TickerRegistry', accounts => { }); describe("test cases for the expiry limit", async() => { - + it("Should fail to set the expiry limit because msg.sender is not owner", async() => { let errorThrown = false; try { @@ -254,7 +254,7 @@ contract('TickerRegistry', accounts => { } assert.ok(errorThrown, message); }); - + it("Should successfully set the expiry limit", async() => { await I_TickerRegistry.changeExpiryLimit(duration.days(10), {from: account_polymath}); assert.equal( @@ -278,7 +278,7 @@ contract('TickerRegistry', accounts => { }); describe("Test cases for the setTokenRegistry", async() => { - + it("Should fail to set the TokenRegistry", async() => { let errorThrown = false; try { @@ -303,7 +303,7 @@ contract('TickerRegistry', accounts => { .replace(/\u0000/g, ''), swarmHash ); - assert.equal(tx[4], false); + assert.equal(tx[4], false); }); }); @@ -321,4 +321,4 @@ contract('TickerRegistry', accounts => { assert.ok(errorThrown, message); }); }); -}); \ No newline at end of file +});