Skip to content

Commit df1d920

Browse files
Merge branch 'dev-2.1.0' into Vesting-Escrow-Wallet
2 parents 9088434 + a0408c0 commit df1d920

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3774
-2350
lines changed

.circleci/config.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
version: 2
2+
jobs:
3+
build:
4+
docker:
5+
- image: circleci/node:8
6+
steps:
7+
- checkout
8+
- restore_cache:
9+
key: dependency-cache-{{ checksum "package.json" }}
10+
- run: yarn install
11+
- run: sudo npm i truffle -g
12+
- run: node --version
13+
- run: truffle version
14+
- run: truffle compile
15+
- save_cache:
16+
key: dependency-cache-{{ checksum "package.json" }}
17+
paths:
18+
- node_modules
19+
test:
20+
docker:
21+
- image: circleci/node:8
22+
parallelism: 2
23+
steps:
24+
- checkout
25+
- restore_cache:
26+
key: dependency-cache-{{ checksum "package.json" }}
27+
- run: yarn install
28+
- run: sudo npm i truffle -g
29+
- run: node --version
30+
- run: truffle version
31+
- run: npm run test
32+
- save_cache:
33+
key: dependency-cache-{{ checksum "package.json" }}
34+
paths:
35+
- node_modules
36+
- store_test_results:
37+
path: test-results
38+
- store_artifacts:
39+
path: ./test-results/mocha/results.xml
40+
coverage:
41+
docker:
42+
- image: circleci/node:8
43+
steps:
44+
- checkout
45+
- restore_cache:
46+
key: dependency-cache-{{ checksum "package.json" }}
47+
- run: yarn install
48+
- run: sudo npm i truffle -g
49+
- run: node --version
50+
- run: truffle version
51+
- run:
52+
command: npm run coverage
53+
no_output_timeout: 1h
54+
- save_cache:
55+
key: dependency-cache-{{ checksum "package.json" }}
56+
paths:
57+
- node_modules
58+
- store_artifacts:
59+
path: ./coverage/lcov.info
60+
docs:
61+
docker:
62+
- image: circleci/node:8
63+
steps:
64+
- checkout
65+
- restore_cache:
66+
key: dependency-cache-{{ checksum "package.json" }}
67+
- run: yarn install
68+
- run: sudo npm i truffle -g
69+
- run: node --version
70+
- run: truffle version
71+
- run: npm run docs
72+
- save_cache:
73+
key: dependency-cache-{{ checksum "package.json" }}
74+
paths:
75+
- node_modules
76+
workflows:
77+
version: 2
78+
commit:
79+
jobs:
80+
- coverage
81+
daily-builds:
82+
triggers:
83+
- schedule:
84+
cron: "0 0 * * *"
85+
filters:
86+
branches:
87+
only:
88+
- master
89+
- dev-2.1.0
90+
- dev-2.2.0
91+
- dev-3.0.0
92+
jobs:
93+
- coverage
94+
docs:
95+
jobs:
96+
- docs:
97+
filters:
98+
branches:
99+
only:
100+
- master

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ bridge.log
2222
allFiredEvents
2323
extract/
2424
extract.py
25-
extract.zip
25+
extract.zip
26+
/test-results

