@@ -1938,8 +1938,8 @@ contract('VolumeRestrictionTransferManager', accounts => {
19381938 await print ( data , account_delegate2 ) ;
19391939 console . log ( data [ 4 ] . toString ( ) ) ;
19401940
1941- // get the trade amount using the timestamp
1942- let amt = web3 . utils . fromWei ( await I_VolumeRestrictionTM . getTotalTradedByUser . call ( account_delegate2 , data [ 0 ] . toString ( ) ) ) ;
1941+ // get the trade amount using the timestamp
1942+ let amt = web3 . utils . fromWei ( await I_VolumeRestrictionTM . getTotalTradedByUser . call ( account_delegate2 , data [ 0 ] . toString ( ) ) ) ;
19431943 // Verify the storage changes
19441944 assert . equal ( data [ 0 ] . toNumber ( ) , startTime + duration . days ( data [ 2 ] . toNumber ( ) ) ) ;
19451945 assert . equal ( data [ 2 ] . toNumber ( ) , 6 ) ;
@@ -1995,6 +1995,59 @@ contract('VolumeRestrictionTransferManager', accounts => {
19951995 } ) ;
19961996 } ) ;
19971997
1998+ describe ( "Test the edge case which cause transfer revert instead of INVALID return because of controllerTransfer" , async ( ) => {
1999+
2000+ it ( "Archiving the existing VRTM and add a new one" , async ( ) => {
2001+ await I_SecurityToken . archiveModule ( I_VolumeRestrictionTM . address , { from : token_owner } ) ;
2002+ let tx = await I_SecurityToken . addModule ( I_VolumeRestrictionTMFactory . address , "0x0" , new BN ( 0 ) , new BN ( 0 ) , false , { from : token_owner } ) ;
2003+ assert . equal ( tx . logs [ 2 ] . args . _moduleFactory , I_VolumeRestrictionTMFactory . address ) ;
2004+ assert . equal (
2005+ web3 . utils . toUtf8 ( tx . logs [ 2 ] . args . _name ) ,
2006+ "VolumeRestrictionTM" ,
2007+ "VolumeRestrictionTMFactory doesn not added" ) ;
2008+ I_VolumeRestrictionTM = await VolumeRestrictionTM . at ( tx . logs [ 2 ] . args . _module ) ;
2009+ } ) ;
2010+
2011+ it ( "Add default restriction" , async ( ) => {
2012+ let newLatestTime = await getLatestTime ( ) ;
2013+ await I_VolumeRestrictionTM . addDefaultRestriction (
2014+ new BN ( web3 . utils . toWei ( "10" ) ) ,
2015+ 0 ,
2016+ 5 ,
2017+ newLatestTime . add ( new BN ( duration . days ( 10 ) ) ) ,
2018+ 0 ,
2019+ {
2020+ from : token_owner
2021+ }
2022+ ) ;
2023+
2024+ let data = await I_VolumeRestrictionTM . getDefaultRestriction . call ( ) ;
2025+ assert . equal ( data [ 0 ] . toString ( ) , new BN ( web3 . utils . toWei ( "10" ) ) ) ;
2026+ assert . equal ( data [ 2 ] . toString ( ) , 5 ) ;
2027+ let dataRestriction = await I_VolumeRestrictionTM . getDefaultRestriction . call ( ) ;
2028+ console . log ( `
2029+ *** Add Individual restriction data ***
2030+ Allowed Tokens: ${ dataRestriction [ 0 ] . div ( new BN ( 10 ) . pow ( new BN ( 18 ) ) ) . toString ( ) }
2031+ StartTime : ${ dataRestriction [ 1 ] . toString ( ) }
2032+ Rolling Period in days : ${ dataRestriction [ 2 ] . toString ( ) }
2033+ EndTime : ${ dataRestriction [ 3 ] . toString ( ) }
2034+ Type of Restriction: ${ dataRestriction [ 4 ] . toString ( ) }
2035+ ` ) ;
2036+ } ) ;
2037+
2038+ it ( "Should transfer funds using the controller transfer" , async ( ) => {
2039+ await increaseTime ( duration . minutes ( 123 ) ) ;
2040+ await I_SecurityToken . setController ( token_owner , { from : token_owner } ) ;
2041+ console . log ( `Balance of the account investor 1: ${ await I_SecurityToken . balanceOf . call ( account_investor1 ) } ` ) ;
2042+ await I_SecurityToken . controllerTransfer ( account_investor1 , account_investor2 , new BN ( web3 . utils . toWei ( "11" ) ) , "0x0" , "0x0" , { from : token_owner } ) ;
2043+ } ) ;
2044+
2045+ it ( "Should also allow transfer the funds using the controller transfer even it surpasses the restriction limit" , async ( ) => {
2046+ await I_SecurityToken . controllerTransfer ( account_investor1 , account_investor2 , new BN ( web3 . utils . toWei ( "5" ) ) , "0x0" , "0x0" , { from : token_owner } ) ;
2047+ } ) ;
2048+
2049+ } ) ;
2050+
19982051 describe ( "VolumeRestriction Transfer Manager Factory test cases" , async ( ) => {
19992052
20002053 it ( "Should get the exact details of the factory" , async ( ) => {
0 commit comments