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

Commit 987d78e

Browse files
committed
Move web3 wrapper from devDependencies to dependencies. Add Compliance and SecurityTokenRegistrar to the Polymath class. Remove SecurityTokenRegistrar's dependency on a SecurityToken.
1 parent 808a51d commit 987d78e

File tree

8 files changed

+13
-22
lines changed

8 files changed

+13
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@
5959
"mnemonic": "age drama cover door helmet mechanic wine lesson vote inflict will keep"
6060
},
6161
"dependencies": {
62+
"@0xproject/web3-wrapper": "0.1.2",
6263
"truffle-contract": "3.0.1",
6364
"uuid": "3.1.0",
6465
"web3": "0.20.1"
6566
},
6667
"devDependencies": {
67-
"@0xproject/web3-wrapper": "0.1.2",
6868
"babel-cli": "6.26.0",
6969
"babel-core": "6.26.0",
7070
"babel-eslint": "8.1.2",

src/contract_wrappers/Compliance.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import Web3 from 'web3';
55
import { Web3Wrapper } from '@0xproject/web3-wrapper';
66

77
import ContractWrapper from './ContractWrapper';
8-
import Customers from './Customers';
9-
import SecurityTokenRegistrar from './SecurityTokenRegistrar';
108

119
import complianceArtifact from '../artifacts/Compliance.json';
1210
import type {
@@ -28,13 +26,9 @@ export default class Compliance extends ContractWrapper {
2826
*/
2927
constructor(
3028
web3Wrapper: Web3Wrapper,
31-
customers: Customers,
3229
deployedAddress?: string,
3330
) {
3431
super(web3Wrapper, complianceArtifact, deployedAddress);
35-
36-
this.customers = customers;
37-
this.securityTokenRegistrar = SecurityTokenRegistrar;
3832
}
3933

4034
/**

src/contract_wrappers/Customers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type LogCustomerVerifiedArgsUnprocessed = {
3030
* Wrapper for the Customers Solidity contract
3131
*/
3232
export default class Customers extends ContractWrapper {
33-
// polyToken: PolyToken;
33+
polyToken: PolyToken;
3434

3535
/**
3636
* @hideconstructor

src/contract_wrappers/SecurityTokenRegistrar.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { Web3Wrapper } from '@0xproject/web3-wrapper';
44
import { BigNumber } from 'bignumber.js';
55
import ContractWrapper from './ContractWrapper';
66
import securityTokenRegistrarArtifact from '../artifacts/SecurityTokenRegistrar.json';
7-
import SecurityToken from './SecurityToken';
8-
import Compliance from './Compliance';
97
import type {
108
BlockRange,
119
SecurityTokenRegistrarEventArgs,
@@ -24,14 +22,9 @@ export default class SecurityTokenRegistrar extends ContractWrapper {
2422
*/
2523
constructor(
2624
web3Wrapper: Web3Wrapper,
27-
securityToken: SecurityToken,
28-
compliance: Compliance,
2925
deployedAddress?: string,
3026
) {
3127
super(web3Wrapper, securityTokenRegistrarArtifact, deployedAddress);
32-
33-
this.securityToken = securityToken;
34-
this.compliance = compliance;
3528
}
3629

3730
/**

src/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Web3Wrapper } from '@0xproject/web3-wrapper';
44

55
// import { ContractNotFoundError } from './types';
6-
import { Customers, PolyToken } from './contract_wrappers';
6+
import { Compliance, Customers, PolyToken, SecurityTokenRegistrar } from './contract_wrappers';
77
import type { Web3Provider } from './types';
88

99
export * from './contract_wrappers';
@@ -21,6 +21,8 @@ export class Polymath {
2121

2222
polyToken: PolyToken;
2323
customers: Customers;
24+
compliance: Compliance;
25+
securityTokenRegistrar: SecurityTokenRegistrar;
2426

2527
constructor(web3Provider: Web3Provider) {
2628
this._web3Wrapper = new Web3Wrapper(web3Provider);
@@ -33,6 +35,12 @@ export class Polymath {
3335
this.customers = new Customers(this._web3Wrapper, this.polyToken);
3436
initializePromises.push(this.customers.initialize());
3537

38+
this.compliance = new Compliance(this._web3Wrapper);
39+
initializePromises.push(this.compliance.initialize());
40+
41+
this.securityTokenRegistrar = new SecurityTokenRegistrar(this._web3Wrapper);
42+
initializePromises.push(this.securityTokenRegistrar.initialize());
43+
3644
this.initializedPromise = Promise.all(initializePromises);
3745
}
3846
}

test/Compliance_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ describe('Compliance wrapper', () => {
5454
polyToken,
5555
customers,
5656
compliance,
57-
securityToken,
5857
accounts[0],
5958
accounts[1],
6059
expiryTime,

test/SecurityToken_test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ describe('SecurityToken wrapper', () => {
5353
polyToken,
5454
customers,
5555
compliance,
56-
securityToken,
5756
accounts[0],
5857
accounts[1],
5958
expiryTime,

test/util/make_examples.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ export async function makeSecurityTokenRegistrar(
235235
polyToken: PolyToken,
236236
customers: Customers,
237237
compliance: Compliance,
238-
securityToken: SecurityToken,
239238
account: string,
240239
) {
241240
const contractTemplate = contract(securityTokenRegistrarArtifact);
@@ -250,7 +249,7 @@ export async function makeSecurityTokenRegistrar(
250249
from: account,
251250
},
252251
);
253-
const registrar = new SecurityTokenRegistrar(web3Wrapper, securityToken, compliance, instance.address);
252+
const registrar = new SecurityTokenRegistrar(web3Wrapper, instance.address);
254253

255254
await registrar.initialize();
256255
return registrar;
@@ -312,7 +311,6 @@ export async function makeSecurityTokenThroughRegistrar(
312311
polyToken: PolyToken,
313312
customers: Customers,
314313
compliance: Compliance,
315-
securityToken: SecurityToken,
316314
account: string,
317315
hostAccount: string,
318316
currentBlockTime: number,
@@ -329,7 +327,7 @@ export async function makeSecurityTokenThroughRegistrar(
329327
from: account,
330328
},
331329
);
332-
const registrar = new SecurityTokenRegistrar(web3Wrapper, securityToken, compliance, instance.address);
330+
const registrar = new SecurityTokenRegistrar(web3Wrapper, instance.address);
333331

334332
await registrar.initialize();
335333

0 commit comments

Comments
 (0)