.travis.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,11 @@ node_js:
44
cache:
55
directories:
66
- node_modules
7-
matrix:
8-
fast_finish: true
9-
allow_failures:
10-
- env: 'TASK=docs'
117
jobs:
128
include:
13-
- stage: Tests and Coverage
14-
after_install: wget -O node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
9+
- stage: test
1510
before_script: truffle version
1611
script: npm run test
17-
- stage: Docs
18-
env: 'TASK=docs'
19-
before_install:
20-
- echo -ne '\n' | sudo apt-add-repository -y ppa:hvr/z3
21-
- sudo apt-get -y update
22-
- sudo apt-get -y install libz3-dev
23-
before_script: wget -O node_modules/solidity-docgen/lib/index.js https://raw.githubusercontent.com/maxsam4/solidity-docgen/buffer-size/lib/index.js
24-
script: npm run docs
2512
notifications:
2613
slack:
2714
secure: W4FZSabLrzF74f317hutolEHnlq2GBlQxU6b85L5XymrjgLEhlgE16c5Qz7Emoyt6le6PXL+sfG2ujJc3XYys/6hppgrHSAasuJnKCdQNpmMZ9BNyMs6WGkmB3enIf3K/FLXb26AQdwpQdIXuOeJUTf879u+YoiZV0eZH8d3+fsIOyovq9N6X5pKOpDM9iT8gGB4t7fie7xf51s+iUaHxyO9G7jDginZ4rBXHcU7mxCub9z+Z1H8+kCTnPWaF+KKVEXx4Z0nI3+urboD7E4OIP02LwrThQls2CppA3X0EoesTcdvj/HLErY/JvsXIFiFEEHZzB1Wi+k2TiOeLcYwEuHIVij+HPxxlJNX/j8uy01Uk8s4rd+0EhvfdKHJqUKqxH4YN2npcKfHEss7bU3y7dUinXQfYShW5ZewHdvc7pnnxBTfhvmdi64HdNrXAPq+s1rhciH7MmnU+tsm4lhrpr+FBuHzUMA9fOCr7b0SQytZEgWpiUls88gdbh3yG8TjyZxmZJGx09cwEP0q7VoH0UwFh7mIu5XmYdd5tWUhavTiO7YV8cUPn7MvwMsTltB3YBpF/fB26L7ka8zBhCsjm9prW6SVYU/dyO3m91VeZtO/zJFHRDA6Q58JGVW2rgzO39z193qC1EGRXqTie96VwAAtNg8+hRb+bI/CWDVzSPc=

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ All notable changes to this project will be documented in this file.
55

