@@ -395,54 +395,54 @@ contract("SecurityToken", async (accounts) => {
395395 assert . equal ( log . logs [ 0 ] . args . _newDetails , "new token details" ) ;
396396 } ) ;
397397
398- // it("Should successfully remove the general transfer manager module from the securityToken -- fails msg.sender should be Owner", async () => {
399- // await catchRevert(I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: account_delegate }));
400- // });
401-
402- // it("Should fail to remove the module - module not archived", async () => {
403- // await catchRevert(I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: account_temp }));
404- // });
405-
406- // it("Should fail to remove the module - incorrect address", async () => {
407- // await catchRevert(I_SecurityToken.removeModule(address_zero, { from: token_owner }));
408- // });
409-
410- // it("Should successfully remove the general transfer manager module from the securityToken", async () => {
411- // let key = await takeSnapshot();
412- // await I_SecurityToken.archiveModule(I_GeneralTransferManager.address, { from: token_owner });
413- // let tx = await I_SecurityToken.removeModule(I_GeneralTransferManager.address, { from: token_owner });
414- // assert.equal(tx.logs[0].args._types[0], transferManagerKey);
415- // assert.equal(tx.logs[0].args._module, I_GeneralTransferManager.address);
416- // await I_SecurityToken.mint(account_investor1, new BN(web3.utils.toWei("500")), { from: token_owner });
417- // await I_SecurityToken.transfer(account_investor2, new BN(web3.utils.toWei("200")), { from: account_investor1 });
418- // assert.equal((await I_SecurityToken.balanceOf(account_investor2)).div(new BN(10).pow(new BN(18))).toNumber(), 200);
419- // await revertToSnapshot(key);
420- // });
421-
422- // it("Should successfully remove the module from the middle of the names mapping", async () => {
423- // let snap_Id = await takeSnapshot();
424- // let D_GPM, D_GPM_1, D_GPM_2;
425- // let FactoryInstances;
426- // let GPMAddress = new Array();
427-
428- // [D_GPM] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0);
429- // [D_GPM_1] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0);
430- // [D_GPM_2] = await deployGPMAndVerifyed(account_polymath, I_MRProxied, 0);
431- // FactoryInstances = [D_GPM, D_GPM_1, D_GPM_2];
432- // // Adding module in the ST
433- // for (let i = 0; i < FactoryInstances.length; i++) {
434- // let tx = await I_SecurityToken.addModule(FactoryInstances[i].address, "0x0", new BN(0), new BN(0), { from: token_owner });
435- // assert.equal(tx.logs[2].args._types[0], permissionManagerKey, "fail in adding the GPM");
436- // GPMAddress.push(tx.logs[2].args._module);
437- // }
438- // // Archive the one of the module
439- // await I_SecurityToken.archiveModule(GPMAddress[0], { from: token_owner });
440- // // Remove the module
441- // let tx = await I_SecurityToken.removeModule(GPMAddress[0], { from: token_owner });
442- // assert.equal(tx.logs[0].args._types[0], permissionManagerKey);
443- // assert.equal(tx.logs[0].args._module, GPMAddress[0]);
444- // await revertToSnapshot(snap_Id);
445- // });
398+ it ( "Should successfully remove the general transfer manager module from the securityToken -- fails msg.sender should be Owner" , async ( ) => {
399+ await catchRevert ( I_SecurityToken . removeModule ( I_GeneralTransferManager . address , { from : account_delegate } ) ) ;
400+ } ) ;
401+
402+ it ( "Should fail to remove the module - module not archived" , async ( ) => {
403+ await catchRevert ( I_SecurityToken . removeModule ( I_GeneralTransferManager . address , { from : account_temp } ) ) ;
404+ } ) ;
405+
406+ it ( "Should fail to remove the module - incorrect address" , async ( ) => {
407+ await catchRevert ( I_SecurityToken . removeModule ( address_zero , { from : token_owner } ) ) ;
408+ } ) ;
409+
410+ it ( "Should successfully remove the general transfer manager module from the securityToken" , async ( ) => {
411+ let key = await takeSnapshot ( ) ;
412+ await I_SecurityToken . archiveModule ( I_GeneralTransferManager . address , { from : token_owner } ) ;
413+ let tx = await I_SecurityToken . removeModule ( I_GeneralTransferManager . address , { from : token_owner } ) ;
414+ assert . equal ( tx . logs [ 0 ] . args . _types [ 0 ] , transferManagerKey ) ;
415+ assert . equal ( tx . logs [ 0 ] . args . _module , I_GeneralTransferManager . address ) ;
416+ await I_SecurityToken . mint ( account_investor1 , new BN ( web3 . utils . toWei ( "500" ) ) , { from : token_owner } ) ;
417+ await I_SecurityToken . transfer ( account_investor2 , new BN ( web3 . utils . toWei ( "200" ) ) , { from : account_investor1 } ) ;
418+ assert . equal ( ( await I_SecurityToken . balanceOf ( account_investor2 ) ) . div ( new BN ( 10 ) . pow ( new BN ( 18 ) ) ) . toNumber ( ) , 200 ) ;
419+ await revertToSnapshot ( key ) ;
420+ } ) ;
421+
422+ it ( "Should successfully remove the module from the middle of the names mapping" , async ( ) => {
423+ let snap_Id = await takeSnapshot ( ) ;
424+ let D_GPM , D_GPM_1 , D_GPM_2 ;
425+ let FactoryInstances ;
426+ let GPMAddress = new Array ( ) ;
427+
428+ [ D_GPM ] = await deployGPMAndVerifyed ( account_polymath , I_MRProxied , 0 ) ;
429+ [ D_GPM_1 ] = await deployGPMAndVerifyed ( account_polymath , I_MRProxied , 0 ) ;
430+ [ D_GPM_2 ] = await deployGPMAndVerifyed ( account_polymath , I_MRProxied , 0 ) ;
431+ FactoryInstances = [ D_GPM , D_GPM_1 , D_GPM_2 ] ;
432+ // Adding module in the ST
433+ for ( let i = 0 ; i < FactoryInstances . length ; i ++ ) {
434+ let tx = await I_SecurityToken . addModule ( FactoryInstances [ i ] . address , "0x0" , new BN ( 0 ) , new BN ( 0 ) , { from : token_owner } ) ;
435+ assert . equal ( tx . logs [ 2 ] . args . _types [ 0 ] , permissionManagerKey , "fail in adding the GPM" ) ;
436+ GPMAddress . push ( tx . logs [ 2 ] . args . _module ) ;
437+ }
438+ // Archive the one of the module
439+ await I_SecurityToken . archiveModule ( GPMAddress [ 0 ] , { from : token_owner } ) ;
440+ // Remove the module
441+ let tx = await I_SecurityToken . removeModule ( GPMAddress [ 0 ] , { from : token_owner } ) ;
442+ assert . equal ( tx . logs [ 0 ] . args . _types [ 0 ] , permissionManagerKey ) ;
443+ assert . equal ( tx . logs [ 0 ] . args . _module , GPMAddress [ 0 ] ) ;
444+ await revertToSnapshot ( snap_Id ) ;
445+ } ) ;
446446
447447 it ( "Should successfully archive the module first and fail during achiving the module again" , async ( ) => {
448448 let key = await takeSnapshot ( ) ;
0 commit comments