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

Commit eeca074

Browse files
committed
compliance functions done except subscribe and unsubscribe
2 parents 2e1e1fb + 6e7a2f2 commit eeca074

17 files changed

+929
-131
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ before_script:
1717
- sleep 1
1818

1919
script:
20-
- yarn compile
21-
- yarn migrate-testrpc
2220
- yarn ci

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[![Build Status](https://travis-ci.org/PolymathNetwork/polymath.js.svg?branch=master)](https://travis-ci.org/PolymathNetwork/polymath.js)
22
<a href="https://t.me/polymathnetwork"><img src="https://img.shields.io/badge/50k+-telegram-blue.svg" target="_blank"></a>
33

4+
[![dependencies Status](https://david-dm.org/PolymathNetwork/polymath.js.svg)](https://david-dm.org/PolymathNetwork/polymath.js)
5+
[![devDependencies Status](https://david-dm.org/PolymathNetwork/polymath.js/dev-status.svg)](https://david-dm.org/PolymathNetwork/polymath.js?type=dev)
6+
7+
48
<!--img src="https://img.shields.io/badge/bounties-1,000,000-green.svg" href="/issues-->
59

610
![Polymath](Polymath.png)

src/artifacts/Compliance.json

Lines changed: 7 additions & 1 deletion
Large diffs are not rendered by default.

src/artifacts/Customers.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,13 @@
316316
"type": "event"
317317
}
318318
],
319-
"networks": {},
319+
"networks": {
320+
"50": {
321+
"events": {},
322+
"links": {},
323+
"address": "0x78fad8e05b7e7f74fe26c35af4157bd83ed36066"
324+
}
325+
},
320326
"bytecode": "0x606060405260408051908101604052600181527f31000000000000000000000000000000000000000000000000000000000000006020820152600090805161004b929160200190610092565b50341561005757600080fd5b604051602080610c188339810160405280805160018054600160a060020a031916600160a060020a03929092169190911790555061012d9050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100d357805160ff1916838001178555610100565b82800160010185558215610100579182015b828111156101005782518255916020019190600101906100e5565b5061010c929150610110565b5090565b61012a91905b8082111561010c5760008155600101610116565b90565b610adc8061013c6000396000f30060606040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630787bc2781146100925780630ba24e4c1461015157806313bdbb19146101c15780631f54d80d1461022757806355f21eb71461026e57806362ad9bda1461031c5780636a1db1bf14610382578063ffa1ad7414610398575b600080fd5b341561009d57600080fd5b6100b1600160a060020a0360043516610422565b6040516020810184905260408101839052606081018290526080808252855460026101006001831615026000190190911604908201819052819060a08201908790801561013f5780601f106101145761010080835404028352916020019161013f565b820191906000526020600020905b81548152906001019060200180831161012257829003601f168201915b50509550505050505060405180910390f35b341561015c57600080fd5b610176600160a060020a0360043581169060243516610448565b604051978852602088019690965260408088019590955260ff90931660608701529015156080860152151560a085015260c084015260e0830191909152610100909101905180910390f35b34156101cc57600080fd5b6101e6600160a060020a036004358116906024351661049c565b604051958652602086019490945291151560408086019190915260ff9091166060850152901515608084015260a083019190915260c0909101905180910390f35b341561023257600080fd5b61025a600160a060020a036004351660243560443560ff60643516608435151560a4356104f4565b604051901515815260200160405180910390f35b341561027957600080fd5b61028d600160a060020a03600435166106ba565b60405160208101849052604081018390526060810182905260808082528190810186818151815260200191508051906020019080838360005b838110156102de5780820151838201526020016102c6565b50505050905090810190601f16801561030b5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b341561032757600080fd5b61025a60048035600160a060020a03169060446024803590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650508435946020013593506107a492505050565b341561038d57600080fd5b61025a60043561091b565b34156103a357600080fd5b6103ab610965565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156103e75780820151838201526020016103cf565b50505050905090810190601f1680156104145780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b600360208190526000918252604090912060018101546002820154928201549192909184565b60026020818152600093845260408085209091529183529120805460018201549282015460038301546004840154600590940154929493919260ff8083169361010084048216936201000090049091169188565b600160a060020a03918216600090815260026020908152604080832093909416825291909152208054600182015460038301546005909301549193909260ff6201000082048116938183169361010090930490911691565b600160a060020a033316600090815260036020526040812060020154151561051b57600080fd5b42821161052757600080fd5b600154600160a060020a033381811660009081526003602081905260408083209091015493909416936323b872dd938c9392909151602001526040517c010000000000000000000000000000000000000000000000000000000063ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401602060405180830381600087803b15156105c857600080fd5b6102c65a03f115156105d957600080fd5b5050506040518051905015156105ee57600080fd5b33600160a060020a038181166000908152600260209081526040808320938c16835292905281902088815560018101889055600381018054600590920186905561010060ff1990921660ff89161762ff0000191662010000881515021761ff0019169190911790557ff7f59b0f319f2c9b602cfadacf86ba70810de82e157ceb8a5c0ef1a977eb2c28918991879051600160a060020a03938416815291909216602082015260ff9091166040808301919091526060909101905180910390a15060019695505050505050565b6106c2610a03565b600160a060020a038216600090815260036020818152604080842060018082015460028084015496840154845489988998969794969095929488949383161561010002600019019092169290920491601f83018190048102019051908101604052809291908181526020018280546001816001161561010002031660029004801561078e5780601f106107635761010080835404028352916020019161078e565b820191906000526020600020905b81548152906001019060200180831161077157829003601f168201915b5050505050935093509350935093509193509193565b6000600160a060020a03851615156107bb57600080fd5b8215156107c757600080fd5b600160a060020a038516600090815260036020526040902060020154156107ed57600080fd5b608060405190810160409081528582524260208084019190915281830186905260608301859052600160a060020a038816600090815260039091522081518190805161083d929160200190610a15565b5060208201518160010155604082015160028201556060820151600390910155507f53ed589b931f3eef8f960ebedca42e6fd5943e9c28f6e5b35ac2e9b9dce97dff858585604051600160a060020a03841681526040810182905260606020820181815290820184818151815260200191508051906020019080838360005b838110156108d45780820151838201526020016108bc565b50505050905090810190601f1680156109015780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1506001949350505050565b600160a060020a033316600090815260036020526040812060020154151561094257600080fd5b5033600160a060020a031660009081526003602081905260409091200155600190565b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109fb5780601f106109d0576101008083540402835291602001916109fb565b820191906000526020600020905b8154815290600101906020018083116109de57829003601f168201915b505050505081565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610a5657805160ff1916838001178555610a83565b82800160010185558215610a83579182015b82811115610a83578251825591602001919060010190610a68565b50610a8f929150610a93565b5090565b610aad91905b80821115610a8f5760008155600101610a99565b905600a165627a7a72305820985d03b8c4f824d44be2f72cfbcdeba05af39ed24571c4591e19c446a57df2200029",
321327
"sourceHash": "0x6d8a2cfd14da0c247f55ba645a650f1efcecd28ba36f7ff1044a8ff920bce3cf"
322328
}

src/artifacts/PolyTokenMock.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,13 @@
240240
"type": "event"
241241
}
242242
],
243-
"networks": {},
243+
"networks": {
244+
"50": {
245+
"events": {},
246+
"links": {},
247+
"address": "0xf46a4e110b8f07d2a97b98884c7e3270d1bba2cb"
248+
}
249+
},
244250
"bytecode": "0x6060604052620f424060005560408051908101604052601081527f506f6c796d617468204e6574776f726b00000000000000000000000000000000602082015260019080516100529291602001906100b8565b506002805460ff1916601217905560408051908101604052600481527f504f4c5900000000000000000000000000000000000000000000000000000000602082015260039080516100a79291602001906100b8565b5034156100b357600080fd5b610153565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100f957805160ff1916838001178555610126565b82800160010185558215610126579182015b8281111561012657825182559160200191906001019061010b565b50610132929150610136565b5090565b61015091905b80821115610132576000815560010161013c565b90565b610701806101626000396000f3006060604052600436106100a35763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100a8578063095ea7b31461013257806318160ddd1461016857806323b872dd1461018d5780632570e31e146101b5578063313ce567146101d757806370a082311461020057806395d89b411461021f578063a9059cbb14610232578063dd62ed3e14610254575b600080fd5b34156100b357600080fd5b6100bb610279565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156100f75780820151838201526020016100df565b50505050905090810190601f1680156101245780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561013d57600080fd5b610154600160a060020a0360043516602435610317565b604051901515815260200160405180910390f35b341561017357600080fd5b61017b610383565b60405190815260200160405180910390f35b341561019857600080fd5b610154600160a060020a0360043581169060243516604435610389565b34156101c057600080fd5b610154600435600160a060020a036024351661050b565b34156101e257600080fd5b6101ea610534565b60405160ff909116815260200160405180910390f35b341561020b57600080fd5b61017b600160a060020a036004351661053d565b341561022a57600080fd5b6100bb610558565b341561023d57600080fd5b610154600160a060020a03600435166024356105c3565b341561025f57600080fd5b61017b600160a060020a0360043581169060243516610682565b60018054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561030f5780601f106102e45761010080835404028352916020019161030f565b820191906000526020600020905b8154815290600101906020018083116102f257829003601f168201915b505050505081565b600160a060020a03338116600081815260056020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a03831615156103a057600080fd5b600160a060020a0384166000908152600460205260409020548211156103c557600080fd5b600160a060020a03808516600090815260056020908152604080832033909416835292905220548211156103f857600080fd5b600160a060020a038416600090815260046020526040902054610421908363ffffffff6106ad16565b600160a060020a038086166000908152600460205260408082209390935590851681522054610456908363ffffffff6106bf16565b600160a060020a0380851660009081526004602090815260408083209490945587831682526005815283822033909316825291909152205461049e908363ffffffff6106ad16565b600160a060020a03808616600081815260056020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600160a060020a0316600090815260046020526040812080548301905580549091019055600190565b60025460ff1681565b600160a060020a031660009081526004602052604090205490565b60038054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561030f5780601f106102e45761010080835404028352916020019161030f565b600160a060020a0333166000908152600460205260408120546105ec908363ffffffff6106ad16565b600160a060020a033381166000908152600460205260408082209390935590851681522054610621908363ffffffff6106bf16565b600160a060020a0380851660008181526004602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260056020908152604080832093909416825291909152205490565b6000828211156106b957fe5b50900390565b6000828201838110156106ce57fe5b93925050505600a165627a7a7230582012fb3bc46ef2acef2c2c76f2937cff2fa9948a8e916246c91c81e948d6996f6d0029",
245251
"sourceHash": "0x3885ea26b961c0fe1d3f805f07d80024bb638f51ba420f1a92e03a06c800d938"
246252
}

