@@ -105,17 +105,33 @@ interface GetManualApprovalTransferManagerLogsAsyncParams extends GetLogs {
105
105
( params : GetUnpauseLogsAsyncParams ) : Promise < LogWithDecodedArgs < ManualApprovalTransferManagerUnpauseEventArgs > [ ] > ;
106
106
}
107
107
108
+ /**
109
+ * @param index
110
+ */
108
111
interface ApprovalsParams {
109
112
index : number ;
110
113
}
111
114
115
+ /**
116
+ * @param from Address of the sender
117
+ * @param to Address of the receiver
118
+ * @param amount
119
+ * @param data
120
+ */
112
121
interface VerifyTransferParams {
113
122
from : string ;
114
123
to : string ;
115
124
amount : BigNumber ;
116
125
data : string ;
117
126
}
118
127
128
+ /**
129
+ * @param from is the address from which transfers are approved
130
+ * @param to is the address to which transfers are approved
131
+ * @param allowance is the approved amount of tokens
132
+ * @param expiryTime is the time until which the transfer is allowed
133
+ * @param description Description about the manual approval
134
+ */
119
135
interface AddManualApprovalParams extends TxParams {
120
136
from : string ;
121
137
to : string ;
@@ -124,6 +140,13 @@ interface AddManualApprovalParams extends TxParams {
124
140
description : string ;
125
141
}
126
142
143
+ /**
144
+ * @param from is the address array from which transfers are approved
145
+ * @param to is the address array to which transfers are approved
146
+ * @param allowances is the array of approved amounts
147
+ * @param expiryTimes is the array of the times until which eath transfer is allowed
148
+ * @param descriptions is the description array for these manual approvals
149
+ */
127
150
interface AddManualApprovalMultiParams extends TxParams {
128
151
from : string [ ] ;
129
152
to : string [ ] ;
@@ -132,6 +155,15 @@ interface AddManualApprovalMultiParams extends TxParams {
132
155
descriptions : string [ ] ;
133
156
}
134
157
158
+ /**
159
+ * @param from is the address from which transfers are approved
160
+ * @param to is the address to which transfers are approved
161
+ * @param expiryTime is the time until which the transfer is allowed
162
+ * @param changeInAllowance is the change in allowance
163
+ * @param description Description about the manual approval
164
+ * @param increase tells whether the allowances will be increased (true) or decreased (false).
165
+ * or any value when there is no change in allowances
166
+ */
135
167
interface ModifyManualApprovalParams extends TxParams {
136
168
from : string ;
137
169
to : string ;
@@ -141,6 +173,15 @@ interface ModifyManualApprovalParams extends TxParams {
141
173
increase : boolean ;
142
174
}
143
175
176
+ /**
177
+ * @param from is the address array from which transfers are approved
178
+ * @param to is the address array to which transfers are approved
179
+ * @param expiryTimes is the array of the times until which each transfer is allowed
180
+ * @param changeInAllowance is the array of change in allowances
181
+ * @param descriptions is the description array for these manual approvals
182
+ * @param increase Array of bools that tells whether the allowances will be increased (true) or decreased (false).
183
+ * or any value when there is no change in allowances
184
+ */
144
185
interface ModifyManualApprovalMultiParams extends TxParams {
145
186
from : string [ ] ;
146
187
to : string [ ] ;
@@ -150,20 +191,36 @@ interface ModifyManualApprovalMultiParams extends TxParams {
150
191
increase : boolean [ ] ;
151
192
}
152
193
194
+ /**
195
+ * @param from is the address from which transfers are approved
196
+ * @param to is the address to which transfers are approved
197
+ */
153
198
interface RevokeManualApprovalParams extends TxParams {
154
199
from : string ;
155
200
to : string ;
156
201
}
157
202
203
+ /**
204
+ * @param from is the address array from which transfers are approved
205
+ * @param to is the address array to which transfers are approved
206
+ */
158
207
interface RevokeManualApprovalMultiParams extends TxParams {
159
208
from : string [ ] ;
160
209
to : string [ ] ;
161
210
}
162
211
212
+ /**
213
+ * @param user Address of the holder corresponds to whom list of manual approvals
214
+ * need to return
215
+ */
163
216
interface GetActiveApprovalsToUserParams {
164
217
user : string ;
165
218
}
166
219
220
+ /**
221
+ * @param from Address of the sender
222
+ * @param to Address of the receiver
223
+ */
167
224
interface GetApprovalDetailsParams {
168
225
from : string ;
169
226
to : string ;
@@ -204,22 +261,36 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
204
261
this . contract = contract ;
205
262
}
206
263
264
+ /**
265
+ * unpause the module
266
+ */
207
267
public unpause = async ( params : TxParams ) => {
208
268
assert . assert ( await this . paused ( ) , 'Controller not currently paused' ) ;
209
269
assert . assert ( await this . isCallerTheSecurityTokenOwner ( params . txData ) , 'Sender is not owner' ) ;
210
270
return ( await this . contract ) . unpause . sendTransactionAsync ( params . txData , params . safetyFactor ) ;
211
271
} ;
212
272
273
+ /**
274
+ * check if the module is paused
275
+ */
213
276
public paused = async ( ) => {
214
277
return ( await this . contract ) . paused . callAsync ( ) ;
215
278
} ;
216
279
280
+ /**
281
+ * pause the module
282
+ */
217
283
public pause = async ( params : TxParams ) => {
218
284
assert . assert ( ! ( await this . paused ( ) ) , 'Controller currently paused' ) ;
219
285
assert . assert ( await this . isCallerTheSecurityTokenOwner ( params . txData ) , 'Sender is not owner' ) ;
220
286
return ( await this . contract ) . pause . sendTransactionAsync ( params . txData , params . safetyFactor ) ;
221
287
} ;
222
288
289
+ /**
290
+ * An array to track all approvals. It is an unbounded array but it's not a problem as
291
+ * it is never looped through in an on chain call. It is defined as an Array instead of mapping
292
+ * just to make it easier for users to fetch list of all approvals through constant functions.
293
+ */
223
294
public approvals = async ( params : ApprovalsParams ) => {
224
295
const result = await ( await this . contract ) . approvals . callAsync ( numberToBigNumber ( params . index ) ) ;
225
296
const decimals = await ( await this . securityTokenContract ( ) ) . decimals . callAsync ( ) ;
@@ -233,10 +304,20 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
233
304
return typedResult ;
234
305
} ;
235
306
236
- public getInitFunction = async ( ) => {
307
+ /**
308
+ * This function returns the signature of configure function
309
+ */
310
+ public getInitFunction = async ( ) : Promise < string > => {
237
311
return ( await this . contract ) . getInitFunction . callAsync ( ) ;
238
312
} ;
239
313
314
+ /**
315
+ * Used to verify the transfer transaction (View)
316
+ * Restrict the blacklist address to transfer tokens
317
+ * if the current time is between the time frame define for the
318
+ * blacklist type associated with the from address
319
+ * @return Parse transfer result
320
+ */
240
321
public verifyTransfer = async ( params : VerifyTransferParams ) => {
241
322
assert . isETHAddressHex ( 'from' , params . from ) ;
242
323
assert . isETHAddressHex ( 'to' , params . to ) ;
@@ -254,6 +335,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
254
335
} ;
255
336
} ;
256
337
338
+ /**
339
+ * Adds a pair of addresses to manual approvals
340
+ */
257
341
public addManualApproval = async ( params : AddManualApprovalParams ) => {
258
342
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
259
343
assert . isETHAddressHex ( 'from' , params . from ) ;
@@ -273,6 +357,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
273
357
) ;
274
358
} ;
275
359
360
+ /**
361
+ * Adds multiple manual approvals in batch
362
+ */
276
363
public addManualApprovalMulti = async ( params : AddManualApprovalMultiParams ) => {
277
364
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
278
365
params . from . forEach ( address => assert . isETHAddressHex ( 'from' , address ) ) ;
@@ -305,6 +392,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
305
392
) ;
306
393
} ;
307
394
395
+ /**
396
+ * Modify the existing manual approvals
397
+ */
308
398
public modifyManualApproval = async ( params : ModifyManualApprovalParams ) => {
309
399
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
310
400
assert . isETHAddressHex ( 'from' , params . from ) ;
@@ -324,6 +414,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
324
414
) ;
325
415
} ;
326
416
417
+ /**
418
+ * Adds multiple manual approvals in batch
419
+ */
327
420
public modifyManualApprovalMulti = async ( params : ModifyManualApprovalMultiParams ) => {
328
421
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
329
422
params . from . forEach ( address => assert . isETHAddressHex ( 'from' , address ) ) ;
@@ -354,6 +447,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
354
447
) ;
355
448
} ;
356
449
450
+ /**
451
+ * Removes pairs of addresses from manual approvals
452
+ */
357
453
public revokeManualApproval = async ( params : RevokeManualApprovalParams ) => {
358
454
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
359
455
assert . isETHAddressHex ( 'from' , params . from ) ;
@@ -367,6 +463,9 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
367
463
) ;
368
464
} ;
369
465
466
+ /**
467
+ * Removes multiple pairs of addresses from manual approvals
468
+ */
370
469
public revokeManualApprovalMulti = async ( params : RevokeManualApprovalMultiParams ) => {
371
470
assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
372
471
params . from . forEach ( address => assert . isETHAddressHex ( 'from' , address ) ) ;
@@ -385,7 +484,15 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
385
484
) ;
386
485
} ;
387
486
388
- public getActiveApprovalsToUser = async ( params : GetActiveApprovalsToUserParams ) => {
487
+ /**
488
+ * Returns the all active approvals corresponds to an address
489
+ * @return addresses from
490
+ * @return addresses to
491
+ * @return allowances provided to the approvals
492
+ * @return expiry times provided to the approvals
493
+ * @return descriptions provided to the approvals
494
+ */
495
+ public getActiveApprovalsToUser = async ( params : GetActiveApprovalsToUserParams ) : Promise < Approval [ ] > => {
389
496
assert . isETHAddressHex ( 'user' , params . user ) ;
390
497
const result = await ( await this . contract ) . getActiveApprovalsToUser . callAsync ( params . user ) ;
391
498
const typedResult : Approval [ ] = [ ] ;
@@ -403,7 +510,13 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
403
510
return typedResult ;
404
511
} ;
405
512
406
- public getApprovalDetails = async ( params : GetApprovalDetailsParams ) => {
513
+ /**
514
+ * Get the details of the approval corresponds to from & to addresses
515
+ * @return expiryTime of the approval
516
+ * @return allowance provided to the approval
517
+ * @return Description provided to the approval
518
+ */
519
+ public getApprovalDetails = async ( params : GetApprovalDetailsParams ) : Promise < Approval > => {
407
520
assert . isETHAddressHex ( 'from' , params . from ) ;
408
521
assert . isETHAddressHex ( 'to' , params . to ) ;
409
522
const result = await ( await this . contract ) . getApprovalDetails . callAsync ( params . from , params . to ) ;
@@ -418,11 +531,22 @@ export default class ManualApprovalTransferManagerWrapper extends ModuleWrapper
418
531
return typedResult ;
419
532
} ;
420
533
421
- public getTotalApprovalsLength = async ( ) => {
422
- return ( await this . contract ) . getTotalApprovalsLength . callAsync ( ) ;
534
+ /**
535
+ * Returns the current number of active approvals
536
+ */
537
+ public getTotalApprovalsLength = async ( ) : Promise < number > => {
538
+ return ( await ( await this . contract ) . getTotalApprovalsLength . callAsync ( ) ) . toNumber ( ) ;
423
539
} ;
424
540
425
- public getAllApprovals = async ( ) => {
541
+ /**
542
+ * Get the details of all approvals
543
+ * @return addresses from
544
+ * @return addresses to
545
+ * @return allowances provided to the approvals
546
+ * @return expiry times provided to the approvals
547
+ * @return descriptions provided to the approvals
548
+ */
549
+ public getAllApprovals = async ( ) : Promise < Approval [ ] > => {
426
550
const result = await ( await this . contract ) . getAllApprovals . callAsync ( ) ;
427
551
const decimals = await ( await this . securityTokenContract ( ) ) . decimals . callAsync ( ) ;
428
552
const typedResult : Approval [ ] = [ ] ;
0 commit comments