diff --git a/contracts/STRGetter.sol b/contracts/STRGetter.sol index e81f90b40..62ca4955f 100644 --- a/contracts/STRGetter.sol +++ b/contracts/STRGetter.sol @@ -171,12 +171,14 @@ contract STRGetter is EternalStorage { uint256 expiryDate = getUintValue(Encoder.getKey("registeredTickers_expiryDate", ticker)); /*solium-disable-next-line security/no-block-members*/ if ((tickerStatus == true) || (expiryDate > now)) { + address stAddress = getAddressValue(Encoder.getKey("tickerToSecurityToken", ticker)); + string memory tokenName = stAddress == address(0) ? "" : ISecurityToken(stAddress).name(); return ( getTickerOwner(ticker), getUintValue(Encoder.getKey("registeredTickers_registrationDate", ticker)), expiryDate, - getStringValue(Encoder.getKey("registeredTickers_tokenName", ticker)), + tokenName, tickerStatus ); } else { diff --git a/contracts/SecurityTokenRegistry.sol b/contracts/SecurityTokenRegistry.sol index 121c4a637..986d1ba49 100644 --- a/contracts/SecurityTokenRegistry.sol +++ b/contracts/SecurityTokenRegistry.sol @@ -53,7 +53,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { address owner; uint256 registrationDate; uint256 expiryDate; - string tokenName; + string tokenName; //Not stored since 3.0.0 bool status; } @@ -126,8 +126,16 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { uint256 _registrationFee ); // Emit after ticker registration - // _registrationFee is in poly - // fee in usd is not being emitted to maintain backwards compatibility + event RegisterTicker( + address indexed _owner, + string _ticker, + uint256 indexed _registrationDate, + uint256 indexed _expiryDate, + bool _fromAdmin, + uint256 _registrationFeePoly, + uint256 _registrationFeeUsd + ); + // For backwards compatibility event RegisterTicker( address indexed _owner, string _ticker, @@ -308,13 +316,12 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice its ownership. If the ticker expires and its issuer hasn't used it, then someone else can take it. * @param _owner is address of the owner of the token * @param _ticker is unique token ticker - * @param _tokenName is the name of the token */ - function registerTicker(address _owner, string memory _ticker, string memory _tokenName) public whenNotPausedOrOwner { + function registerNewTicker(address _owner, string memory _ticker) public whenNotPausedOrOwner { require(_owner != address(0), "Bad address"); require(bytes(_ticker).length > 0 && bytes(_ticker).length <= 10, "Bad ticker"); // Attempt to charge the reg fee if it is > 0 USD - (, uint256 _polyFee) = _takeFee(TICKERREGFEE); + (uint256 usdFee, uint256 polyFee) = _takeFee(TICKERREGFEE); string memory ticker = Util.upper(_ticker); require(_tickerAvailable(ticker), "Ticker reserved"); // Check whether ticker was previously registered (and expired) @@ -323,7 +330,16 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { _deleteTickerOwnership(previousOwner, ticker); } /*solium-disable-next-line security/no-block-members*/ - _addTicker(_owner, ticker, _tokenName, now, now.add(getUintValue(EXPIRYLIMIT)), false, false, _polyFee); + _addTicker(_owner, ticker, now, now.add(getUintValue(EXPIRYLIMIT)), false, false, polyFee, usdFee); + } + + /** + * @dev This function is just for backwards compatibility + */ + function registerTicker(address _owner, string calldata _ticker, string calldata _tokenName) external { + registerNewTicker(_owner, _ticker); + (, uint256 polyFee) = getFees(TICKERREGFEE); + emit RegisterTicker(_owner, _ticker, _tokenName, now, now.add(getUintValue(EXPIRYLIMIT)), false, polyFee); } /** @@ -332,18 +348,18 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { function _addTicker( address _owner, string memory _ticker, - string memory _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status, bool _fromAdmin, - uint256 _polyFee + uint256 _polyFee, + uint256 _usdFee ) internal { _setTickerOwnership(_owner, _ticker); - _storeTickerDetails(_ticker, _owner, _registrationDate, _expiryDate, _tokenName, _status); - emit RegisterTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _fromAdmin, _polyFee); + _storeTickerDetails(_ticker, _owner, _registrationDate, _expiryDate, _status); + emit RegisterTicker(_owner, _ticker, _registrationDate, _expiryDate, _fromAdmin, _polyFee, _usdFee); } /** @@ -351,15 +367,13 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { * @notice Only allowed to modify the tickers which are not yet deployed. * @param _owner is the owner of the token * @param _ticker is the token ticker - * @param _tokenName is the name of the token * @param _registrationDate is the date at which ticker is registered * @param _expiryDate is the expiry date for the ticker * @param _status is the token deployment status */ - function modifyTicker( + function modifyExistingTicker( address _owner, string memory _ticker, - string memory _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status @@ -372,7 +386,24 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { require(_registrationDate <= _expiryDate, "Bad dates"); require(_owner != address(0), "Bad address"); string memory ticker = Util.upper(_ticker); - _modifyTicker(_owner, ticker, _tokenName, _registrationDate, _expiryDate, _status); + _modifyTicker(_owner, ticker, _registrationDate, _expiryDate, _status); + } + + /** + * @dev This function is just for backwards compatibility + */ + function modifyTicker( + address _owner, + string calldata _ticker, + string calldata _tokenName, + uint256 _registrationDate, + uint256 _expiryDate, + bool _status + ) + external + { + modifyExistingTicker(_owner, _ticker, _registrationDate, _expiryDate, _status); + emit RegisterTicker(_owner, _ticker, _tokenName, now, now.add(getUintValue(EXPIRYLIMIT)), false, 0); } /** @@ -381,7 +412,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { function _modifyTicker( address _owner, string memory _ticker, - string memory _tokenName, uint256 _registrationDate, uint256 _expiryDate, bool _status @@ -399,7 +429,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { if (_status) { require(getAddressValue(Encoder.getKey("tickerToSecurityToken", _ticker)) != address(0), "Not registered"); } - _addTicker(_owner, _ticker, _tokenName, _registrationDate, _expiryDate, _status, true, uint256(0)); + _addTicker(_owner, _ticker, _registrationDate, _expiryDate, _status, true, uint256(0), uint256(0)); } function _tickerOwner(string memory _ticker) internal view returns(address) { @@ -416,7 +446,7 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { require(owner != address(0), "Bad ticker"); _deleteTickerOwnership(owner, ticker); set(Encoder.getKey("tickerToSecurityToken", ticker), address(0)); - _storeTickerDetails(ticker, address(0), 0, 0, "", false); + _storeTickerDetails(ticker, address(0), 0, 0, false); /*solium-disable-next-line security/no-block-members*/ emit TickerRemoved(ticker, msg.sender); } @@ -465,7 +495,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { address _owner, uint256 _registrationDate, uint256 _expiryDate, - string memory _tokenName, bool _status ) internal @@ -476,8 +505,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { set(key, _registrationDate); key = Encoder.getKey("registeredTickers_expiryDate", _ticker); set(key, _expiryDate); - key = Encoder.getKey("registeredTickers_tokenName", _ticker); - set(key, _tokenName); key = Encoder.getKey("registeredTickers_status", _ticker); set(key, _status); } @@ -665,15 +692,13 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { /** * @notice Adds a new custom Security Token and saves it to the registry. (Token should follow the ISecurityToken interface) - * @param _name is the name of the token * @param _ticker is the ticker symbol of the security token * @param _owner is the owner of the token * @param _securityToken is the address of the securityToken * @param _tokenDetails is the off-chain details of the token * @param _deployedAt is the timestamp at which the security token is deployed */ - function modifySecurityToken( - string memory _name, + function modifyExistingSecurityToken( string memory _ticker, address _owner, address _securityToken, @@ -683,7 +708,6 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { public onlyOwner { - require(bytes(_name).length > 0 && bytes(_ticker).length > 0, "Bad data"); require(bytes(_ticker).length <= 10, "Bad ticker"); require(_deployedAt != 0 && _owner != address(0), "Bad data"); string memory ticker = Util.upper(_ticker); @@ -696,13 +720,29 @@ contract SecurityTokenRegistry is EternalStorage, Proxy { expiryTime = registrationTime.add(getUintValue(EXPIRYLIMIT)); } set(Encoder.getKey("tickerToSecurityToken", ticker), _securityToken); - _modifyTicker(_owner, ticker, _name, registrationTime, expiryTime, true); + _modifyTicker(_owner, ticker, registrationTime, expiryTime, true); _storeSecurityTokenData(_securityToken, ticker, _tokenDetails, _deployedAt); emit NewSecurityTokenCreated( - ticker, _name, _securityToken, _owner, _deployedAt, msg.sender, true, uint256(0), uint256(0), 0 + ticker, ISecurityToken(_securityToken).name(), _securityToken, _owner, _deployedAt, msg.sender, true, uint256(0), uint256(0), 0 ); } + /** + * @dev This function is just for backwards compatibility + */ + function modifySecurityToken( + string calldata /* */, + string calldata _ticker, + address _owner, + address _securityToken, + string calldata _tokenDetails, + uint256 _deployedAt + ) + external + { + modifyExistingSecurityToken(_ticker, _owner, _securityToken, _tokenDetails, _deployedAt); + } + /** * @notice Internal - Stores the security token details */ diff --git a/contracts/interfaces/ISecurityToken.sol b/contracts/interfaces/ISecurityToken.sol index 7fba2be46..437996171 100644 --- a/contracts/interfaces/ISecurityToken.sol +++ b/contracts/interfaces/ISecurityToken.sol @@ -17,6 +17,8 @@ interface ISecurityToken { event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); + function name() external view returns(string memory); + /** * @notice Transfers of securities may fail for a number of reasons. So this function will used to understand the * cause of failure by getting the byte value. Which will be the ESC that follows the EIP 1066. ESC can be mapped @@ -571,7 +573,7 @@ interface ISecurityToken { * but it doesn't mean we operator is allowed to transfer the LOCKED partition values. * Logic for this restriction is written in `operatorTransferByPartition()` function. * @param _operator An address which is being authorised. - */ + */ function authorizeOperator(address _operator) external; /** @@ -614,7 +616,7 @@ interface ISecurityToken { uint256 _value, bytes calldata _data, bytes calldata _operatorData - ) + ) external returns (bytes32); diff --git a/test/b_capped_sto.js b/test/b_capped_sto.js index c3fa37848..3ff38baa9 100644 --- a/test/b_capped_sto.js +++ b/test/b_capped_sto.js @@ -171,7 +171,7 @@ contract("CappedSTO", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol); }); @@ -624,7 +624,7 @@ contract("CappedSTO", async (accounts) => { describe("Launch a new SecurityToken", async () => { it("POLY: Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, P_symbol, P_name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, P_symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, P_symbol); }); diff --git a/test/c_checkpoints.js b/test/c_checkpoints.js index 53023e32b..6160e4316 100644 --- a/test/c_checkpoints.js +++ b/test/c_checkpoints.js @@ -119,7 +119,7 @@ contract("Checkpoints", async function(accounts) { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/d_count_transfer_manager.js b/test/d_count_transfer_manager.js index 669195e1b..fea69d249 100644 --- a/test/d_count_transfer_manager.js +++ b/test/d_count_transfer_manager.js @@ -135,7 +135,7 @@ contract("CountTransferManager", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); @@ -361,7 +361,7 @@ contract("CountTransferManager", async (accounts) => { it("deploy a new token & auto attach modules", async () => { //register ticker and deploy token await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol2, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol2, { from: token_owner }); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); diff --git a/test/e_erc20_dividends.js b/test/e_erc20_dividends.js index db1611619..d54a52abc 100644 --- a/test/e_erc20_dividends.js +++ b/test/e_erc20_dividends.js @@ -143,7 +143,7 @@ contract("ERC20DividendCheckpoint", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/f_ether_dividends.js b/test/f_ether_dividends.js index ef4f52758..15f71b2c6 100644 --- a/test/f_ether_dividends.js +++ b/test/f_ether_dividends.js @@ -136,7 +136,7 @@ contract("EtherDividendCheckpoint", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/g_general_permission_manager.js b/test/g_general_permission_manager.js index a507e983a..95b9edadb 100644 --- a/test/g_general_permission_manager.js +++ b/test/g_general_permission_manager.js @@ -134,7 +134,7 @@ contract("GeneralPermissionManager", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); @@ -324,7 +324,7 @@ contract("GeneralPermissionManager", async (accounts) => { it("Should create a new token and add some more delegates, then get them", async() => { await I_PolyToken.getTokens(web3.utils.toWei("500", "ether"), token_owner); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx1 = await I_STRProxied.registerTicker(token_owner, "DEL", contact, { from: token_owner }); + let tx1 = await I_STRProxied.registerNewTicker(token_owner, "DEL", { from: token_owner }); assert.equal(tx1.logs[0].args._owner, token_owner); assert.equal(tx1.logs[0].args._ticker, "DEL"); diff --git a/test/h_general_transfer_manager.js b/test/h_general_transfer_manager.js index 4171db525..829108bfc 100644 --- a/test/h_general_transfer_manager.js +++ b/test/h_general_transfer_manager.js @@ -165,7 +165,7 @@ contract("GeneralTransferManager", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/i_Issuance.js b/test/i_Issuance.js index 5d88c33f5..0044d8c7e 100644 --- a/test/i_Issuance.js +++ b/test/i_Issuance.js @@ -147,7 +147,7 @@ contract("Issuance", async (accounts) => { it("POLYMATH: Should register the ticker before the generation of the security token", async () => { await I_PolyToken.getTokens(new BN(10000).mul(new BN(10).pow(new BN(18))), account_polymath); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_polymath }); - let tx = await I_STRProxied.registerTicker(account_polymath, symbol, name, { from: account_polymath }); + let tx = await I_STRProxied.registerNewTicker(account_polymath, symbol, { from: account_polymath }); assert.equal(tx.logs[0].args._owner, account_polymath); assert.equal(tx.logs[0].args._ticker, symbol); }); diff --git a/test/j_manual_approval_transfer_manager.js b/test/j_manual_approval_transfer_manager.js index b4de0060d..e14823479 100644 --- a/test/j_manual_approval_transfer_manager.js +++ b/test/j_manual_approval_transfer_manager.js @@ -144,7 +144,7 @@ contract("ManualApprovalTransferManager", accounts => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/k_module_registry.js b/test/k_module_registry.js index 2acabae44..52eb0e2b9 100644 --- a/test/k_module_registry.js +++ b/test/k_module_registry.js @@ -305,7 +305,7 @@ contract("ModuleRegistry", async (accounts) => { it("Deploy the securityToken", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), account_issuer); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: account_issuer }); - await I_STRProxied.registerTicker(account_issuer, symbol, name, { from: account_issuer }); + await I_STRProxied.registerNewTicker(account_issuer, symbol, { from: account_issuer }); let tx = await I_STRProxied.generateNewSecurityToken(name, symbol, tokenDetails, true, account_issuer, 0, { from: account_issuer }); assert.equal(tx.logs[1].args._ticker, symbol.toUpperCase()); I_SecurityToken = await SecurityToken.at(tx.logs[1].args._securityTokenAddress); @@ -411,7 +411,7 @@ contract("ModuleRegistry", async (accounts) => { let newSymbol = "toro"; await I_PolyToken.getTokens(new BN(web3.utils.toWei("2000")), account_issuer); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: account_issuer }); - await I_STRProxied.registerTicker(account_issuer, newSymbol, name, { from: account_issuer }); + await I_STRProxied.registerNewTicker(account_issuer, newSymbol, { from: account_issuer }); let tx = await I_STRProxied.generateNewSecurityToken(name, newSymbol, tokenDetails, true, account_issuer, 0, { from: account_issuer }); assert.equal(tx.logs[1].args._ticker, newSymbol.toUpperCase()); I_SecurityToken2 = await SecurityToken.at(tx.logs[1].args._securityTokenAddress); diff --git a/test/l_percentage_transfer_manager.js b/test/l_percentage_transfer_manager.js index 985d7111e..05e1c1e3e 100644 --- a/test/l_percentage_transfer_manager.js +++ b/test/l_percentage_transfer_manager.js @@ -158,7 +158,7 @@ contract("PercentageTransferManager", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/m_presale_sto.js b/test/m_presale_sto.js index 22723ae71..de863d496 100644 --- a/test/m_presale_sto.js +++ b/test/m_presale_sto.js @@ -134,7 +134,7 @@ contract("PreSaleSTO", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol); }); diff --git a/test/n_security_token_registry.js b/test/n_security_token_registry.js index 2629f098c..3699d2232 100644 --- a/test/n_security_token_registry.js +++ b/test/n_security_token_registry.js @@ -294,7 +294,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to register ticker if tickerRegFee not approved", async () => { await catchRevert( - I_STRProxied.registerTicker(account_temp, symbol, name, { from: account_temp }), + I_STRProxied.registerNewTicker(account_temp, symbol, { from: account_temp }), "tx revert -> POLY allowance not provided for registration fee" ); }); @@ -304,29 +304,28 @@ contract("SecurityTokenRegistry", async (accounts) => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: account_temp }); await catchRevert( - I_STRProxied.registerTicker(address_zero, symbol, name, { from: account_temp }), + I_STRProxied.registerNewTicker(address_zero, symbol, { from: account_temp }), "tx revert -> owner should not be 0x" ); }); it("Should fail to register ticker due to the symbol length is 0", async () => { - await catchRevert(I_STRProxied.registerTicker(account_temp, "", name, { from: account_temp }), "tx revert -> Symbol Length is 0"); + await catchRevert(I_STRProxied.registerNewTicker(account_temp, "", { from: account_temp }), "tx revert -> Symbol Length is 0"); }); it("Should fail to register ticker due to the symbol length is greater than 10", async () => { await catchRevert( - I_STRProxied.registerTicker(account_temp, "POLYMATHNET", name, { from: account_temp }), + I_STRProxied.registerNewTicker(account_temp, "POLYMATHNET", { from: account_temp }), "tx revert -> Symbol Length is greater than 10" ); }); it("Should register the ticker before the generation of the security token", async () => { - let tx = await I_STRProxied.registerTicker(account_temp, symbol, name, { from: account_temp }); + let tx = await I_STRProxied.registerNewTicker(account_temp, symbol, { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, symbol, `Symbol should be ${symbol}`); let data = await I_Getter.getTickerDetails.call(symbol); assert.equal(data[0], account_temp); - assert.equal(data[3], name); // trying to access the function data directly from the STRGetter then it should give all values zero data = await I_STRGetter.getTickerDetails.call(symbol); assert.equal(data[0], address_zero); @@ -389,7 +388,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker when the tickerRegFee is 0", async () => { let snap_Id = await takeSnapshot(); await I_STRProxied.changeTickerRegistrationFee(0, { from: account_polymath }); - let tx = await I_STRProxied.registerTicker(account_temp, "ZERO", name, { from: account_temp }); + let tx = await I_STRProxied.registerNewTicker(account_temp, "ZERO", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "ZERO", `Symbol should be ZERO`); await revertToSnapshot(snap_Id); @@ -401,7 +400,7 @@ contract("SecurityTokenRegistry", async (accounts) => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); // Call registration function await catchRevert( - I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }), + I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }), "tx revert -> Symbol is already alloted to someone else" ); }); @@ -409,7 +408,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should successfully register pre registerd ticker if expiry is reached", async () => { await increaseTime(5184000 + 100); // 60(5184000) days of expiry + 100 sec for buffer await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Owner should be the ${token_owner}`); assert.equal(tx.logs[0].args._ticker, symbol, `Symbol should be ${symbol}`); }); @@ -419,7 +418,7 @@ contract("SecurityTokenRegistry", async (accounts) => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( - I_STRProxied.registerTicker(token_owner, "AAA", name, { from: token_owner }), + I_STRProxied.registerNewTicker(token_owner, "AAA", { from: token_owner }), "tx revert -> Registration is paused" ); }); @@ -431,7 +430,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should successfully register ticker if registration is unpaused", async () => { await I_STRProxied.unpause({ from: account_polymath }); await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, "AAA", name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, "AAA", { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Owner should be the ${token_owner}`); assert.equal(tx.logs[0].args._ticker, "AAA", `Symbol should be AAA`); }); @@ -467,7 +466,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should get the details of the symbol", async () => { let tx = await I_Getter.getTickerDetails.call(symbol); assert.equal(tx[0], token_owner, "Should equal to the rightful owner of the ticker"); - assert.equal(tx[3], name, `Name of the token should equal to ${name}`); + assert.equal(tx[3], "", "Name of the token should equal be null/empty as it's not stored anymore"); assert.equal(tx[4], false, "Status if the symbol should be undeployed -- false"); }); @@ -483,7 +482,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should get the ticker details successfully and prove the data is not storing in to the logic contract", async () => { let data = await I_Getter.getTickerDetails(symbol, { from: token_owner }); assert.equal(data[0], token_owner, "Token owner should be equal"); - assert.equal(data[3], name, "Name of the token should match with the registered symbol infor"); + assert.equal(data[3], "", "Name of the token should equal be null/empty as it's not stored anymore"); assert.equal(data[4], false, "Token is not launched yet so it should return False"); data = await I_STRGetter.getTickerDetails(symbol, { from: token_owner }); console.log("This is the data from the original securityTokenRegistry contract"); @@ -578,7 +577,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to generate the SecurityToken because ticker gets expired", async () => { let snap_Id = await takeSnapshot(); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, "CCC", { from: token_owner }); await increaseTime(duration.days(65)); await catchRevert( I_STRProxied.generateNewSecurityToken(name, "CCC", tokenDetails, false, treasury_wallet, 0, { from: token_owner }), @@ -592,7 +591,7 @@ contract("SecurityTokenRegistry", async (accounts) => { await I_STRProxied.changeSecurityLaunchFee(0, { from: account_polymath }); await I_STRProxied.changeTickerRegistrationFee(0, { from: account_polymath }); //await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); - await I_STRProxied.registerTicker(token_owner, "CCC", name, { from: token_owner }); + await I_STRProxied.registerNewTicker(token_owner, "CCC", { from: token_owner }); await I_STRProxied.generateNewSecurityToken(name, "CCC", tokenDetails, false, treasury_wallet, 0, { from: token_owner }), await revertToSnapshot(snap_Id); }); @@ -601,7 +600,7 @@ contract("SecurityTokenRegistry", async (accounts) => { let snap_Id = await takeSnapshot(); await I_PolyToken.getTokens(web3.utils.toWei("2000"), account_temp); await I_PolyToken.approve(I_STRProxied.address, web3.utils.toWei("2000"), { from: account_temp }); - await I_STRProxied.registerTicker(account_temp, "TMP", name, { from: account_temp }); + await I_STRProxied.registerNewTicker(account_temp, "TMP", { from: account_temp }); let tx = await I_STRProxied.generateNewSecurityToken(name, "TMP", tokenDetails, false, account_temp, 0, { from: account_temp }); // Verify the successful generation of the security token @@ -668,7 +667,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol2, name2, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol2, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Token owner should be ${token_owner}`); assert.equal(tx.logs[0].args._ticker, symbol2, `Symbol should be ${symbol2}`); }); @@ -759,7 +758,7 @@ contract("SecurityTokenRegistry", async (accounts) => { describe("Generate custom tokens", async () => { it("Should fail if msg.sender is not polymath", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { + I_STRProxied.modifyExistingSecurityToken("LOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_delegate }), "tx revert -> msg.sender is not polymath account" @@ -768,7 +767,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to genrate the custom security token -- ticker length is greater than 10 chars", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", currentTime, { + I_STRProxied.modifyExistingSecurityToken("LOGLOGLOGLOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> ticker length is greater than 10 chars" @@ -777,7 +776,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to generate the custom security token -- name should not be 0 length ", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { + I_STRProxied.modifyExistingSecurityToken("LOG", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> name should not be 0 length" @@ -786,7 +785,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail if ST address is 0 address", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, address_zero, "I am custom ST", currentTime, { + I_STRProxied.modifyExistingSecurityToken("LOG", account_temp, address_zero, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> Security token address is 0" @@ -795,7 +794,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail if symbol length is 0", async () => { await catchRevert( - I_STRProxied.modifySecurityToken("", "0x0", account_temp, dummy_token, "I am custom ST", currentTime, { + I_STRProxied.modifyExistingSecurityToken("0x0", account_temp, dummy_token, "I am custom ST", currentTime, { from: account_polymath }), "tx revert -> zero length of the symbol is not allowed" @@ -804,7 +803,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to generate the custom ST -- deployedAt param is 0", async () => { await catchRevert( - I_STRProxied.modifySecurityToken(name2, symbol2, token_owner, dummy_token, "I am custom ST", new BN(0), { from: account_polymath }), + I_STRProxied.modifyExistingSecurityToken(symbol2, token_owner, dummy_token, "I am custom ST", new BN(0), { from: account_polymath }), "tx revert -> because deployedAt param is 0" ); }); @@ -815,11 +814,11 @@ contract("SecurityTokenRegistry", async (accounts) => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: account_temp }); let tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); console.log(tickersListArray); - await I_STRProxied.registerTicker(account_temp, "LOG", "LOGAN", { from: account_temp }); + await I_STRProxied.registerNewTicker(account_temp, "LOG", { from: account_temp }); tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); console.log(tickersListArray); // Generating the ST - let tx = await I_STRProxied.modifySecurityToken("LOGAN", "LOG", account_temp, dummy_token, "I am custom ST", currentTime, { + let tx = await I_STRProxied.modifyExistingSecurityToken("LOG", account_temp, I_SecurityToken.address, "I am custom ST", currentTime, { from: account_polymath }); tickersListArray = await I_Getter.getTickersByOwner.call(account_temp); @@ -827,42 +826,35 @@ contract("SecurityTokenRegistry", async (accounts) => { assert.equal(tx.logs[1].args._ticker, "LOG", "Symbol should match with the registered symbol"); assert.equal( tx.logs[1].args._securityTokenAddress, - dummy_token, + I_SecurityToken.address, `Address of the SecurityToken should be matched with the input value of addCustomSecurityToken` ); - let symbolDetails = await I_Getter.getTickerDetails("LOG"); - assert.equal(symbolDetails[0], account_temp, `Owner of the symbol should be ${account_temp}`); - assert.equal(symbolDetails[3], "LOGAN", `Name of the symbol should be LOGAN`); }); it("Should successfully generate the custom token", async () => { // Fulfilling the TickerStatus.NN condition // - // await catchRevert(I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", await latestTime(), {from: account_polymath})); - // await I_STRProxied.modifyTicker(account_temp, "LOG2", "LOGAN2", await latestTime(), currentTime.add(new BN(duration.days(10))), false, {from: account_polymath}); + // await catchRevert(I_STRProxied.modifyExistingSecurityToken("LOG2", account_temp, dummy_token, "I am custom ST", await latestTime(), {from: account_polymath})); + // await I_STRProxied.modifyExistingTicker(account_temp, "LOG2", await latestTime(), currentTime.add(new BN(duration.days(10))), false, {from: account_polymath}); // await increaseTime(duration.days(1)); - let tx = await I_STRProxied.modifySecurityToken("LOGAN2", "LOG2", account_temp, dummy_token, "I am custom ST", currentTime, { + let tx = await I_STRProxied.modifyExistingSecurityToken("LOG2", account_temp, I_SecurityToken.address, "I am custom ST", currentTime, { from: account_polymath }); assert.equal(tx.logs[1].args._ticker, "LOG2", "Symbol should match with the registered symbol"); assert.equal( tx.logs[1].args._securityTokenAddress, - dummy_token, + I_SecurityToken.address, `Address of the SecurityToken should be matched with the input value of addCustomSecurityToken` ); assert.equal(tx.logs[0].args._owner, account_temp, `Token owner should be ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "LOG2", `Symbol should be LOG2`); - let symbolDetails = await I_Getter.getTickerDetails("LOG2"); - assert.equal(symbolDetails[0], account_temp, `Owner of the symbol should be ${account_temp}`); - assert.equal(symbolDetails[3], "LOGAN2", `Name of the symbol should be LOGAN`); }); it("Should successfully modify the ticker", async () => { let snap_Id = await takeSnapshot(); - let tx = await I_STRProxied.modifyTicker( + let tx = await I_STRProxied.modifyExistingTicker( account_temp, "LOG2", - "LOGAN2", currentTime, currentTime.add(new BN(duration.days(60))), false, @@ -876,7 +868,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the custom ticker --failed because of bad owner", async () => { currentTime = new BN(await latestTime()); await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", currentTime, currentTime.add(new BN(duration.days(10))), false, { + I_STRProxied.modifyExistingTicker(token_owner, "ETH", currentTime, currentTime.add(new BN(duration.days(10))), false, { from: account_temp }), "tx revert -> failed beacause of bad owner0" @@ -885,7 +877,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the custom ticker --fail ticker length should not be 0", async () => { await catchRevert( - I_STRProxied.modifyTicker(token_owner, "", "Ether", currentTime, currentTime.add(new BN(duration.days(10))), false, { + I_STRProxied.modifyExistingTicker(token_owner, "", currentTime, currentTime.add(new BN(duration.days(10))), false, { from: account_polymath }), "tx revert -> failed beacause ticker length should not be 0" @@ -894,7 +886,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the custom ticker --failed because time should not be 0", async () => { await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", new BN(0), currentTime.add(new BN(duration.days(10))), false, { + I_STRProxied.modifyExistingTicker(token_owner, "ETH", new BN(0), currentTime.add(new BN(duration.days(10))), false, { from: account_polymath }), "tx revert -> failed because time should not be 0" @@ -904,7 +896,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the custom ticker --failed because registeration date is greater than the expiryDate", async () => { let ctime = currentTime; await catchRevert( - I_STRProxied.modifyTicker(token_owner, "ETH", "Ether", ctime, ctime.sub(new BN(duration.minutes(10))), false, { + I_STRProxied.modifyExistingTicker(token_owner, "ETH", ctime, ctime.sub(new BN(duration.minutes(10))), false, { from: account_polymath }), "tx revert -> failed because registeration date is greater than the expiryDate" @@ -914,10 +906,9 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the custom ticker --failed because owner should not be 0x", async () => { let ctime = currentTime; await catchRevert( - I_STRProxied.modifyTicker( + I_STRProxied.modifyExistingTicker( address_zero, "ETH", - "Ether", ctime, ctime.add(new BN(duration.minutes(10))), false, @@ -929,10 +920,9 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should add the new custom ticker", async () => { let ctime = currentTime; - let tx = await I_STRProxied.modifyTicker( + let tx = await I_STRProxied.modifyExistingTicker( account_temp, "ETH", - "Ether", ctime, ctime.add(new BN(duration.minutes(10))), false, @@ -944,10 +934,9 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should change the details of the existing ticker", async () => { let ctime = currentTime; - let tx = await I_STRProxied.modifyTicker( + let tx = await I_STRProxied.modifyExistingTicker( token_owner, "ETH", - "Ether", ctime, ctime.add(new BN(duration.minutes(10))), false, @@ -985,7 +974,6 @@ contract("SecurityTokenRegistry", async (accounts) => { assert.equal(tx.logs[0].args._newOwner, account_temp); let symbolDetails = await I_Getter.getTickerDetails.call(symbol2); assert.equal(symbolDetails[0], account_temp, `Owner of the symbol should be ${account_temp}`); - assert.equal(symbolDetails[3], name2, `Name of the symbol should be ${name2}`); }); }); @@ -1094,7 +1082,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should fail to register the ticker with the old fee", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); await catchRevert( - I_STRProxied.registerTicker(token_owner, "POLY", "Polymath", { from: token_owner }), + I_STRProxied.registerNewTicker(token_owner, "POLY", { from: token_owner }), "tx revert -> failed because of ticker registeration fee gets change" ); }); @@ -1102,7 +1090,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker with the new fee", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), token_owner); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("2000")), { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, "POLY", "Polymath", { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, "POLY", { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, `Token owner should be ${token_owner}`); assert.equal(tx.logs[0].args._ticker, "POLY", `Symbol should be POLY`); }); @@ -1215,7 +1203,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should get the security token data", async () => { let data = await I_Getter.getSecurityTokenData.call(I_SecurityToken.address); - assert.equal(data[0], symbol); + assert.equal(data[0], "LOG2"); assert.equal(data[1], token_owner); }); @@ -1254,7 +1242,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker 1", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK1", "0x0", { from: account_temp }); + let tx = await I_STRProxied.registerNewTicker(account_temp, "TOK1", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK1", `Symbol should be TOK1`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); @@ -1263,7 +1251,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker 2", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK2", "0x0", { from: account_temp }); + let tx = await I_STRProxied.registerNewTicker(account_temp, "TOK2", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK2", `Symbol should be TOK2`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); @@ -1272,7 +1260,7 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should register the ticker 3", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("1600")), account_temp); await I_PolyToken.approve(I_STRProxied.address, new BN(web3.utils.toWei("1600")), { from: account_temp }); - let tx = await I_STRProxied.registerTicker(account_temp, "TOK3", "0x0", { from: account_temp }); + let tx = await I_STRProxied.registerNewTicker(account_temp, "TOK3", { from: account_temp }); assert.equal(tx.logs[0].args._owner, account_temp, `Owner should be the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK3", `Symbol should be TOK3`); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); @@ -1286,10 +1274,9 @@ contract("SecurityTokenRegistry", async (accounts) => { it("Should modify ticker 1", async () => { currentTime = new BN(await latestTime()); - let tx = await I_STRProxied.modifyTicker( + let tx = await I_STRProxied.modifyExistingTicker( account_temp, "TOK1", - "TOKEN 1", currentTime, currentTime.add(new BN(duration.minutes(10))), false, @@ -1297,15 +1284,13 @@ contract("SecurityTokenRegistry", async (accounts) => { ); assert.equal(tx.logs[0].args._owner, account_temp, `Should be equal to the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK1", "Should be equal to TOK1"); - assert.equal(tx.logs[0].args._name, "TOKEN 1", "Should be equal to TOKEN 1"); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); }); it("Should modify ticker 3", async () => { - let tx = await I_STRProxied.modifyTicker( + let tx = await I_STRProxied.modifyExistingTicker( account_temp, "TOK3", - "TOKEN 3", currentTime, currentTime.add(new BN(duration.minutes(10))), false, @@ -1313,7 +1298,6 @@ contract("SecurityTokenRegistry", async (accounts) => { ); assert.equal(tx.logs[0].args._owner, account_temp, `Should be equal to the ${account_temp}`); assert.equal(tx.logs[0].args._ticker, "TOK3", "Should be equal to TOK3"); - assert.equal(tx.logs[0].args._name, "TOKEN 3", "Should be equal to TOKEN 3"); console.log((await I_Getter.getTickersByOwner.call(account_temp)).map(x => web3.utils.toUtf8(x))); }); }); diff --git a/test/o_security_token.js b/test/o_security_token.js index 780cee7c4..d95358f66 100644 --- a/test/o_security_token.js +++ b/test/o_security_token.js @@ -183,7 +183,7 @@ contract("SecurityToken", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol); }); diff --git a/test/p_usd_tiered_sto.js b/test/p_usd_tiered_sto.js index 9148dfe7a..f75343b20 100644 --- a/test/p_usd_tiered_sto.js +++ b/test/p_usd_tiered_sto.js @@ -277,7 +277,7 @@ contract("USDTieredSTO", async (accounts) => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.getTokens(REGFEE, ISSUER); await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER }); - let tx = await I_STRProxied.registerTicker(ISSUER, SYMBOL, NAME, { from: ISSUER }); + let tx = await I_STRProxied.registerNewTicker(ISSUER, SYMBOL, { from: ISSUER }); assert.equal(tx.logs[0].args._owner, ISSUER); assert.equal(tx.logs[0].args._ticker, SYMBOL); }); diff --git a/test/q_usd_tiered_sto_sim.js b/test/q_usd_tiered_sto_sim.js index b19d6cb5c..7364f813d 100644 --- a/test/q_usd_tiered_sto_sim.js +++ b/test/q_usd_tiered_sto_sim.js @@ -252,7 +252,7 @@ contract("USDTieredSTO Sim", async (accounts) => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.getTokens(REGFEE, ISSUER); await I_PolyToken.approve(I_STRProxied.address, REGFEE, { from: ISSUER }); - let tx = await I_STRProxied.registerTicker(ISSUER, SYMBOL, NAME, { from: ISSUER }); + let tx = await I_STRProxied.registerNewTicker(ISSUER, SYMBOL, { from: ISSUER }); assert.equal(tx.logs[0].args._owner, ISSUER); assert.equal(tx.logs[0].args._ticker, SYMBOL); }); diff --git a/test/r_concurrent_STO.js b/test/r_concurrent_STO.js index 73f2c341d..4fa5c6fe1 100644 --- a/test/r_concurrent_STO.js +++ b/test/r_concurrent_STO.js @@ -139,7 +139,7 @@ contract("Concurrent STO", async (accounts) => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.getTokens(initRegFee, account_issuer); await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: account_issuer }); - let tx = await I_STRProxied.registerTicker(account_issuer, symbol, name, { from: account_issuer }); + let tx = await I_STRProxied.registerNewTicker(account_issuer, symbol, { from: account_issuer }); assert.equal(tx.logs[0].args._owner, account_issuer); assert.equal(tx.logs[0].args._ticker, symbol); }); diff --git a/test/t_security_token_registry_proxy.js b/test/t_security_token_registry_proxy.js index 4a473b5cc..b73245f24 100644 --- a/test/t_security_token_registry_proxy.js +++ b/test/t_security_token_registry_proxy.js @@ -155,7 +155,7 @@ contract("SecurityTokenRegistryProxy", async (accounts) => { it("Register the ticker", async () => { await I_PolyToken.getTokens(new BN(web3.utils.toWei("8000")), token_owner); await I_PolyToken.approve(I_STRProxied.address, initRegFeePOLY, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner, "Owner should be the same as registered with the ticker"); assert.equal(tx.logs[0].args._ticker, symbol, "Same as the symbol registered in the registerTicker function call"); }); diff --git a/test/v_tracked_redemptions.js b/test/v_tracked_redemptions.js index e2fe7abaf..9c2e62040 100644 --- a/test/v_tracked_redemptions.js +++ b/test/v_tracked_redemptions.js @@ -132,7 +132,7 @@ contract("TrackedRedemption", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/w_lockup_transfer_manager.js b/test/w_lockup_transfer_manager.js index c30134063..a799206be 100644 --- a/test/w_lockup_transfer_manager.js +++ b/test/w_lockup_transfer_manager.js @@ -133,7 +133,7 @@ contract('LockUpTransferManager', accounts => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from : token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from : token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); @@ -166,7 +166,7 @@ contract('LockUpTransferManager', accounts => { }); it("Should register another ticker before the generation of new security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol2, contact, { from : token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol2, { from : token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol2.toUpperCase()); }); diff --git a/test/x_scheduled_checkpoints.js b/test/x_scheduled_checkpoints.js index 94a48090c..ecb48892f 100644 --- a/test/x_scheduled_checkpoints.js +++ b/test/x_scheduled_checkpoints.js @@ -128,7 +128,7 @@ process.env.COVERAGE ? contract.skip : contract("ScheduledCheckpoint", async (ac describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/y_volume_restriction_tm.js b/test/y_volume_restriction_tm.js index 69e6499eb..dac5da999 100644 --- a/test/y_volume_restriction_tm.js +++ b/test/y_volume_restriction_tm.js @@ -216,7 +216,7 @@ contract('VolumeRestrictionTransferManager', accounts => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/z_blacklist_transfer_manager.js b/test/z_blacklist_transfer_manager.js index 6c12dec8d..a22472b16 100644 --- a/test/z_blacklist_transfer_manager.js +++ b/test/z_blacklist_transfer_manager.js @@ -163,7 +163,7 @@ contract('BlacklistTransferManager', accounts => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner}); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from : token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from : token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/z_fuzz_test_adding_removing_modules_ST.js b/test/z_fuzz_test_adding_removing_modules_ST.js index 5894a710e..870a19158 100644 --- a/test/z_fuzz_test_adding_removing_modules_ST.js +++ b/test/z_fuzz_test_adding_removing_modules_ST.js @@ -184,7 +184,7 @@ contract('GeneralPermissionManager', accounts => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/z_fuzzer_volumn_restriction_transfer_manager.js b/test/z_fuzzer_volumn_restriction_transfer_manager.js index 61e235c11..48ffea344 100644 --- a/test/z_fuzzer_volumn_restriction_transfer_manager.js +++ b/test/z_fuzzer_volumn_restriction_transfer_manager.js @@ -173,7 +173,7 @@ contract('VolumeRestrictionTransferManager', accounts => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/z_general_permission_manager_fuzzer.js b/test/z_general_permission_manager_fuzzer.js index 0cafe003c..d09ca70b9 100644 --- a/test/z_general_permission_manager_fuzzer.js +++ b/test/z_general_permission_manager_fuzzer.js @@ -179,7 +179,7 @@ contract("GeneralPermissionManager Fuzz", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/z_vesting_escrow_wallet.js b/test/z_vesting_escrow_wallet.js index 953cf9858..a93c10845 100644 --- a/test/z_vesting_escrow_wallet.js +++ b/test/z_vesting_escrow_wallet.js @@ -138,7 +138,7 @@ contract('VestingEscrowWallet', accounts => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from : token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from : token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/za_datastore.js b/test/za_datastore.js index fd13aeaed..701d27831 100644 --- a/test/za_datastore.js +++ b/test/za_datastore.js @@ -92,7 +92,7 @@ contract("Data store", async (accounts) => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/zb_signed_transfer_manager.js b/test/zb_signed_transfer_manager.js index af5c11861..396ae1fa5 100644 --- a/test/zb_signed_transfer_manager.js +++ b/test/zb_signed_transfer_manager.js @@ -131,7 +131,7 @@ contract("SignedTransferManager", accounts => { describe("Generate the SecurityToken", async () => { it("Should register the ticker before the generation of the security token", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, contact, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol.toUpperCase()); }); diff --git a/test/zc_plcr_voting_checkpoint.js b/test/zc_plcr_voting_checkpoint.js index d1bcce29a..f1fd4a040 100644 --- a/test/zc_plcr_voting_checkpoint.js +++ b/test/zc_plcr_voting_checkpoint.js @@ -139,7 +139,7 @@ contract("PLCRVotingCheckpoint", async (accounts) => { it("\t\t Should register the ticker before the generation of the security token \n", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol); }); @@ -206,37 +206,37 @@ contract("PLCRVotingCheckpoint", async (accounts) => { it("\t\t Should fail to create ballot -- bad commit duration \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(0), new BN(duration.days(10)), new BN(3), new BN(46.57).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad reveal duration \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(duration.days(10)), new BN(0), new BN(3), new BN(46.57).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad proposed quorum \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(duration.days(10)), new BN(duration.days(10)), new BN(3), new BN(0).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad proposed quorum more than 100 % \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(duration.days(10)), new BN(duration.days(10)), new BN(3), new BN(46.57).mul(new BN(10).pow(new BN(18))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad no of proposals \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(duration.days(5)), new BN(duration.days(10)), new BN(0), new BN(46.57).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad no of proposals \n", async() => { await catchRevert( I_PLCRVotingCheckpoint.createBallot(new BN(duration.days(5)), new BN(duration.days(10)), new BN(1), new BN(46.57).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Mint some tokens and transfer to whitelisted investors \n", async() => { @@ -403,8 +403,8 @@ contract("PLCRVotingCheckpoint", async (accounts) => { let tx = await I_PLCRVotingCheckpoint.commitVote(new BN(0), web3.utils.soliditySha3(2, salt), {from: account_investor1}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._secretVote, web3.utils.soliditySha3(2, salt)); - assert.equal(tx.logs[0].args._voter, account_investor1); - + assert.equal(tx.logs[0].args._voter, account_investor1); + let data = await I_PLCRVotingCheckpoint.getBallotDetails.call(new BN(0)); assert.equal(data[5], 3); assert.equal(data[7], true); @@ -478,8 +478,8 @@ contract("PLCRVotingCheckpoint", async (accounts) => { let tx = await I_PLCRVotingCheckpoint.commitVote(new BN(0), web3.utils.soliditySha3(1, salt), {from: account_investor3}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._secretVote, web3.utils.soliditySha3(1, salt)); - assert.equal(tx.logs[0].args._voter, account_investor3); - + assert.equal(tx.logs[0].args._voter, account_investor3); + let data = await I_PLCRVotingCheckpoint.getBallotDetails.call(new BN(0)); assert.equal(data[5], 3); assert.equal(data[7], true); @@ -491,8 +491,8 @@ contract("PLCRVotingCheckpoint", async (accounts) => { let tx = await I_PLCRVotingCheckpoint.commitVote(new BN(0), web3.utils.soliditySha3(2, salt), {from: account_investor2}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._secretVote, web3.utils.soliditySha3(2, salt)); - assert.equal(tx.logs[0].args._voter, account_investor2); - + assert.equal(tx.logs[0].args._voter, account_investor2); + let data = await I_PLCRVotingCheckpoint.getBallotDetails.call(new BN(0)); assert.equal(data[5], 3); assert.equal(data[7], true); diff --git a/test/zd_weighted_vote_checkpoint.js b/test/zd_weighted_vote_checkpoint.js index ec8b0fa46..a0d67bdf2 100644 --- a/test/zd_weighted_vote_checkpoint.js +++ b/test/zd_weighted_vote_checkpoint.js @@ -129,7 +129,7 @@ contract("WeightedVoteCheckpoint", async (accounts) => { it("\t\t Should register the ticker before the generation of the security token \n", async () => { await I_PolyToken.approve(I_STRProxied.address, initRegFee, { from: token_owner }); - let tx = await I_STRProxied.registerTicker(token_owner, symbol, name, { from: token_owner }); + let tx = await I_STRProxied.registerNewTicker(token_owner, symbol, { from: token_owner }); assert.equal(tx.logs[0].args._owner, token_owner); assert.equal(tx.logs[0].args._ticker, symbol); }); @@ -183,31 +183,31 @@ contract("WeightedVoteCheckpoint", async (accounts) => { it("\t\t Should fail to create ballot -- bad owner \n", async() => { await catchRevert( I_WeightedVoteCheckpoint.createBallot(new BN(duration.days(5)), new BN(5), new BN(51).mul(new BN(10).pow(new BN(16))), {from: account_polymath}) - ); + ); }); it("\t\t Should fail to create ballot -- bad duration \n", async() => { await catchRevert( I_WeightedVoteCheckpoint.createBallot(new BN(0), new BN(5), new BN(51).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- bad no of proposals \n", async() => { await catchRevert( I_WeightedVoteCheckpoint.createBallot(new BN(duration.days(5)), new BN(1), new BN(51).mul(new BN(10).pow(new BN(16))), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- zero value of quorum \n", async() => { await catchRevert( I_WeightedVoteCheckpoint.createBallot(new BN(duration.days(5)), new BN(1), new BN(0), {from: token_owner}) - ); + ); }); it("\t\t Should fail to create ballot -- value of quorum is more than the limit\n", async() => { await catchRevert( I_WeightedVoteCheckpoint.createBallot(new BN(duration.days(5)), new BN(1), new BN(51).mul(new BN(10).pow(new BN(17))), {from: token_owner}) - ); + ); }); it("\t\t Mint some tokens and transfer to whitelisted investors \n", async() => { @@ -338,8 +338,8 @@ contract("WeightedVoteCheckpoint", async (accounts) => { let tx = await I_WeightedVoteCheckpoint.castVote(new BN(0), new BN(2), {from: account_investor2}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._proposalId, 2); - assert.equal(tx.logs[0].args._voter, account_investor2); - + assert.equal(tx.logs[0].args._voter, account_investor2); + let data = await I_WeightedVoteCheckpoint.getBallotDetails.call(new BN(0)); assert.equal(data[6], 1); assert.equal(data[5], 3); @@ -379,8 +379,8 @@ contract("WeightedVoteCheckpoint", async (accounts) => { let tx = await I_WeightedVoteCheckpoint.castVote(new BN(0), new BN(1), {from: account_investor1}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._proposalId, 1); - assert.equal(tx.logs[0].args._voter, account_investor1); - + assert.equal(tx.logs[0].args._voter, account_investor1); + let data = await I_WeightedVoteCheckpoint.getBallotDetails.call(new BN(0)); assert.equal(data[6], 2); assert.equal(data[5], 3); @@ -427,8 +427,8 @@ contract("WeightedVoteCheckpoint", async (accounts) => { let tx = await I_WeightedVoteCheckpoint.castVote(new BN(0), new BN(1), {from: account_investor3}); assert.equal(tx.logs[0].args._ballotId, 0); assert.equal(tx.logs[0].args._proposalId, 1); - assert.equal(tx.logs[0].args._voter, account_investor3); - + assert.equal(tx.logs[0].args._voter, account_investor3); + let data = await I_WeightedVoteCheckpoint.getBallotDetails.call(new BN(0)); console.log(data); assert.equal(data[6], 3);