Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Commit 8b9e1c2

Browse files
authored
Merge pull request #51 from PolymathNetwork/clean-comments
Clean comments
2 parents e18feee + 978c3b1 commit 8b9e1c2

12 files changed

+42
-53
lines changed

src/contract_wrappers/Compliance.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export default class Compliance extends ContractWrapper {
2929
constructor(
3030
web3Wrapper: Web3Wrapper,
3131
customers: Customers,
32-
// securityTokenRegistrar: SecurityTokenRegistrar,
3332
deployedAddress?: string,
3433
) {
3534
super(web3Wrapper, complianceArtifact, deployedAddress);
@@ -311,6 +310,7 @@ export default class Compliance extends ContractWrapper {
311310

312311
/**
313312
* Returns all Template proposals
313+
* @param SecurityTokenAddress Address of the Security Token
314314
* @return An array of addresses
315315
*/
316316
async getAllTemplateProposals(
@@ -323,6 +323,7 @@ export default class Compliance extends ContractWrapper {
323323

324324
/**
325325
* Returns all STO proposal addresses
326+
* @param SecurityTokenAddress Address of the Security Token
326327
* @return An array of addresses
327328
*/
328329
async getAllOfferingProposals(

src/contract_wrappers/ContractWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class ContractWrapper {
2323
_contract: any;
2424

2525
_filters: { [string]: Web3Filter };
26-
// _filterCallback: { [string]: EventCallback<mixed> };
26+
//_filterCallback: { [string]: EventCallback<mixed> }; - from dave : need to examine if we need this
2727

2828
isInitialized: boolean;
2929
isInitializing: boolean;

src/contract_wrappers/Customers.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class Customers extends ContractWrapper {
5959
): string {
6060
const wrappedCallback = callback;
6161

62-
//* *temporarily green this out, it isnt working, might not need */
62+
//* *temporarily green this out, it isnt working, might not need - DAVE */
6363

6464
// if (eventName === 'LogCustomerVerified') {
6565
// // Convert from number roles to string enum roles.
@@ -185,7 +185,8 @@ export default class Customers extends ContractWrapper {
185185
* Submit an on-chain record that you have verified a customer's information.
186186
* @param kycProviderAddress The Ethereum address of your KYC provider account
187187
* @param customerAddress The Ethereum address of the customer you verified
188-
* @param jurisdiction The customer's jurisdiction that you verified. Either an ISO 3166-1 alpha-2 country code or an ISO 3166-2 country subdivision code.
188+
* @param countryJurisdiction The customer's jurisdiction that you verified. An ISO 3166-1 alpha-2 country code
189+
* @param divisionJurisdiction The customer's jurisdiction that you verified. An ISO 3166-2 country subdivision code.
189190
* @param role The type of Polymath user that the customer is (e.g. investor)
190191
* @param accredited Whether the customer is accredited
191192
* @param expires The time at which this verification should expire, in seconds since the Unix epoch

src/contract_wrappers/SecurityToken.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ export default class SecurityToken extends ContractWrapper {
284284

285285
/**
286286
* Start the Offering after the template and STO selection
287-
* @param owner Address of the Owner of a Security Token
287+
* @param owner Address of the Owner of a Security Token
288288
*/
289289
async startSecurityTokenOffering(owner: string) {
290290
await this._contract.startOffering({
@@ -437,6 +437,7 @@ export default class SecurityToken extends ContractWrapper {
437437
}
438438

439439
/** Queries the shareholder details.
440+
*
440441
* @return Returns the type {@link Shareholder}
441442
*/
442443
async getShareholderDetails(
@@ -445,7 +446,9 @@ export default class SecurityToken extends ContractWrapper {
445446
return this._contract.shareholders.call(shareholderAddress);
446447
}
447448

448-
/** Queries the POLY allocation details, which cover the rules determining if the stakeholder will receive their POLY vesting.
449+
/**
450+
* Queries the POLY allocation details, which cover the rules determining if the stakeholder will receive their POLY vesting.
451+
* @param polyStakeholderAddress The address of the stakeholder
449452
* @return Returns the type {@link PolyAllocation}
450453
*/
451454
async getPolyAllocationDetails(
@@ -455,13 +458,16 @@ export default class SecurityToken extends ContractWrapper {
455458
}
456459

457460
/** Checks to see how much a shareholder has contributed to the Security token.
461+
* @param contributorAddress The address of the contributor
458462
* @return The amount the user has contributed contributed
459463
*/
460464
async getContributedToSTO(contributorAddress: string): Promise<BigNumber> {
461465
return this._contract.contributedToSTO.call(contributorAddress);
462466
}
463467

464468
/** Get information on if a shareholder has voted to freeze a POLY allocation.
469+
* @param userAddress The address of the user who wants to vote
470+
* @param addressBeingVotedOn The stakeholder who is being voted agaisnt
465471
* @return True if the shareholder has voted to freeze
466472
*/
467473
async getVoted(

src/contract_wrappers/SecurityTokenRegistrar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ export default class SecurityTokenRegistrar extends ContractWrapper {
7171
* @param name Name of the security token
7272
* @param ticker Ticker name of the security
7373
* @param totalSupply Total amount of tokens being created
74+
* @param decimals The number of decimal places that the tokens can be split up into
7475
* @param owner Public Key address of the security token owner
76+
* @param maxPoly Amount of POLY being raised
7577
* @param host The host of the security token wizard
7678
* @param fee POLY Fee being requested by the wizard host
7779
* @param type Type of security being tokenized (NEED TOKEN NUMBERS ie. security:1, somethingelse:2)
78-
* @param maxPoly Amount of POLY being raised
7980
* @param lockupPeriod Length of time (unix) raised POLY will be locked up for dispute
8081
* @param quorum Percent of initial investors required to freeze POLY raise
8182
*/

src/contract_wrappers/Template.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ export default class Template extends ContractWrapper {
154154

155155
/**
156156
* Checks if the template requirements for jurisdiction, accreditation, and role are met.
157-
* @param jurisdiction The ISO-3166 code of the investors jurisdiction (solidity type bytes32)
158-
* @param accredited Defines if the investor is accredited or not
159-
* @param role Role string used to see if the role is allowed for a security token (solidity type uint8)
157+
* @param countryJurisdiction The customer's jurisdiction that you verified. An ISO 3166-1 alpha-2 country code
158+
* @param divisionJurisdiction The customer's jurisdiction that you verified. An ISO 3166-2 country subdivision code.
159+
* @param accredited Defines if the investor is accredited or not
160+
* @param role Role string used to see if the role is allowed for a security token (solidity type uint8)
160161
* @return True if it all template requirements are met
161162
*/
162163
async checkTemplateRequirements(
@@ -246,26 +247,29 @@ export default class Template extends ContractWrapper {
246247

247248
/**
248249
* Checks if the jurisdiction is allowed for this template
250+
* @param countryJurisdiction The customer's jurisdiction that you verified. An ISO 3166-1 alpha-2 country code
249251
* @return True if the jurisdiction is allowed
250252
*/
251253
async checkIfCountryJurisdictionIsAllowed(
252-
jurisdiction: string,
254+
countryJurisdiction: string,
253255
): Promise<boolean> {
254-
return this._contract.allowedJurisdictions.call(jurisdiction);
256+
return this._contract.allowedJurisdictions.call(countryJurisdiction);
255257
}
256258

257259
/**
258260
* Checks if the jurisdiction division is allowed for this template
261+
* @param divisionJurisdiction The customer's jurisdiction that you verified. An ISO 3166-2 country subdivision code.
259262
* @return True if the division is allowed
260263
*/
261264
async checkIfDivisionJurisdictionIsAllowed(
262-
jurisdiction: string,
265+
divisionJurisdiction: string,
263266
): Promise<boolean> {
264-
return this._contract.blockedDivisionJurisdictions.call(jurisdiction);
267+
return this._contract.blockedDivisionJurisdictions.call(divisionJurisdiction);
265268
}
266269

267270
/**
268271
* Checks if a role is allowed for the template
272+
* @param role The role we are checking
269273
* @return True if the role is allowed
270274
*/
271275
async checkIfRoleIsAllowed(role: number): Promise<boolean> {

test/Compliance_test.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ describe('Compliance wrapper', () => {
134134
});
135135
});
136136

137-
await makeKYCProvider(customers, accounts[1], expiryTime);
137+
await makeKYCProvider(customers, accounts[1]);
138138
await makeLegalDelegate(polyToken, customers, accounts[1], accounts[2], expiryTime);
139139
const templateAddress = await makeTemplateWithFinalized(
140140
compliance,
@@ -154,7 +154,6 @@ describe('Compliance wrapper', () => {
154154
let logNewTemplateProposal = await logNewTemplateProposalArgsPromise;
155155
assert.equal(logNewTemplateProposal._securityToken, securityToken.address, 'ST address not picked up from LogNewTemplateProposal event') //needs to be renamed from core
156156

157-
158157
// Reputation
159158
let templateReputation = await compliance.getTemplateReputation(templateAddress);
160159
assert.equal(templateReputation.owner, accounts[2], "TemplateReputation not stored or read properly");
@@ -167,7 +166,6 @@ describe('Compliance wrapper', () => {
167166
let arrayOfTemplates = await compliance.getAllTemplateProposals(securityToken.address)
168167
assert.equal(arrayOfTemplates[0], templateAddress, 'Template address does not match the getter function return');
169168

170-
171169
await compliance.cancelTemplateProposal(accounts[2], securityToken.address, 0);
172170

173171
let logCancleTemplateProposal = await logCancleTemplateProposalArgsPromise;
@@ -180,15 +178,11 @@ describe('Compliance wrapper', () => {
180178

181179
});
182180

183-
184181
it('getMinimumVestingPeriod', async () => {
185182
let minimum = await compliance.getMinimumVestingPeriod();
186183
assert.equal(minimum, 60 * 60 * 24 * 100, "Does not equal 100 days, when it should")
187184
})
188185

189-
// so we need to have a securityToken actually created through STRegistrar
190-
// and so me of the stuff has to match up
191-
// then we have an actual one in offeringProposals
192186
it('setSTO, proposeSTO, cancleSTO, getSTOProposal, getSTOAddressByProposal, getAllOfferingProposals', async () => {
193187

194188
//subscribtion setup
@@ -287,9 +281,6 @@ describe('Compliance wrapper', () => {
287281
let logNewContractProposal = await logNewContractProposalArgsPromise;
288282
assert.equal(logNewContractProposal._delegate, auditor, 'legal delegate not picked up from LogNewProposal event') //needs to be renamed from core
289283

290-
//to confirm setSTO, we need to check offerings for the msg.sender addr
291-
//which is using getOfferingByProposal
292-
//in setSTO we
293284
let getSTO = await compliance.getSTOProposal(securityToken.address, 0)
294285
assert.equal(getSTO.auditorAddress, auditor, "Auditor address not read properly");
295286

@@ -304,19 +295,15 @@ describe('Compliance wrapper', () => {
304295
// Cancel Proposal
305296
await compliance.cancelSTOProposal(auditor, securityToken.address, 0);
306297

307-
//LOGCANCLESTOPROPOSAL
308298
let logCancleContractProposal = await logCancleContractProposalArgsPromise;
309299
assert.equal(logNewContractProposal._securityToken, securityToken.address, 'ST address not picked up from LogCancleContractProposal event') //needs to be renamed from core
310300

311301

312-
313302
const addressShouldBeZero = await compliance.getSTOAddressByProposal(securityToken.address, 0)
314303
assert.equal(addressShouldBeZero, 0, 'Proposal did not return zero, which it should have for being cancelled');
315304

316305
await compliance.unsubscribe(subscriptionID3);
317306
await compliance.unsubscribe(subscriptionID5);
318-
319-
320307
})
321308

322309
it('LogTemplateCreated event test, subscribe, unsubscribe', async () => {
@@ -337,7 +324,7 @@ describe('Compliance wrapper', () => {
337324
});
338325
});
339326

340-
await makeKYCProvider(customers, accounts[1], expiryTime);
327+
await makeKYCProvider(customers, accounts[1]);
341328
await makeLegalDelegate(polyToken, customers, accounts[1], accounts[2], expiryTime);
342329
const templateAddress = await makeTemplate(
343330
compliance,
@@ -346,16 +333,11 @@ describe('Compliance wrapper', () => {
346333
expiryTime,
347334
);
348335

349-
350336
const logTemplateCreated = await logTemplateCreatedArgsPromise;
351337
assert.equal(logTemplateCreated._creator, accounts[2], 'legal delegate creator address wasnt found in event subscription'); //'offeringtype' from make_examples.js
352338
assert.isAbove(logTemplateCreated._template.length, 20, 'template address wasnt found in event subscription');
353339
assert.equal(logTemplateCreated._offeringType, "offeringtype", 'offering type wasnt found in event subscription'); //'offeringtype' from make_examples.js
354340
await compliance.unsubscribe(subscriptionID1);
355341

356-
357342
})
358-
359-
360-
361343
});

test/Customers_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('Customers wrapper', () => {
2424
polyToken = await makePolyToken(web3Wrapper, accounts[0]);
2525
customers = await makeCustomers(web3Wrapper, polyToken, accounts[0]);
2626

27-
// Fund two accounts.
27+
// Fund three accounts.
2828
await polyToken.generateNewTokens(
2929
new BigNumber(10).toPower(18).times(100000),
3030
accounts[0],

test/SecurityTokenRegistrar_test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('Registrar wrapper', () => {
3131
});
3232

3333
beforeEach(async () => {
34-
// parameters for Template constructor
3534
polyToken = await makePolyToken(web3Wrapper, accounts[0]);
3635
customers = await makeCustomers(web3Wrapper, polyToken, accounts[0]);
3736

@@ -95,9 +94,6 @@ describe('Registrar wrapper', () => {
9594
quorum,
9695
);
9796

98-
// const address = await registrar.getSecurityTokenAddress(ticker);
99-
// const tokenData = await registrar.getSecurityTokenData(address);
100-
10197
const logs = await registrar.getLogs(
10298
'LogNewSecurityToken',
10399
{},
@@ -173,7 +169,7 @@ describe('Registrar wrapper', () => {
173169
const fee = 1000;
174170
const type = 1;
175171
const maxPoly = 100000;
176-
const lockupPeriod = expiryTime + 31557600; // one year from jan 19 2017
172+
const lockupPeriod = expiryTime + 31557600; // one year ahead
177173
const quorum = 75;
178174

179175
await polyToken.approve(owner, registrar.address, fee);

test/SecurityToken_test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('SecurityToken wrapper', () => {
5959
expiryTime,
6060
);
6161

62-
// Fund four accounts.
62+
// Fund five accounts.
6363
await polyToken.generateNewTokens(
6464
new BigNumber(10).toPower(18).times(100000),
6565
accounts[0],
@@ -252,7 +252,7 @@ describe('SecurityToken wrapper', () => {
252252
2592000,
253253
); // 1 Month duration
254254

255-
await makeKYCProvider(customers, kycProvider, expiryTime);
255+
await makeKYCProvider(customers, kycProvider);
256256

257257
await makeLegalDelegate(polyToken, customers, kycProvider, legalDelegate, expiryTime);
258258

@@ -322,7 +322,7 @@ describe('SecurityToken wrapper', () => {
322322
const kycProvider = accounts[1];
323323
const investor = accounts[3];
324324
const expiryTime = new BigNumber(web3.eth.getBlock('latest').timestamp).plus(10000);
325-
await makeKYCProvider(customers, kycProvider, expiryTime);
325+
await makeKYCProvider(customers, kycProvider);
326326

327327
await makeLegalDelegate(polyToken, customers, kycProvider, legalDelegate, expiryTime);
328328

@@ -403,7 +403,7 @@ describe('SecurityToken wrapper', () => {
403403
2592000,
404404
); // 1 Month duration
405405

406-
await makeKYCProvider(customers, kycProvider, expiryTime);
406+
await makeKYCProvider(customers, kycProvider);
407407

408408
await makeLegalDelegate(polyToken, customers, kycProvider, legalDelegate, expiryTime);
409409

@@ -657,7 +657,7 @@ describe('SecurityToken wrapper', () => {
657657
const legalDelegate = accounts[2];
658658
const investor = accounts[3];
659659
const expiryTime = new BigNumber(web3.eth.getBlock('latest').timestamp).plus(10000);
660-
await makeKYCProvider(customers, kycProvider, expiryTime);
660+
await makeKYCProvider(customers, kycProvider);
661661

662662
await makeLegalDelegate(polyToken, customers, kycProvider, legalDelegate, expiryTime);
663663
const templateAddress = await makeTemplateWithFinalized(
@@ -765,7 +765,6 @@ describe('SecurityToken wrapper', () => {
765765
reject(err);
766766
return;
767767
}
768-
// console.log
769768
resolve(log.args);
770769
},
771770
);
@@ -889,6 +888,7 @@ describe('SecurityToken wrapper', () => {
889888

890889
await polyToken.approve(investor, securityToken.address, 10000);
891890
await increaseTime(1000); // Time Jump of 1000 seconds to reach beyond the sto start date
891+
892892
// Bought Security Token using POLY
893893
await offering.buySecurityTokenWithPoly(investor, new BigNumber(10000));
894894
assert.equal(

test/Template_test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('Template wrapper', () => {
2929
const accredited = false;
3030
const KYC = accounts[1];
3131
const details = 'this would be hashes';
32-
const expires = expiryTime.toNumber()// + 1000000;
32+
const expires = expiryTime.toNumber();
3333

3434
const fee = 1000;
3535
const quorum = 10;
@@ -142,7 +142,7 @@ describe('Template wrapper', () => {
142142
});
143143

144144
it('updateTemplateDetails, getTemplateDetails', async () => {
145-
await template.updateTemplateDetails(accounts[0], fakeBytes32); // fake hash
145+
await template.updateTemplateDetails(accounts[0], fakeBytes32);
146146

147147
const getUpdatedDetails = await template.getTemplateDetails();
148148
const newHash = getUpdatedDetails[0];
@@ -225,7 +225,7 @@ describe('Template wrapper', () => {
225225
const jurisdictionDivision = 'ON';
226226
const accredited = false;
227227
const role = 'investor';
228-
const roleNotAdded = 'delegate'; // testing the failure
228+
const roleNotAdded = 'delegate';
229229

230230
await template.addJurisdiction(accounts[0], [jurisdictionCountry], [true]);
231231
await template.addDivisionJurisdiction(accounts[0], [jurisdictionDivision], [true]);
@@ -335,7 +335,7 @@ describe('Template wrapper', () => {
335335
});
336336
});
337337

338-
await template.updateTemplateDetails(accounts[0], fakeBytes32); // fake hash
338+
await template.updateTemplateDetails(accounts[0], fakeBytes32);
339339

340340
const detailsUpdated = await detailsUpdatedArgsPromise
341341
assert.equal(detailsUpdated._prevDetails, '0x7468697320776f756c6420626520686173686573000000000000000000000000', 'previous details wasnt found in event subscription'); //hash of 'this would be hashes'

0 commit comments

Comments
 (0)