Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit 41d5b19

Browse files
committed
fix: 🐛 add method documentation
add documentation for every method and interface we have
1 parent 0e5896c commit 41d5b19

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

src/contract_wrappers/modules/wallet/vesting_escrow_wallet_wrapper.ts

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,33 +191,62 @@ interface BeneficiariesParams {
191191
index: number;
192192
}
193193

194+
/**
195+
* @param newTreasuryWallet Address of the treasury wallet
196+
*/
194197
interface ChangeTreasuryWalletParams extends TxParams {
195198
newTreasuryWallet: string;
196199
}
197200

201+
/**
202+
* @param numberOfTokens Number of tokens that should be deposited
203+
*/
198204
interface DepositTokensParams extends TxParams {
199205
numberOfTokens: number;
200206
}
201207

208+
/**
209+
* @param amount Amount of tokens that should be send to the treasury wallet
210+
*/
202211
interface SendToTreasuryParams extends TxParams {
203212
amount: number;
204213
}
205214

215+
/**
216+
* @param beneficiary Address of the beneficiary who will receive tokens
217+
*/
206218
interface PushAvailableTokensParams extends TxParams {
207219
beneficiary: string;
208220
}
209221

222+
/**
223+
* @param name Name of the template will be created
224+
* @param numberOfTokens Number of tokens that should be assigned to schedule
225+
* @param duration Duration of the vesting schedule
226+
* @param frequency Frequency of the vesting schedule
227+
*/
210228
interface AddTemplateParams extends TxParams {
211229
name: string;
212230
numberOfTokens: number;
213231
duration: number;
214232
frequency: number;
215233
}
216234

235+
/**
236+
* @param name Name of the template that will be removed
237+
*/
217238
interface RemoveTemplateParams extends TxParams {
218239
name: string;
219240
}
220241