src/artifacts/SecurityTokenRegistrar.json

Lines changed: 7 additions & 1 deletion
Large diffs are not rendered by default.

src/contract_wrappers/ContractWrapper.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ export default class ContractWrapper {
9595
* Unsubscribes from all events subscribed to on the contract.
9696
*/
9797
unsubscribeAll() {
98-
this._filters.forEach(filter => {
99-
this.unsubscribe(filter);
98+
// get an array of keys from the this._filters object, and then map the subscriptionIDs into unsubscribe
99+
Object.keys(this._filters).map((subscriptionIDKey, index) => {
100+
this.unsubscribe(subscriptionIDKey);
100101
});
101102
}
102103

src/contract_wrappers/Customers.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,26 @@ export default class Customers extends ContractWrapper {
5757
indexedFilterValues: IndexedFilterValues,
5858
callback: EventCallback<CustomersEventArgs>,
5959
): string {
60-
let wrappedCallback = callback;
60+
const wrappedCallback = callback;
6161

62-
if (eventName === 'LogCustomerVerified') {
63-
// Convert from number roles to string enum roles.
64-
wrappedCallback = (args: any) => {
65-
const role = numberToRole(args.role.toNumber());
62+
//* *temporarily green this out, it isnt working, might not need */
6663

67-
if (role === null) {
68-
return;
69-
}
64+
// if (eventName === 'LogCustomerVerified') {
65+
// // Convert from number roles to string enum roles.
66+
// wrappedCallback = (args: any) => {
67+
// // console.log(args)
68+
// const role = numberToRole(args.role.toNumber());
7069

71-
callback({
72-
...args,
73-
role,
74-
});
75-
};
76-
}
70+
// if (role === null) {
71+
// return;
72+
// }
73+
74+
// callback({
75+
// ...args,
76+
// role,
77+
// });
78+
// };
79+
// }
7780

7881
return super._subscribe(eventName, indexedFilterValues, wrappedCallback);
7982
}
@@ -211,7 +214,6 @@ export default class Customers extends ContractWrapper {
211214
);
212215
}
213216

214-
215217
/**
216218
* Retrieve a Polymath user by their associated KYC provider and their Ethereum address. Users can be associated with multiple KYC providers.
217219
* @param kycProviderAddress The Ethereum address of the associated KYC provider

src/contract_wrappers/SecurityToken.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,30 @@ export default class SecurityToken extends ContractWrapper {
6666
| 'LogUpdatedComplianceProof'
6767
| 'LogSetSTOContract'
6868
| 'LogNewWhitelistedAddress'
69+
| 'LogNewBlacklistedAddress'
6970
| 'LogVoteToFreeze'
7071
| 'LogTokenIssued',
7172
indexedFilterValues: IndexedFilterValues,
7273
callback: EventCallback<SecurityTokenEventArgs>,
7374
): string {
74-
let wrappedCallback = callback;
75+
const wrappedCallback = callback;
7576

76-
if (eventName === 'LogNewWhitelistedAddress') {
77-
// Convert from number roles to string enum roles.
78-
wrappedCallback = (args: any) => {
79-
const role = numberToRole(args._role.toNumber());
77+
// Temporary comment out, dont know if we need
78+
// if (eventName === 'LogNewWhitelistedAddress') {
79+
// // Convert from number roles to string enum roles.
80+
// wrappedCallback = (args: any) => {
81+
// const role = numberToRole(args._role.toNumber());
8082

81-
if (role === null) {
82-
return;
83-
}
83+
// if (role === null) {
84+
// return;
85+
// }
8486

85-
callback({
86-
...args,
87-
_role: role,
88-
});
89-
};
90-
}
87+
// callback({
88+
// ...args,
89+
// _role: role,
90+
// });
91+
// };
92+
// }
9193

9294
return super._subscribe(eventName, indexedFilterValues, wrappedCallback);
9395
}
@@ -313,13 +315,14 @@ export default class SecurityToken extends ContractWrapper {
313315
}
314316

315317
/**
316-
* Add a verified address to the Security Token whitelist
317-
* @param investorAddress Investor address to whitelist
318+
* Voting to freeze the funds of the recipient address
319+
* @param shareHolderAddress shareholder of the security token
318320
* @param recipientAddress User who is getting voted agaisnt to freeze their POLY
319321
*/
320-
async voteToFreeze(investorAddress: string, recipientAddress: string) {
322+
async voteToFreeze(shareHolderAddress: string, recipientAddress: string) {
321323
await this._contract.voteToFreeze(recipientAddress, {
322-
from: investorAddress,
324+
from: shareHolderAddress,
325+
gas : 300000,
323326
});
324327
}
325328

@@ -480,11 +483,14 @@ export default class SecurityToken extends ContractWrapper {
480483

481484
/**
482485
* Add a verified address to the Security Token blacklist
486+
* @param owner Owner of the security token contract
483487
* @param blacklistAddress The address being added to the blacklist
484488
*/
485489
async addToBlacklist(ownerAddress: string, blacklistAddress: string) {
486490
await this._contract.addToBlacklist(blacklistAddress, {
487491
from: ownerAddress,
492+
gas: 1000000,
488493
});
489494
}
495+
490496
}

src/contract_wrappers/SecurityTokenRegistrar.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import SecurityToken from './SecurityToken';
88
import Compliance from './Compliance';
99
import type {
1010
BlockRange,
11-
LogNewSecurityToken,
11+
SecurityTokenRegistrarEventArgs,
1212
EventCallback,
1313
IndexedFilterValues,
1414
Log,
@@ -44,7 +44,7 @@ export default class SecurityTokenRegistrar extends ContractWrapper {
4444
subscribe(
4545
eventName: 'LogNewSecurityToken',
4646
indexedFilterValues: IndexedFilterValues,
47-
callback: EventCallback<LogNewSecurityToken>,
47+
callback: EventCallback<SecurityTokenRegistrarEventArgs>,
4848
): string {
4949
return super._subscribe(eventName, indexedFilterValues, callback);
5050
}
@@ -60,7 +60,7 @@ export default class SecurityTokenRegistrar extends ContractWrapper {
6060
eventName: 'LogNewSecurityToken',
6161
indexedFilterValues: IndexedFilterValues,
6262
blockRange?: BlockRange,
63-
): Promise<Array<Log<LogNewSecurityToken>>> {
63+
): Promise<Array<Log<SecurityTokenRegistrarEventArgs>>> {
6464
return super._getLogs(eventName, indexedFilterValues, blockRange);
6565
}
6666

@@ -160,5 +160,4 @@ export default class SecurityTokenRegistrar extends ContractWrapper {
160160
async getComplianceAddress(): Promise<string> {
161161
return this._contract.polyComplianceAddress.call();
162162
}
163-
164163
}

0 commit comments

Comments
 (0)