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

Commit 99039e5

Browse files
author
Victor Wiebe
committed
feat: 🎸 finish adding comments and small fixes to rest of proj
1 parent b4233aa commit 99039e5

12 files changed

+771
-100
lines changed

‎src/contract_wrappers/modules/module_factory_wrapper.ts‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,52 @@ interface ModuleFactorySubscribeAsyncParams extends Subscribe {
7777
>;
7878
}
7979

80+
/**
81+
* @param setupCost Cost to setup module
82+
*/
8083
interface ChangeSetupCostParams extends TxParams {
8184
setupCost: BigNumber;
8285
}
8386

87+
/**
88+
* @param isCostInPoly Boolean if cost is in poly
89+
*/
8490
interface ChangeCostAndTypeParams extends ChangeSetupCostParams {
8591
isCostInPoly: boolean;
8692
}
8793

94+
/**
95+
* @param title New title
96+
*/
8897
interface ChangeTitleParams extends TxParams {
8998
title: string;
9099
}
91100

101+
/**
102+
* @param description New description
103+
*/
92104
interface ChangeDescriptionParams extends TxParams {
93105
description: string;
94106
}
95107

108+
/**
109+
* @param name New name
110+
*/
96111
interface ChangeNameParams extends TxParams {
97112
name: string;
98113
}
99114

115+
/**
116+
* @param tag New tag
117+
*/
100118
interface ChangeTagsParams extends TxParams {
101119
tags: string[];
102120
}
103121