66
[__2.1.0__](https://www.npmjs.com/package/polymath-core?activeTab=readme) __13-09-18__
77

8-
## CappedSTO 2.0.1
8+
9+
## CappedSTO 2.1.0
910
* `rate` is now accepted as multiplied by 10^18 to allow settting higher price than 1ETH/POLY per token.
1011
* Indivisble tokens are now supported. When trying to buy partial tokens, allowed full units of tokens will be purchased and remaining funds will be returned.
1112

1213
## USDTieredSTO 2.1.0
14+
* Added `stableCoinsRaised` function that returns amount of individual stable coin raised when address of that stable coin is passed.
15+
* Added support for multiple stable coins in USDTSTO.
1316
* Added `buyTokensView` and `getTokensMintedByTier` to USDTSTO.
1417
* Added `getSTODetails` to USDTSTO.
1518
* Added an Array of Tiers that will hold data about every tier in USDTSTO.
@@ -31,6 +34,10 @@ All notable changes to this project will be documented in this file.
3134
* Removed `0x0` check for the `_from` address to `ManualApprovalTransferManager`. This allows for the Issuer/Transfer Agent to approve a one-off mint of tokens that otherwise would not be possible.
3235
* Changed the version of `ManualApprovalTransferManagerFactory` from `1.0.0` to `2.1.0`.
3336
* Deployed 2.0.1 `ManualApprovalTransferManagerFactory` to address 0x6af2afad53cb334e62b90ddbdcf3a086f654c298
37+
* Add `getActiveApprovalsToUser()` function to access all the active approvals for a user whether user is in the `from` or in `to`.
38+
* Add `getApprovalDetails()` to get the details of the approval corresponds to `_from` and `_to` address.
39+
* Add feature to modify the details of the active approval using `modifyApproval()` & `modifyApprovalMulti()`.
40+
* Add `addManualApprovalMulti()` and `revokeManualApprovalMulti()` batch function for adding and revoking the manual approval respectively.
3441

3542
## Dividends
3643
* Changed the version of `ERC20DividendCheckpointFactory` & `EtherDividendCheckpointFactory` from `1.0.0` to `2.1.0`.

CLI/commands/ST20Generator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ async function executeApp(_ticker, _transferOwnership, _name, _details, _divisib
3232
await step_transfer_ticker_ownership(_transferOwnership);
3333
await step_token_deploy(_name, _details, _divisible);
3434
}
35-
await tokenManager.executeApp(tokenSymbol);
35+
if (typeof _divisible === 'undefined') {
36+
await tokenManager.executeApp(tokenSymbol);
37+
}
3638
} catch (err) {
3739
console.log(err);
3840
return;

CLI/commands/TickerRollForward.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ let securityTokenRegistry;
2020
let securityTokenRegistryAddress;
2121

2222
function Ticker(_owner, _symbol, _name) {
23-
this.owner = _owner;
24-
this.symbol = _symbol;
25-
this.name = _name;
23+
this.owner = _owner;
24+
this.symbol = _symbol;
25+
this.name = _name;
2626
}
2727

2828
function FailedRegistration(_ticker, _error) {
@@ -58,11 +58,11 @@ async function startScript() {
5858
}
5959

6060
async function readFile() {
61-
var stream = fs.createReadStream("./CLI/data/ticker_data.csv");
61+
var stream = fs.createReadStream(`${__dirname}/../data/ticker_data.csv`);
6262

6363
var csvStream = csv()
6464
.on("data", function (data) {
65-
ticker_data.push(new Ticker(data[0],data[1],data[2],data[3]));
65+
ticker_data.push(new Ticker(data[0], data[1], data[2], data[3]));
6666
})
6767
.on("end", async function () {
6868
await registerTickers();
@@ -73,12 +73,12 @@ async function readFile() {
7373
async function registerTickers() {
7474
// Poly approval for registration fees
7575
let polyBalance = BigNumber(await polyToken.methods.balanceOf(Issuer.address).call());
76-
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
76+
let fee = web3.utils.fromWei(await securityTokenRegistry.methods.getTickerRegistrationFee().call());
7777
let totalFee = BigNumber(ticker_data.length).mul(fee);
7878

7979
if (totalFee.gt(polyBalance)) {
8080
console.log(chalk.red(`\n*******************************************************************************`));
81-
console.log(chalk.red(`Not enough POLY to pay registration fee. Require ${totalFee.div(10**18).toNumber()} POLY but have ${polyBalance.div(10**18).toNumber()} POLY.`));
81+
console.log(chalk.red(`Not enough POLY to pay registration fee. Require ${totalFee.div(10 ** 18).toNumber()} POLY but have ${polyBalance.div(10 ** 18).toNumber()} POLY.`));
8282
console.log(chalk.red(`*******************************************************************************\n`));
8383
process.exit(0);
8484
} else {
@@ -100,7 +100,7 @@ async function registerTickers() {
100100
}
101101

102102
// validate ticker
103-
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function(error, result){
103+
await securityTokenRegistry.methods.getTickerDetails(ticker_data[i].symbol).call({}, function (error, result) {
104104
if (result[1] != 0) {
105105
failed_tickers.push(` ${i} is already registered`);
106106
valid = false;
@@ -131,7 +131,7 @@ async function logResults() {
131131
Successful registrations: ${registered_tickers.length}
132132
Failed registrations: ${failed_tickers.length}
133133
Total gas consumed: ${totalGas}
134-
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10**18)} ETH
134+
Total gas cost: ${defaultGasPrice.mul(totalGas).div(10 ** 18)} ETH
135135
136136
List of failed registrations:
137137
${failed_tickers}

CLI/commands/common/common_functions.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const Tx = require('ethereumjs-tx');
33
const permissionsList = require('./permissions_list');
44
const abis = require('../helpers/contract_abis');
55

6-
async function connect(abi, address) {
6+
function connect(abi, address) {
77
contractRegistry = new web3.eth.Contract(abi, address);
88
contractRegistry.setProvider(web3.currentProvider);
99
return contractRegistry
@@ -15,7 +15,7 @@ async function checkPermission(contractName, functionName, contractRegistry) {
1515
return true
1616
} else {
1717
let stAddress = await contractRegistry.methods.securityToken().call();
18-
let securityToken = await connect(abis.securityToken(), stAddress);
18+
let securityToken = connect(abis.securityToken(), stAddress);
1919
let stOwner = await securityToken.methods.owner().call();
2020
if (stOwner == Issuer.address) {
2121
return true
@@ -48,11 +48,11 @@ async function getGasLimit(options, action) {
4848
}
4949

5050
async function checkPermissions(action) {
51-
let contractRegistry = await connect(action._parent.options.jsonInterface, action._parent._address);
51+
let contractRegistry = connect(action._parent.options.jsonInterface, action._parent._address);
5252
//NOTE this is a condition to verify if the transaction comes from a module or not.
5353
if (contractRegistry.methods.hasOwnProperty('factory')) {
5454
let moduleAddress = await contractRegistry.methods.factory().call();
55-
let moduleRegistry = await connect(abis.moduleFactory(), moduleAddress);
55+
let moduleRegistry = connect(abis.moduleFactory(), moduleAddress);
5656
let parentModule = await moduleRegistry.methods.getName().call();
5757
let result = await checkPermission(web3.utils.hexToUtf8(parentModule), action._method.name, contractRegistry);
5858
if (!result) {
@@ -153,6 +153,9 @@ module.exports = {
153153
let filteredLogs = logs.filter(l => l.topics.includes(eventJsonInterface.signature));
154154
return filteredLogs.map(l => web3.eth.abi.decodeLog(eventJsonInterface.inputs, l.data, l.topics.slice(1)));
155155
},
156+
connect: function (abi, address) {
157+
return connect(abi, address)
158+
},
156159
splitIntoBatches: function (data, batchSize) {
157160
let allBatches = [];
158161
for (let index = 0; index < data.length; index += batchSize) {

CLI/commands/common/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = Object.freeze({
2929
FUND_RAISE_TYPES: {
3030
ETH: 0,
3131
POLY: 1,
32-
DAI: 2
32+
STABLE: 2
3333
},
3434
DEFAULT_BATCH_SIZE: 75,
3535
ADDRESS_ZERO: '0x0000000000000000000000000000000000000000'

CLI/commands/common/global.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ module.exports = {
4444
console.log("Invalid remote node")
4545
process.exit(0)
4646
}
47-
await httpProvider(remoteNetwork, './privKey');
47+
await httpProvider(remoteNetwork, `${__dirname}/../../../privKey`);
4848
} else {
49-
await httpProvider("http://localhost:8545", './privKeyLocal');
49+
await httpProvider("http://localhost:8545", `${__dirname}/../../../privKeyLocal`);
5050
}
5151
defaultGasPrice = getGasPrice(await web3.eth.net.getId());
5252
}

CLI/commands/common/permissions_list.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ function getPermissionList() {
6060
},
6161
ManualApprovalTransferManager: {
6262
addManualApproval: "TRANSFER_APPROVAL",
63-
addManualBlocking: "TRANSFER_APPROVAL",
6463
revokeManualApproval: "TRANSFER_APPROVAL",
65-
revokeManualBlocking: "TRANSFER_APPROVAL"
6664
},
6765
PercentageTransferManager: {
6866
modifyWhitelist: "WHITELIST",
@@ -99,7 +97,7 @@ function getPermissionList() {
9997
}
10098

10199
module.exports = {
102-
verifyPermission: function(contractName, functionName) {
100+
verifyPermission: function (contractName, functionName) {
103101
let list = getPermissionList();
104102
try {
105103
return list[contractName][functionName]

0 commit comments

Comments
 (0)