Skip to content

Commit

Permalink
Remove hmtoken dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
uivlis committed Jul 23, 2020
1 parent e45137d commit ef68280
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 20 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ ENV SOLC_BINARY="/root/.py-solc-x/solc-${SOLC_VERSION}/bin/solc"

# Necessary files for smart contract compilation, migration and testing
COPY . /work/

RUN ./bin/test
2 changes: 1 addition & 1 deletion bin/ci
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -exu
./bin/stop
docker-compose build
docker-compose run --no-deps -e CI=true job './bin/lint'
docker-compose run -w /work job bash -c "./bin/wait_then_run $*"
docker-compose run -w /work job
docker-compose run -w /work contracts
./bin/stop
./bin/generate-docs
18 changes: 3 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ services:
- GAS_LIMIT=6700000
- IPFS_HOST=ipfs
- IPFS_PORT=5001
- ETH_HOST=ganache
- ETH_PORT=8545
- ESCROW_BUCKETNAME=escrow-results
- ESCROW_AWS_ACCESS_KEY_ID=minio
- ESCROW_AWS_SECRET_ACCESS_KEY=minio123
- ESCROW_ENDPOINT_URL=http://minio:9000
- ESCROW_AWS_DEFAULT_REGION=us-west-2
- DEBUG=true
- USE_ESCROW_S3_STORAGE=True
command: /work/bin/wait_then_run
command: sh -c "rm /deployed-hmtoken/hmt.address.json; curl --retry 10 --retry-connrefused --retry-max-time 10 http://ganache:8545; npm install; npm run compile; /work/bin/wait_then_run"
depends_on:
- minio
links:
- ganache
- ipfs
- hmt
- kvstore
volumes:
- hmt_token_addr:/deployed-hmtoken
- eth_kvstore_addr:/deployed-kvstore
- ./minio:/data
- .:/work
Expand All @@ -46,17 +46,6 @@ services:
ports:
- 8545:8545

hmt:
image: hcaptcha/hmt-token
links:
- ganache
environment:
- ETH_HOST=ganache
- ETH_PORT=8545
command: sh -c "rm /deployed/hmt.address.json; curl --retry 10 --retry-connrefused --retry-max-time 10 http://ganache:8545 && npm run compile && python -m SimpleHTTPServer"
volumes:
- hmt_token_addr:/deployed

kvstore:
image: hcaptcha/eth-kvstore
links:
Expand Down Expand Up @@ -88,5 +77,4 @@ services:
- ./minio:/data

volumes:
hmt_token_addr:
eth_kvstore_addr:
31 changes: 31 additions & 0 deletions migrations/2_deploy_contracts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const fs = require('fs');

const path = require('path');

const HMToken = artifacts.require('./HMToken.sol');

const ADDRESS_OUTPUT_FILENAME = '/deployed-hmtoken/hmt.address.json';

module.exports = (deployer) => {
deployer
.deploy(HMToken, 1000000000, 'Human Token', 18, 'HMT')
.then(() => {
const fileContent = {
address: HMToken.address,
};

try {
fs.mkdirSync(path.dirname(ADDRESS_OUTPUT_FILENAME));
} catch (err) {
if (err.code !== 'EEXIST') throw err;
}

fs.writeFile(ADDRESS_OUTPUT_FILENAME, JSON.stringify(fileContent, null, 2), (err) => {
if (err) {
console.error(`unable to write address to output file: ${ADDRESS_OUTPUT_FILENAME}`);
} else {
console.log(`deployed hmt token address stored in ${ADDRESS_OUTPUT_FILENAME}`);
}
});
});
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion truffle.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
networks: {
development: {
host: ETH_HOST || '127.0.0.1',
port: ETH_PORT || 9545,
port: ETH_PORT || 8545,
network_id: '*'
},
live: {
Expand Down

0 comments on commit ef68280

Please sign in to comment.