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

Commit b4233aa

Browse files
author
Victor Wiebe
committed
fix: 🐛 VEW comments
1 parent 6cad10f commit b4233aa

File tree

1 file changed

+57
-12
lines changed

1 file changed

+57
-12
lines changed

src/contract_wrappers/modules/wallet/vesting_escrow_wallet_wrapper.ts

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,25 @@ interface GetVestingEscrowWalletLogsAsyncParams extends GetLogs {
185185
(params: GetUnpauseLogsAsyncParams): Promise<LogWithDecodedArgs<VestingEscrowWalletUnpauseEventArgs>[]>;
186186
}
187187

188+
/**
189+
* @param beneficiary Beneficiary
190+
* @param index Index of schedule
191+
*/
188192
interface SchedulesParams {
189193
beneficiary: string;
190194
index: number;
191195
}
192196

197+
/**
198+
* @param index Index of template
199+
*/
193200
interface TemplateNamesParams {
194201
index: number;
195202
}
196203

204+
/**
205+
* @param index Index of beneficiary
206+
*/
197207
interface BeneficiariesParams {
198208
index: number;
199209
}
@@ -385,6 +395,8 @@ enum StateStatus {
385395
Completed,
386396
}
387397

398+
// RETURN TYPES
399+
388400
interface Schedule {
389401
templateName: string;
390402
claimedTokens: number;
@@ -421,33 +433,57 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
421433
this.contract = contract;
422434
}
423435

436+
/**
437+
* Unpause the module
438+
*/
424439
public unpause = async (params: TxParams) => {
425440
assert.assert(await this.paused(), 'Controller not currently paused');
426441
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'Sender is not owner');
427442
return (await this.contract).unpause.sendTransactionAsync(params.txData, params.safetyFactor);
428443
};
429444

430-
public paused = async () => {
445+
/**
446+
* Check if module paused
447+
* @return boolean is paused
448+
*/
449+
public paused = async (): Promise<boolean> => {
431450
return (await this.contract).paused.callAsync();
432451
};
433452

453+
/**
454+
* Pause the module
455+
*/
434456
public pause = async (params: TxParams) => {
435457
assert.assert(!(await this.paused()), 'Controller currently paused');
436458
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'Sender is not owner');
437459
return (await this.contract).pause.sendTransactionAsync(params.txData, params.safetyFactor);
438460
};
439461

440-
public treasuryWallet = async () => {
462+
/**
463+
* Address of the Treasury wallet. All of the unassigned token will transfer to that address.
464+
* @return address
465+
*/
466+
public treasuryWallet = async (): Promise<string> => {
441467
return (await this.contract).treasuryWallet.callAsync();
442468
};
443469

444-
public unassignedTokens = async () => {
470+
/**
471+
* Number of tokens that are hold by the `this` contract but are unassigned to any schedule
472+
* @return unassigned token value
473+
*/
474+
public unassignedTokens = async (): Promise<BigNumber> => {
445475
const result = await (await this.contract).unassignedTokens.callAsync();
446476
const decimals = await (await this.securityTokenContract()).decimals.callAsync();
447477
return weiToValue(result, decimals);
448478
};
449479

450-
public schedules = async (params: SchedulesParams) => {
480+
/**
481+
* Holds schedules array corresponds to the affiliate/employee address
482+
* @return templateName
483+
* @return claimedTokens amount
484+
* @return startTime date
485+
*/
486+
public schedules = async (params: SchedulesParams): Promise<Schedule> => {
451487
const result = await (await this.contract).schedules.callAsync(params.beneficiary, numberToBigNumber(params.index));
452488
const decimals = await (await this.securityTokenContract()).decimals.callAsync();
453489
const schedule: Schedule = {
@@ -458,12 +494,20 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
458494
return schedule;
459495
};
460496

461-
public templateNames = async (params: TemplateNamesParams) => {
497+
/**
498+
* List of all template names
499+
* @return name string
500+
*/
501+
public templateNames = async (params: TemplateNamesParams): Promise<string> => {
462502
const result = await (await this.contract).templateNames.callAsync(numberToBigNumber(params.index));
463503
return bytes32ToString(result);
464504
};
465505

466-
public beneficiaries = async (params: BeneficiariesParams) => {
506+
/**
507+
* List of all beneficiaries who have the schedules running/completed/created
508+
* @return beneficiary address
509+
*/
510+
public beneficiaries = async (params: BeneficiariesParams): Promise<string> => {
467511
return (await this.contract).beneficiaries.callAsync(numberToBigNumber(params.index));
468512
};
469513

@@ -532,8 +576,9 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
532576

533577
/**
534578
* Returns the treasury wallet address
579+
* @return treasury wallet address
535580
*/
536-
public getTreasuryWallet = async () => {
581+
public getTreasuryWallet = async (): Promise<string> => {
537582
return (await this.contract).getTreasuryWallet.callAsync();
538583
};
539584

@@ -596,7 +641,7 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
596641
* Returns the amount of templates that can be used for creating schedules
597642
* @return Amount of templates
598643
*/
599-
public getTemplateCount = async () => {
644+
public getTemplateCount = async (): Promise<number> => {
600645
const result = await (await this.contract).getTemplateCount.callAsync();
601646
return result.toNumber();
602647
};
@@ -605,7 +650,7 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
605650
* Gets the list of template names that can be used for creating schedules
606651
* @return Array of all template names
607652
*/
608-
public getAllTemplateNames = async () => {
653+
public getAllTemplateNames = async (): Promise<string[]> => {
609654
const results = await (await this.contract).getAllTemplateNames.callAsync();
610655
return bytes32ArrayToStringArray(results);
611656
};
@@ -696,7 +741,7 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
696741
* Returns a schedule with a given template name for a given beneficiary address
697742
* @return beneficiary's schedule data (numberOfTokens, duration, frequency, startTime, claimedTokens, state)
698743
*/
699-
public getSchedule = async (params: GetScheduleParams) => {
744+
public getSchedule = async (params: GetScheduleParams): Promise<BeneficiarySchedule> => {
700745
this.checkSchedule(params.beneficiary);
701746
const result = await (await this.contract).getSchedule.callAsync(
702747
params.beneficiary,
@@ -736,7 +781,7 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
736781
* Returns a list of the template names for a given beneficiary address
737782
* @return List of template names used for the beneficiary address' schedules
738783
*/
739-
public getTemplateNames = async (params: GetTemplateNamesParams) => {
784+
public getTemplateNames = async (params: GetTemplateNamesParams): Promise<string[]> => {
740785
assert.isNonZeroETHAddressHex('beneficiary', params.beneficiary);
741786
const result = await (await this.contract).getTemplateNames.callAsync(params.beneficiary);
742787
return bytes32ArrayToStringArray(result);
@@ -746,7 +791,7 @@ export default class VestingEscrowWalletWrapper extends ModuleWrapper {
746791
* Returns amount of schedules for a given beneficiary address
747792
* @return Amount of schedules
748793
*/
749-
public getScheduleCount = async (params: GetScheduleCountParams) => {
794+
public getScheduleCount = async (params: GetScheduleCountParams): Promise<number> => {
750795
assert.isNonZeroETHAddressHex('beneficiary', params.beneficiary);
751796
const result = await (await this.contract).getScheduleCount.callAsync(params.beneficiary);
752797
return result.toNumber();

0 commit comments

Comments
 (0)