242+
/**
243+
* @param beneficiary Address of the beneficiary for whom it is scheduled
244+
* @param templateName Name of the template that will be created
245+
* @param numberOfTokens Total number of tokens for created schedule
246+
* @param duration Duration of the created vesting schedule
247+
* @param frequency Frequency of the created vesting schedule
248+
* @param startTime Start time of the created vesting schedule
249+
*/
221250
interface AddScheduleParams extends TxParams {
222251
beneficiary: string;
223252
templateName: string;
@@ -227,45 +256,84 @@ interface AddScheduleParams extends TxParams {
227256
startTime?: Date;
228257
}
229258

259+
/**
260+
* @param beneficiary Address of the beneficiary for whom it is scheduled
261+
* @param templateName Name of the exists template
262+
* @param startTime Start time of the created vesting schedule
263+
*/
230264
interface AddScheduleFromTemplateParams extends TxParams {
231265
beneficiary: string;
232266
templateName: string;
233267
startTime?: Date;
234268
}
235269

270+
/**
271+
* @param beneficiary Address of the beneficiary for whom it is modified
272+
* @param templateName Name of the template was used for schedule creation
273+
* @param startTime Start time of the created vesting schedule
274+
*/
236275
interface ModifyScheduleParams extends TxParams {
237276
beneficiary: string;
238277
templateName: string;
239278
startTime?: Date;
240279
}
241280

281+
/**
282+
* @param beneficiary Address of the beneficiary for whom it is revoked
283+
* @param templateName Name of the template was used for schedule creation
284+
*/
242285
interface RevokeScheduleParams extends TxParams {
243286
beneficiary: string;
244287
templateName: string;
245288
}
246289

290+
/**
291+
* @param beneficiary Address of the beneficiary for whom all schedules will be revoked
292+
*/
247293
interface RevokeAllSchedulesParams extends TxParams {
248294
beneficiary: string;
249295
}
250296

297+
/**
298+
* @param beneficiary Address of the beneficiary who will receive tokens
299+
* @param templateName Name of the template was used for schedule creation
300+
*/
251301
interface GetScheduleParams {
252302
beneficiary: string;
253303
templateName: string;
254304
}
255305

306+
/**
307+
* @param beneficiary Address of the beneficiary
308+
*/
256309
interface GetTemplateNamesParams {
257310
beneficiary: string;
258311
}
259312

313+
/**
314+
* @param beneficiary Address of the beneficiary
315+
*/
260316
interface GetScheduleCountParams {
261317
beneficiary: string;
262318
}
263319

320+
/**
321+
* @param fromIndex Start index of array of beneficiary's addresses
322+
* @param toIndex End index of array of beneficiary's addresses
323+
*/
264324
interface PushAvailableTokensMultiParams extends TxParams {
265325
fromIndex: number;
266326
toIndex: number;
267327
}
268328

329+
/**
330+
* @param beneficiaries Array of the beneficiary's addresses
331+
* @param templateNames Array of the template names
332+
* @param numberOfTokens Array of number of tokens should be assigned to schedules
333+
* @param durations Array of the vesting duration
334+
* @param frequencies Array of the vesting frequency
335+
* @param startTimes Array of the vesting start time
336+
*/
269337
interface AddScheduleMultiParams extends TxParams {
270338
beneficiaries: string[];
271339
templateNames: string[];
@@ -275,16 +343,29 @@ interface AddScheduleMultiParams extends TxParams {
275343
startTimes: Date[];
276344
}
277345

346+
/**
347+
* @param beneficiaries Array of beneficiary's addresses
348+
* @param templateNames Array of the template names were used for schedule creation
349+
* @param startTimes Array of the vesting start time
350+
*/
278351
interface AddScheduleFromTemplateMultiParams extends TxParams {
279352
beneficiaries: string[];
280353
templateNames: string[];
281354
startTimes: Date[];
282355
}
283356

357+
/**
358+
* @param beneficiaries Array of the beneficiary's addresses
359+
*/
284360
interface RevokeSchedulesMultiParams extends TxParams {
285361
beneficiaries: string[];
286362
}
287363

364+
/**
365+
* @param beneficiaries Array of the beneficiary's addresses
366+
* @param templateNames Array of the template names
367+
* @param startTimes Array of the vesting start time
368+
*/
288369
interface ModifyScheduleMultiParams extends TxParams {
289370
beneficiaries: string[];
290371
templateNames: string[];
@@ -354,6 +435,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
354435
return (await this.contract).getDataStore.callAsync();
355436
};
356437

438+
/**
439+
* Used to change the treasury wallet address
440+
*/
357441
public changeTreasuryWallet = async (params: ChangeTreasuryWalletParams) => {
358442
return (await this.contract).changeTreasuryWallet.sendTransactionAsync(
359443
params.newTreasuryWallet,
@@ -362,6 +446,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
362446
);
363447
};
364448

449+
/**
450+
* Used to deposit tokens from treasury wallet to the vesting escrow wallet
451+
*/
365452
public depositTokens = async (params: DepositTokensParams) => {
366453
return (await this.contract).depositTokens.sendTransactionAsync(
367454
numberToBigNumber(params.numberOfTokens),
@@ -370,6 +457,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
370457
);
371458
};
372459

460+
/**
461+
* Sends unassigned tokens to the treasury wallet
462+
*/
373463
public sendToTreasury = async (params: SendToTreasuryParams) => {
374464
return (await this.contract).sendToTreasury.sendTransactionAsync(
375465
numberToBigNumber(params.amount),
@@ -378,10 +468,16 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
378468
);
379469
};
380470

471+
/**
472+
* Returns the treasury wallet address
473+
*/
381474
public getTreasuryWallet = async () => {
382475
return (await this.contract).getTreasuryWallet.callAsync();
383476
};
384477

478+
/**
479+
* Pushes available tokens to the beneficiary's address
480+
*/
385481
public pushAvailableTokens = async (params: PushAvailableTokensParams) => {
386482
return (await this.contract).pushAvailableTokens.sendTransactionAsync(
387483
params.beneficiary,
@@ -390,10 +486,16 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
390486
);
391487
};
392488

489+
/**
490+
* Used to withdraw available tokens by beneficiary
491+
*/
393492
public pullAvailableTokens = async (params: TxParams) => {
394493
return (await this.contract).pullAvailableTokens.sendTransactionAsync(params.txData, params.safetyFactor);
395494
};
396495

496+
/**
497+
* Adds template that can be used for creating schedule
498+
*/
397499
public addTemplate = async (params: AddTemplateParams) => {
398500
return (await this.contract).addTemplate.sendTransactionAsync(
399501
params.name,
@@ -405,18 +507,32 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
405507
);
406508
};
407509

510+
/**
511+
* Removes template with a given name
512+
*/
408513
public removeTemplate = async (params: RemoveTemplateParams) => {
409514
return (await this.contract).removeTemplate.sendTransactionAsync(params.name, params.txData, params.safetyFactor);
410515
};
411516

517+
/**
518+
* Returns count of the templates those can be used for creating schedule
519+
* @return Count of the templates
520+
*/
412521
public getTemplateCount = async () => {
413522
return (await this.contract).getTreasuryWallet.callAsync();
414523
};
415524

525+
/**
526+
* Gets the list of the template names those can be used for creating schedule
527+
* @return bytes32 Array of all template names were created
528+
*/
416529
public getAllTemplateNames = async () => {
417530
return (await this.contract).getTreasuryWallet.callAsync();
418531
};
419532

533+
/**
534+
* Adds vesting schedules for each of the beneficiary's address
535+
*/
420536
public addSchedule = async (params: AddScheduleParams) => {
421537
let startTime = new BigNumber(0);
422538
if (params.startTime) {
@@ -435,6 +551,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
435551
);
436552
};
437553

554+
/**
555+
* Adds vesting schedules from template for the beneficiary
556+
*/
438557
public addScheduleFromTemplate = async (params: AddScheduleFromTemplateParams) => {
439558
let startTime = new BigNumber(0);
440559
if (params.startTime) {
@@ -449,6 +568,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
449568
);
450569
};
451570

571+
/**
572+
* Modifies vesting schedules for each of the beneficiary
573+
*/
452574
public modifySchedule = async (params: ModifyScheduleParams) => {
453575
let startTime = new BigNumber(0);
454576
if (params.startTime) {
@@ -463,6 +585,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
463585
);
464586
};
465587

588+
/**
589+
* Revokes vesting schedule with given template name for given beneficiary
590+
*/
466591
public revokeSchedule = async (params: RevokeScheduleParams) => {
467592
return (await this.contract).revokeSchedule.sendTransactionAsync(
468593
params.beneficiary,
@@ -472,6 +597,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
472597
);
473598
};
474599

600+
/**
601+
* Revokes all vesting schedules for given beneficiary's address
602+
*/
475603
public revokeAllSchedules = async (params: RevokeAllSchedulesParams) => {
476604
return (await this.contract).revokeAllSchedules.sendTransactionAsync(
477605
params.beneficiary,
@@ -480,18 +608,33 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
480608
);
481609
};
482610

611+
/**
612+
* Returns beneficiary's schedule created using template name
613+
* @return beneficiary's schedule data (numberOfTokens, duration, frequency, startTime, claimedTokens, State)
614+
*/
483615
public getSchedule = async (params: GetScheduleParams) => {
484616
return (await this.contract).getSchedule.callAsync(params.beneficiary, params.templateName);
485617
};
486618

619+
/**
620+
* Returns list of the template names for given beneficiary's address
621+
* @return List of the template names that were used for schedule creation
622+
*/
487623
public getTemplateNames = async (params: GetTemplateNamesParams) => {
488624
return (await this.contract).getTemplateNames.callAsync(params.beneficiary);
489625
};
490626

627+
/**
628+
* Returns count of the schedules were created for given beneficiary
629+
* @return Count of beneficiary's schedules
630+
*/
491631
public getScheduleCount = async (params: GetScheduleCountParams) => {
492632
return (await this.contract).getScheduleCount.callAsync(params.beneficiary);
493633
};
494634

635+
/**
636+
* Used to bulk send available tokens for each of the beneficiaries
637+
*/
495638
public pushAvailableTokensMulti = async (params: PushAvailableTokensMultiParams) => {
496639
return (await this.contract).pushAvailableTokensMulti.sendTransactionAsync(
497640
numberToBigNumber(params.fromIndex),
@@ -501,6 +644,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
501644
);
502645
};
503646

647+
/**
648+
* Used to bulk add vesting schedules for each of beneficiary
649+
*/
504650
public addScheduleMulti = async (params: AddScheduleMultiParams) => {
505651
return (await this.contract).addScheduleMulti.sendTransactionAsync(
506652
params.beneficiaries,
@@ -522,6 +668,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
522668
);
523669
};
524670

671+
/**
672+
* Used to bulk add vesting schedules from template for each of the beneficiary
673+
*/
525674
public addScheduleFromTemplateMulti = async (params: AddScheduleFromTemplateMultiParams) => {
526675
return (await this.contract).addScheduleFromTemplateMulti.sendTransactionAsync(
527676
params.beneficiaries,
@@ -534,6 +683,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
534683
);
535684
};
536685

686+
/**
687+
* Used to bulk revoke vesting schedules for each of the beneficiaries
688+
*/
537689
public revokeSchedulesMulti = async (params: RevokeSchedulesMultiParams) => {
538690
return (await this.contract).revokeSchedulesMulti.sendTransactionAsync(
539691
params.beneficiaries,
@@ -542,6 +694,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
542694
);
543695
};
544696

697+
/**
698+
* Used to bulk modify vesting schedules for each of the beneficiaries
699+
*/
545700
public modifyScheduleMulti = async (params: ModifyScheduleMultiParams) => {
546701
return (await this.contract).modifyScheduleMulti.sendTransactionAsync(
547702
params.beneficiaries,

0 commit comments

Comments
 (0)