diff --git a/packages/concordia-contracts/constants/config/defaults.js b/packages/concordia-contracts/constants/config/defaults.js new file mode 100644 index 0000000..e2cfa34 --- /dev/null +++ b/packages/concordia-contracts/constants/config/defaults.js @@ -0,0 +1,16 @@ +const DEVELOP_CHAIN_HOST_DEFAULT = '127.0.0.1'; +const DEVELOP_CHAIN_PORT_DEFAULT = '8545'; + +const TEST_CHAIN_HOST_DEFAULT = '127.0.0.1'; +const TEST_CHAIN_PORT_DEFAULT = '8546'; + +module.exports = { + develop: { + chainHost: DEVELOP_CHAIN_HOST_DEFAULT, + chainPort: DEVELOP_CHAIN_PORT_DEFAULT, + }, + test: { + chainHost: TEST_CHAIN_HOST_DEFAULT, + chainPort: TEST_CHAIN_PORT_DEFAULT, + }, +}; diff --git a/packages/concordia-contracts/package.json b/packages/concordia-contracts/package.json index aba8e5d..c495d6f 100644 --- a/packages/concordia-contracts/package.json +++ b/packages/concordia-contracts/package.json @@ -10,7 +10,8 @@ "_eslint": "yarn eslint . --format table", "_solhint": "yarn solhint --formatter table contracts/*.sol test/*.sol", "test": "yarn truffle test", - "migrate": "yarn truffle migrate --network develop --reset" + "migrate": "yarn truffle migrate --network develop", + "migrate-reset": "yarn truffle migrate --network develop --reset" }, "dependencies": { "@openzeppelin/contracts": "~3.2.0", diff --git a/packages/concordia-contracts/truffle-config.js b/packages/concordia-contracts/truffle-config.js index 3ef72a1..669e9b9 100644 --- a/packages/concordia-contracts/truffle-config.js +++ b/packages/concordia-contracts/truffle-config.js @@ -1,7 +1,8 @@ const path = require('path'); +const defaults = require('./constants/config/defaults'); -const { GANACHE_HOST } = process.env; -const { GANACHE_PORT } = process.env; +const { CHAIN_HOST } = process.env; +const { CHAIN_PORT } = process.env; module.exports = { // See @@ -14,13 +15,13 @@ module.exports = { contracts_build_directory: path.join(__dirname, 'build/'), networks: { develop: { - host: GANACHE_HOST || '127.0.0.1', - port: GANACHE_PORT || '8545', + host: CHAIN_HOST || defaults.develop.chainHost, + port: CHAIN_PORT || defaults.develop.chainPort, network_id: '*', }, test: { - host: GANACHE_HOST || '127.0.0.1', - port: GANACHE_PORT || '8546', + host: CHAIN_HOST || defaults.test.chainHost, + port: CHAIN_PORT || defaults.test.chainPort, network_id: '*', }, },