Skip to content

Commit f0b56bb

Browse files
committed
Block chain runner scripts factored out
1 parent ed925e2 commit f0b56bb

33 files changed

Lines changed: 2214 additions & 3164 deletions

.eslintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ module.exports = {
3737
"jsonrpc", "timestamp", "uint256", "erc20", "bignumber", "lodash",
3838
"arg", "npm", "seedrandom", "eql", "sinon", "yaml", "promisify",
3939
"passcode", "geth", "rpc", "rpcmsg","stdev", "stochasm",
40-
"whitelist", "uint",
40+
"whitelist", "uint", "passcodes", "keystore", "hdwallet",
4141

4242
// shorthand
4343
"eth", "args", "util", "utils", "msg", "prev", "bal",
4444
"init", "params", "mul", "async", "vals", "fns", "addrs",
4545
"fns", "num", "dev", "pre","abi", "gte","rnd", "chk", "bals", "lte",
46-
"addr",
46+
"addr", "conf",
4747

4848
// project-specific
4949
"rebase", "gons", "frg", "rng", "blockchain", "minlot",
5050
"redemptions", "rebased", "ganache", "ethclient",
51-
"bytecode", "Binance",
51+
"bytecode", "Binance", "ethereum",
5252

5353
// names
5454
"nithin",

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "scripts/frg-ethereum-runners"]
2+
path = scripts/frg-ethereum-runners
3+
url = [email protected]:frgprotocol/frg-ethereum-runners.git

.travis.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,30 @@ sudo: false
33
language: node_js
44
node_js:
55
- "8"
6+
67
cache:
78
directories:
89
- node_modules
10+
11+
git:
12+
submodules:
13+
false
14+
15+
addons:
16+
apt:
17+
sources:
18+
- sourceline: 'ppa:ethereum/ethereum'
19+
packages:
20+
- ethereum
21+
922
before_install:
10-
- ./scripts/setup_ci_env.sh
23+
- git submodule update --init --recursive
24+
- ./scripts/frg-ethereum-runners/ci-dep-install.sh
25+
1126
script:
1227
- npm run lint
13-
- npm run test
28+
- ./scripts/test.sh
29+
1430
notifications:
1531
email:
1632

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,21 @@ The μFragments protocol smart contracts on Ethereum.
55

66
# Getting started
77
```bash
8-
# Install dependencies
8+
# Install ethereum local blockchain(s) and associated dependencies
9+
./scripts/frg-ethereum-runners/dep-install.sh
10+
11+
# Install project dependencies
912
npm install
1013
```
1114

1215
# Useful scripts
1316
``` bash
14-
# You can use the following commands to start/stop local ganache chain
15-
npm run blockchain:start
16-
npm run blockchain:stop
17+
# You can use the following commands to start/stop local chain
18+
npm run blockchain:[start|stop] [ganacheUnitTest|gethUnitTest]
19+
1720
# Lint code
1821
npm run lint
22+
1923
# track gas utilization
2024
npm run trackGasUtilization
2125
```

migrations/1_initial_migration.js

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
const Migrations = artifacts.require('./Migrations.sol');
22
const _require = require('app-root-path').require;
33
const truffleConfig = _require('/truffle.js');
4+
const accounts = truffleConfig.accounts;
45

5-
module.exports = function (deployer, network, addresses) {
6+
module.exports = function (deployer, network) {
7+
const deployerAccount = accounts[0];
68
const config = truffleConfig.networks[network];
7-
89
const deploymentConfig = {
9-
gas: config.gas
10+
gas: config.gas,
11+
from: deployerAccount
1012
};
11-
12-
async function preDeploymentCalls () {
13-
if (config.passcode) {
14-
for (const account in config.passcode) {
15-
if (Object.prototype.hasOwnProperty.call(config.passcode, account)) {
16-
await web3.personal.unlockAccount(account, config.passcode[account], 0);
17-
deployer.logger.log('Unlocked account: ' + account);
18-
}
19-
}
20-
}
21-
}
22-
23-
deployer.then(preDeploymentCalls).then(() => deployer.deploy(Migrations, deploymentConfig));
13+
deployer.deploy(Migrations, deploymentConfig);
2414
};

migrations/2_deploy_contracts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ const APP_ROOT_PATH = require('app-root-path');
77
const _require = APP_ROOT_PATH.require;
88
const generateYaml = _require('/util/yaml_generator');
99
const truffleConfig = _require('/truffle.js');
10+
const accounts = truffleConfig.accounts;
1011

11-
module.exports = function (deployer, network, accounts) {
12+
module.exports = function (deployer, network) {
1213
const deployerAccount = accounts[0];
1314
const config = truffleConfig.networks[network];
1415
const deploymentConfig = {

0 commit comments

Comments
 (0)