Skip to content

Commit 629613f

Browse files
authored
Merge branch 'dev-2.1.0' into multiple-stable-coins
2 parents 549f83e + 03ee41f commit 629613f

File tree

9 files changed

+196
-44
lines changed

9 files changed

+196
-44
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=

contracts/modules/STO/USDTieredSTO.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
467467
fundsRaisedUSD = fundsRaisedUSD.add(spentUSD);
468468
}
469469

470-
spentValue = DecimalMath.mul(DecimalMath.div(spentUSD, originalUSD), _investmentValue);
470+
spentValue = DecimalMath.div(spentUSD, _rate);
471471
}
472472

473473
/**
@@ -506,7 +506,7 @@ contract USDTieredSTO is USDTieredSTOStorage, ISTO, ReentrancyGuard {
506506
}
507507
}
508508

509-
spentValue = DecimalMath.mul(DecimalMath.div(spentUSD, originalUSD), _investmentValue);
509+
spentValue = DecimalMath.div(spentUSD, rate);
510510
}
511511

512512
function _buyTokensChecks(

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"ethereum-bridge": "^0.6.1",
9090
"ethereumjs-abi": "^0.6.5",
9191
"ganache-cli": "^6.1.8",
92+
"mocha-junit-reporter": "^1.18.0",
9293
"prettier": "^1.14.3",
9394
"sol-merger": "^0.1.2",
9495
"solidity-coverage": "^0.5.11",

scripts/coverage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
rm -rf flat
44

5-
TRAVIS_PULL_REQUEST=true scripts/test.sh
5+
COVERAGE=true scripts/test.sh

scripts/test.sh

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ cleanup() {
1919
fi
2020
}
2121

22-
if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
23-
testrpc_port=8545
24-
else
25-
testrpc_port=8545
26-
fi
22+
testrpc_port=8545
2723

2824
testrpc_running() {
2925
nc -z localhost "$testrpc_port"
@@ -60,20 +56,19 @@ start_testrpc() {
6056
--account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,1000000000000000000000000"
6157
)
6258

63-
if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
59+
if [ "$COVERAGE" = true ]; then
6460
node_modules/.bin/testrpc-sc --gasLimit 0xfffffffffff --port "$testrpc_port" "${accounts[@]}" > /dev/null &
6561
else
6662
node_modules/.bin/ganache-cli --gasLimit 8000000 "${accounts[@]}" > /dev/null &
6763
fi
6864

69-
7065
testrpc_pid=$!
7166
}
7267

7368
if testrpc_running; then
7469
echo "Using existing testrpc instance"
75-
# Do not start ethereum bridge unless it is a cron job from travis
76-
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
70+
# Do not start ethereum bridge unless it is a cron job
71+
if [ "$CIRCLE_CI_CRON" = true ]; then
7772
bridge_running
7873
if bridge_running; then
7974
echo "Using existing ethereum-bridge instance"
@@ -85,24 +80,32 @@ if testrpc_running; then
8580
else
8681
echo "Starting our own testrpc instance"
8782
start_testrpc
88-
# Do not start ethereum bridge unless it is a cron job from travis
89-
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
83+
# Do not start ethereum bridge unless it is a cron job
84+
if [ "$CIRCLE_CI_CRON" = true ]; then
9085
echo "Starting our own ethereum-bridge instance"
9186
sleep 10
9287
start_bridge
9388
fi
9489
fi
9590

96-
if ! [ -z "${TRAVIS_PULL_REQUEST+x}" ] && [ "$TRAVIS_PULL_REQUEST" != false ]; then
91+
if [ "$COVERAGE" = true ]; then
9792
curl -o node_modules/solidity-coverage/lib/app.js https://raw.githubusercontent.com/maxsam4/solidity-coverage/relative-path/lib/app.js
9893
node_modules/.bin/solidity-coverage
99-
if [ "$CONTINUOUS_INTEGRATION" = true ]; then
94+
if [ "$CIRCLECI" = true ]; then
10095
cat coverage/lcov.info | node_modules/.bin/coveralls
10196
fi
10297
else
103-
# Do not run a_poly_oracle,js tests unless it is a cron job from travis
104-
if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then
105-
node_modules/.bin/truffle test `ls test/*.js`
98+
if [ "$CIRCLECI" = true ]; then # using mocha junit reporter for parallelism in CircleCI
99+
mkdir test-results
100+
mkdir test-results/mocha
101+
rm truffle-config.js
102+
mv truffle-ci.js truffle-config.js
103+
# only run poly oracle and upgrade tests if cron job by CI
104+
if [ "$CIRCLE_CI_CRON" = true ]; then
105+
node_modules/.bin/truffle test `ls test/*.js | circleci tests split --split-by=timings`
106+
else
107+
node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js | circleci tests split --split-by=timings`
108+
fi
106109
else
107110
node_modules/.bin/truffle test `find test/*.js ! -name a_poly_oracle.js -and ! -name s_v130_to_v140_upgrade.js`
108111
fi

truffle-ci.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
require('babel-register');
2+
require('babel-polyfill');
3+
4+
module.exports = {
5+
networks: {
6+
development: {
7+
host: 'localhost',
8+
port: 8545,
9+
network_id: '*', // Match any network id
10+
gas: 7900000,
11+
},
12+
coverage: {
13+
host: "localhost",
14+
network_id: "*",
15+
port: 8545, // <-- If you change this, also set the port option in .solcover.js.
16+
gas: 0xfffffffffff, // <-- Use this high gas value
17+
gasPrice: 0x01 // <-- Use this low gas price
18+
}
19+
},
20+
solc: {
21+
optimizer: {
22+
enabled: true,
23+
runs: 200,
24+
},
25+
},
26+
mocha: {
27+
enableTimeouts: false,
28+
reporter: "mocha-junit-reporter",
29+
reporterOptions: {
30+
mochaFile: './test-results/mocha/results.xml'
31+
}
32+
}
33+
};

yarn.lock

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,11 @@ chardet@^0.4.0:
13771377
version "0.4.2"
13781378
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
13791379

1380+
charenc@~0.0.1:
1381+
version "0.0.2"
1382+
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
1383+
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=
1384+
13801385
checkpoint-store@^1.1.0:
13811386
version "1.1.0"
13821387
resolved "https://registry.yarnpkg.com/checkpoint-store/-/checkpoint-store-1.1.0.tgz#04e4cb516b91433893581e6d4601a78e9552ea06"
@@ -1694,14 +1699,11 @@ cron-parser@^2.4.0:
16941699
is-nan "^1.2.1"
16951700
moment-timezone "^0.5.0"
16961701

1697-
cross-spawn@^5.0.1:
1698-
version "5.1.0"
1699-
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
1700-
dependencies:
1701-
lru-cache "^4.0.1"
1702-
shebang-command "^1.2.0"
1703-
which "^1.2.9"
1704-
1702+
crypt@~0.0.1:
1703+
version "0.0.2"
1704+
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
1705+
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=
1706+
17051707
cross-spawn@^6.0.5:
17061708
version "6.0.5"
17071709
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
@@ -3557,7 +3559,7 @@ is-binary-path@^1.0.0:
35573559
dependencies:
35583560
binary-extensions "^1.0.0"
35593561

3560-
is-buffer@^1.1.5:
3562+
is-buffer@^1.1.5, is-buffer@~1.1.1:
35613563
version "1.1.6"
35623564
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
35633565

@@ -4219,6 +4221,15 @@ md5.js@^1.3.4:
42194221
inherits "^2.0.1"
42204222
safe-buffer "^5.1.2"
42214223

4224+
md5@^2.1.0:
4225+
version "2.2.1"
4226+
resolved "https://registry.yarnpkg.com/md5/-/md5-2.2.1.tgz#53ab38d5fe3c8891ba465329ea23fac0540126f9"
4227+
integrity sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=
4228+
dependencies:
4229+
charenc "~0.0.1"
4230+
crypt "~0.0.1"
4231+
is-buffer "~1.1.1"
4232+
42224233
42234234
version "0.3.0"
42244235
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
@@ -4418,12 +4429,23 @@ mkdirp-promise@^5.0.1:
44184429
dependencies:
44194430
mkdirp "*"
44204431

4421-
mkdirp@*, [email protected], [email protected], [email protected], "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
4432+
mkdirp@*, [email protected], [email protected], [email protected], "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@~0.5.1:
44224433
version "0.5.1"
44234434
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
44244435
dependencies:
44254436
minimist "0.0.8"
44264437

4438+
mocha-junit-reporter@^1.18.0:
4439+
version "1.18.0"
4440+
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-1.18.0.tgz#9209a3fba30025ae3ae5e6bfe7f9c5bc3c2e8ee2"
4441+
integrity sha512-y3XuqKa2+HRYtg0wYyhW/XsLm2Ps+pqf9HaTAt7+MVUAKFJaNAHOrNseTZo9KCxjfIbxUWwckP5qCDDPUmjSWA==
4442+
dependencies:
4443+
debug "^2.2.0"
4444+
md5 "^2.1.0"
4445+
mkdirp "~0.5.1"
4446+
strip-ansi "^4.0.0"
4447+
xml "^1.0.0"
4448+
44274449
mocha@^4.0.1, mocha@^4.1.0:
44284450
version "4.1.0"
44294451
resolved "https://registry.yarnpkg.com/mocha/-/mocha-4.1.0.tgz#7d86cfbcf35cb829e2754c32e17355ec05338794"
@@ -7192,6 +7214,11 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3:
71927214
parse-headers "^2.0.0"
71937215
xtend "^4.0.0"
71947216

7217+
xml@^1.0.0:
7218+
version "1.0.1"
7219+
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
7220+
integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU=
7221+
71957222
xmlhttprequest@*, [email protected]:
71967223
version "1.8.0"
71977224
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"

0 commit comments

Comments
 (0)