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

Commit d74abe0

Browse files
authored
Merge pull request #47 from PolymathNetwork/dave-compliance-tests
Dave compliance tests
2 parents cf62575 + 5acaf8e commit d74abe0

File tree

3 files changed

+251
-49
lines changed

3 files changed

+251
-49
lines changed

src/contract_wrappers/Compliance.js

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export default class Compliance extends ContractWrapper {
4949
eventName:
5050
| 'LogTemplateCreated'
5151
| 'LogNewTemplateProposal'
52-
| 'LogNewContractProposal',
52+
| 'LogCancelTemplateProposal'
53+
| 'LogNewContractProposal'
54+
| 'LogCancelContractProposal',
5355
indexedFilterValues: IndexedFilterValues,
5456
callback: EventCallback<ComplianceEventArgs>,
5557
): string {
@@ -168,21 +170,21 @@ export default class Compliance extends ContractWrapper {
168170

169171
/**
170172
* Set an STO contract to be stored in the offerings mapping in Compliance.sol
171-
* @param issuerAddress Address of the offering contract owner or auditor
173+
* @param stoDeveloperAddress Address of the creator of the STO
172174
* @param stoAddress Address of the STO contract deployed over the network
173175
* @param fee Fee to be paid in poly to use that contract
174176
* @param vestingPeriod Number of days investor binded to hold the Security token
175177
* @param quorum Minimum percent of shareholders which need to vote to freeze
176178
*/
177179
async setSTO(
178-
issuerAddress: string,
180+
stoDeveloperAddress: string,
179181
stoAddress: string,
180182
fee: BigNumber,
181183
vestingPeriod: BigNumber,
182184
quorum: BigNumber,
183185
) {
184186
await this._contract.setSTO(stoAddress, fee, vestingPeriod, quorum, {
185-
from: issuerAddress,
187+
from: stoDeveloperAddress,
186188
gas: 200000,
187189
});
188190
}
@@ -236,7 +238,7 @@ export default class Compliance extends ContractWrapper {
236238
securityTokenAddress: string,
237239
proposalIndex: number,
238240
): Promise<string> {
239-
return this._contract.templateProposals.call(
241+
return this._contract.getTemplateByProposal.call(
240242
securityTokenAddress,
241243
proposalIndex,
242244
);
@@ -298,12 +300,36 @@ export default class Compliance extends ContractWrapper {
298300
async getTemplateReputation(
299301
templateAddress: string,
300302
): Promise<TemplateReputation> {
301-
const template = await this._contract.templates(templateAddress);
303+
const template = await this._contract.templates.call(templateAddress);
302304
return {
303305
owner: template[0],
304306
totalRaised: template[1],
305307
timesUsed: template[2],
306308
expires: template[3],
307309
};
308310
}
311+
312+
/**
313+
* Returns all Template proposals
314+
* @return An array of addresses
315+
*/
316+
async getAllTemplateProposals(
317+
securityTokenAddress: string,
318+
): Promise<Array<string>> {
319+
return await this._contract.getAllTemplateProposals.call(
320+
securityTokenAddress,
321+
);
322+
}
323+
324+
/**
325+
* Returns all STO proposal addresses
326+
* @return An array of addresses
327+
*/
328+
async getAllOfferingProposals(
329+
securityTokenAddress: string,
330+
): Promise<Array<string>> {
331+
return await this._contract.getAllOfferingProposals.call(
332+
securityTokenAddress,
333+
);
334+
}
309335
}

src/types.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ export type LogNewTemplateProposal = {
164164
_securityToken: string,
165165
_template: string,
166166
_delegate: string,
167+
_templateProposalIndex: number,
168+
};
169+
170+
/**
171+
* Arguments for the Compliance.sol LogCancelTemplateProposal event
172+
*/
173+
export type LogCancelTemplateProposal = {
174+
_securityToken: string,
175+
_offeringContract: string,
176+
_proposalIndex: number,
167177
};
168178

169179
/**
@@ -172,7 +182,17 @@ export type LogNewTemplateProposal = {
172182
export type LogNewContractProposal = {
173183
_securityToken: string,
174184
_offeringContract: string,
175-
_delegate: string,
185+
_auditor: string,
186+
_offeringProposalIndex: number,
187+
};
188+
189+
/**
190+
* Arguments for the Compliance.sol LogCancelContractProposal event
191+
*/
192+
export type LogCancelContractProposal = {
193+
_securityToken: string,
194+
_offeringContract: string,
195+
_proposalIndex: number,
176196
};
177197

178198
/**
@@ -181,7 +201,9 @@ export type LogNewContractProposal = {
181201
export type ComplianceEventArgs =
182202
| LogTemplateCreated
183203
| LogNewTemplateProposal
184-
| LogNewContractProposal;
204+
| LogCancelTemplateProposal
205+
| LogNewContractProposal
206+
| LogCancelContractProposal;
185207

186208
// SecurityToken types
187209

0 commit comments

Comments
 (0)