122+
/**
123+
* @param boundType Type of STVersionBound
124+
* @param newVersion New version
125+
*/
104126
interface ChangeSTVersionBoundsParams extends TxParams {
105127
boundType: BoundType;
106128
newVersion: number[];
@@ -124,13 +146,15 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
124146

125147
/**
126148
* Get the owner of the Module Factory
149+
* @return owner address
127150
*/
128-
public owner = async () => {
151+
public owner = async (): Promise<string> => {
129152
return (await this.contract).owner.callAsync();
130153
};
131154

132155
/**
133156
* Get the name of the Module
157+
* @return name
134158
*/
135159
public name = async (): Promise<string> => {
136160
const name = await (await this.contract).name.callAsync();
@@ -139,34 +163,39 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
139163

140164
/**
141165
* Get the title of the Module
166+
* @return title
142167
*/
143168
public title = async (): Promise<string> => {
144169
return (await this.contract).title.callAsync();
145170
};
146171

147172
/**
148173
* Get isCostInPoly
174+
* @return boolean
149175
*/
150176
public isCostInPoly = async (): Promise<boolean> => {
151177
return (await this.contract).isCostInPoly.callAsync();
152178
};
153179

154180
/**
155181
* Get the description of the Module
182+
* @return description string
156183
*/
157184
public description = async (): Promise<string> => {
158185
return (await this.contract).description.callAsync();
159186
};
160187

161188
/**
162189
* Get the version of the Module
190+
* @return version string
163191
*/
164192
public version = async (): Promise<string> => {
165193
return (await this.contract).version.callAsync();
166194
};
167195

168196
/**
169197
* Get the types
198+
* @return list of module types
170199
*/
171200
public getTypes = async (): Promise<ModuleType[]> => {
172201
return (await (await this.contract).getTypes.callAsync()).map(type => {
@@ -176,6 +205,7 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
176205

177206
/**
178207
* Get the tags
208+
* @return tags list
179209
*/
180210
public getTags = async (): Promise<string[]> => {
181211
return bytes32ArrayToStringArray(await (await this.contract).getTags.callAsync());
@@ -291,6 +321,7 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
291321

292322
/**
293323
* Get setup cost
324+
* @return setupCost value
294325
*/
295326
public setupCost = async (): Promise<BigNumber> => {
296327
const value = await (await this.contract).setupCost.callAsync();
@@ -299,20 +330,23 @@ export default class ModuleFactoryWrapper extends ContractWrapper {
299330

300331
/**
301332
* Get upper ST version bounds
333+
* @return upper bounds list
302334
*/
303335
public getUpperSTVersionBounds = async (): Promise<BigNumber[]> => {
304336
return (await (await this.contract).getUpperSTVersionBounds.callAsync()).map(v => new BigNumber(v));
305337
};
306338

307339
/**
308340
* Get lower ST version bounds
341+
* @return lower bounds list
309342
*/
310343
public getLowerSTVersionBounds = async (): Promise<BigNumber[]> => {
311344
return (await (await this.contract).getLowerSTVersionBounds.callAsync()).map(v => new BigNumber(v));
312345
};
313346

314347
/**
315348
* Get setup cost in poly
349+
* @return cost in poly
316350
*/
317351
public setupCostInPoly = async (): Promise<BigNumber> => {
318352
const value = await (await this.contract).setupCostInPoly.callAsync();

‎src/contract_wrappers/modules/module_wrapper.ts‎

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import { stringToBytes32 } from '../../utils/convert';
1313
import functionsUtils from '../../utils/functions_utils';
1414
import assert from '../../utils/assert';
1515

16+
/**
17+
* @param tokenContract ERC20 Token Contract Address
18+
*/
1619
interface ReclaimERC20Params extends TxParams {
1720
tokenContract: string;
1821
}
@@ -62,31 +65,57 @@ export default class ModuleWrapper extends ContractWrapper {
6265
this.contractFactory = contractFactory;
6366
}
6467

65-
public getInitFunction = async () => {
68+
/**
69+
* Return init function result
70+
* @return init function string
71+
*/
72+
public getInitFunction = async (): Promise<string> => {
6673
return (await this.contract).getInitFunction.callAsync();
6774
};
6875

69-
public polyToken = async () => {
76+
/**
77+
* Return poly token address
78+
* @return address
79+
*/
80+
public polyToken = async (): Promise<string> => {
7081
return (await this.contract).polyToken.callAsync();
7182
};
7283

73-
public securityToken = async () => {
84+
/**
85+
* Return security token address
86+
* @return address
87+
*/
88+
public securityToken = async (): Promise<string> => {
7489
return (await this.contract).securityToken.callAsync();
7590
};
7691

77-
public getPermissions = async () => {
92+
/**
93+
* Return permissions
94+
* @return list of permissions
95+
*/
96+
public getPermissions = async (): Promise<string[]> => {
7897
return (await this.contract).getPermissions.callAsync();
7998
};
8099

81-
public factory = async () => {
100+
/**
101+
* Return factory address
102+
* @return address
103+
*/
104+
public factory = async (): Promise<string> => {
82105
return (await this.contract).factory.callAsync();
83106
};
84107

108+
/**
109+
* Reclaim ETH from contract
110+
*/
85111
public reclaimETH = async (params: TxParams) => {
86112
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
87113
return (await this.contract).reclaimETH.sendTransactionAsync(params.txData, params.safetyFactor);
88114
};
89115

116+
/**
117+
* Reclaim ERC20 tokens from contract
118+
*/
90119
public reclaimERC20 = async (params: ReclaimERC20Params) => {
91120
assert.assert(await this.isCallerTheSecurityTokenOwner(params.txData), 'The caller must be the ST owner');
92121
assert.isNonZeroETHAddressHex('tokenContract', params.tokenContract);

‎src/contract_wrappers/registries/feature_registry_wrapper.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,19 @@ export default class FeatureRegistryWrapper extends ContractWrapper {
8585
this.contract = contract;
8686
}
8787

88-
public owner = async () => {
88+
/**
89+
* Get owner of contract
90+
* @return address
91+
*/
92+
public owner = async (): Promise<string> => {
8993
return (await this.contract).owner.callAsync();
9094
};
9195

9296
/**
9397
* Get the status of a feature
9498
* @return bool
9599
*/
96-
public getFeatureStatus = async (params: GetFeatureStatusParams) => {
100+
public getFeatureStatus = async (params: GetFeatureStatusParams): Promise<boolean> => {
97101
return (await this.contract).getFeatureStatus.callAsync(params.nameKey);
98102
};
99103

@@ -119,15 +123,15 @@ export default class FeatureRegistryWrapper extends ContractWrapper {
119123
* Get the CustomModulesAllowed status
120124
* @return bool
121125
*/
122-
public getCustomModulesAllowedStatus = async () => {
126+
public getCustomModulesAllowedStatus = async (): Promise<boolean> => {
123127
return (await this.contract).getFeatureStatus.callAsync(Feature.CustomModulesAllowed);
124128
};
125129

126130
/**
127131
* Get the FreezeMintingAllowed status
128132
* @return bool
129133
*/
130-
public getFreezeMintingAllowedStatus = async () => {
134+
public getFreezeMintingAllowedStatus = async (): Promise<boolean> => {
131135
return (await this.contract).getFeatureStatus.callAsync(Feature.FreezeMintingAllowed);
132136
};
133137

0 commit comments

Comments
 (0)