Skip to content

Commit e647526

Browse files
committed
update dev configuration for gamma network name
1 parent cdd20a4 commit e647526

4 files changed

Lines changed: 46 additions & 42 deletions

File tree

config/DEV.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export default {
22
"DEPLOY_CONTRACTS" : false,
33
"FORCE_LATEST_LOAD_CONTRACT_VERSION" : "1.1.0",
44
"FORCE_LATEST_NOTARY_CONTRACT_VERSION" : null,
5+
"GETH_NETWORK" : "gamma",
56
"IS_DEPLOYED_STAGE" : true,
67
"LOGGING_LEVELS": {
78
"CLOUDWATCH": "debug",

config/custom-environment-variables.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
"FORCE_LATEST_LOAD_CONTRACT_VERSION" : "FORCE_LATEST_LOAD_CONTRACT_VERSION",
2525
"FORCE_LATEST_NOTARY_CONTRACT_VERSION" : "FORCE_LATEST_NOTARY_CONTRACT_VERSION",
2626
"GETH_NODE": "GETH_NODE",
27+
"GETH_NETWORK": "GETH_NETWORK",
2728
"INFLUXDB_URL": "INFLUXDB_URL",
2829
"INFURA_PROJECT_ID": "INFURA_PROJECT_ID",
2930
"REDIS_URL": "REDIS_URL",

src/eth/ethers/EthersEthereumService.ts

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -28,61 +28,63 @@ const logger = Logger.get(module.filename);
2828
export class EthersEthereumService extends AbstractEthereumService {
2929
protected provider: ethers.providers.Provider;
3030

31-
constructor() {
31+
constructor(skip?: boolean) {
3232
super();
33-
if (config.has('GETH_NETWORK')) {
34-
const network = config.get('GETH_NETWORK');
35-
const applicableProviders: ethers.providers.BaseProvider[] = [];
33+
if (!skip) {
34+
if (config.has('GETH_NETWORK')) {
35+
const network = config.get('GETH_NETWORK');
36+
const applicableProviders: ethers.providers.BaseProvider[] = [];
3637

37-
logger.debug(`Connecting Ethers.js to [${network}]`);
38+
logger.debug(`Connecting Ethers.js to [${network}]`);
3839

39-
// Add Infura provider if we have a projectId
40-
if (config.has('INFURA_PROJECT_ID')) {
41-
const projectId = config.get('INFURA_PROJECT_ID');
40+
// Add Infura provider if we have a projectId
41+
if (config.has('INFURA_PROJECT_ID')) {
42+
const projectId = config.get('INFURA_PROJECT_ID');
4243

43-
logger.debug(`Adding InfuraProvider [${projectId}]`);
44-
applicableProviders.push(new ethers.providers.InfuraProvider(network, projectId));
45-
}
44+
logger.debug(`Adding InfuraProvider [${projectId}]`);
45+
applicableProviders.push(new ethers.providers.InfuraProvider(network, projectId));
46+
}
4647

47-
// Add Etherscan provider if we have an apiKey
48-
if (config.has('ETHERSCAN_API_KEY')) {
49-
const apiKey = config.get('ETHERSCAN_API_KEY');
48+
// Add Etherscan provider if we have an apiKey
49+
if (config.has('ETHERSCAN_API_KEY')) {
50+
const apiKey = config.get('ETHERSCAN_API_KEY');
5051

51-
logger.debug(`Adding EtherscanProvider [${apiKey}]`);
52-
applicableProviders.push(new ethers.providers.EtherscanProvider(network, apiKey));
53-
}
52+
logger.debug(`Adding EtherscanProvider [${apiKey}]`);
53+
applicableProviders.push(new ethers.providers.EtherscanProvider(network, apiKey));
54+
}
55+
56+
// Include the default providers from Ethers.js
57+
const defaultProvider = ethers.getDefaultProvider(network);
58+
if (defaultProvider instanceof ethers.providers.FallbackProvider) {
59+
logger.debug(`Adding ${defaultProvider.providers.length} FallbackProviders`);
60+
applicableProviders.push(...defaultProvider.providers);
61+
} else {
62+
logger.debug(`Adding DefaultProvider`);
63+
applicableProviders.push(defaultProvider);
64+
}
65+
66+
if (applicableProviders.length === 0) {
67+
throw new Error(`Unable to build list of Providers`);
68+
}
5469

55-
// Include the default providers from Ethers.js
56-
const defaultProvider = ethers.getDefaultProvider(network);
57-
if (defaultProvider instanceof ethers.providers.FallbackProvider) {
58-
logger.debug(`Adding ${defaultProvider.providers.length} FallbackProviders`);
59-
applicableProviders.push(...defaultProvider.providers);
70+
this.provider = new ethers.providers.FallbackProvider(applicableProviders);
6071
} else {
61-
logger.debug(`Adding DefaultProvider`);
62-
applicableProviders.push(defaultProvider);
63-
}
72+
const GETH_NODE = config.get('GETH_NODE');
6473

65-
if (applicableProviders.length === 0) {
66-
throw new Error(`Unable to build list of Providers`);
67-
}
74+
logger.debug(`Connecting Ethers.js to [${GETH_NODE}]`);
6875

69-
this.provider = new ethers.providers.FallbackProvider(applicableProviders);
70-
} else {
71-
const GETH_NODE = config.get('GETH_NODE');
76+
this.provider = new ethers.providers.JsonRpcProvider({
77+
url: GETH_NODE,
78+
});
7279

73-
logger.debug(`Connecting Ethers.js to [${GETH_NODE}]`);
80+
// Development Geth POA network does not continually create blocks
81+
this.transactionConfirmations = 1;
82+
}
7483

75-
this.provider = new ethers.providers.JsonRpcProvider({
76-
url: GETH_NODE,
84+
this.provider.on('error', error => {
85+
logger.error(`Ethers.js Provider Error: ${error}`);
7786
});
78-
79-
// Development Geth POA network does not continually create blocks
80-
this.transactionConfirmations = 1;
8187
}
82-
83-
this.provider.on('error', error => {
84-
logger.error(`Ethers.js Provider Error: ${error}`);
85-
});
8688
}
8789

8890
// Network/Node Methods

src/eth/ethers/LoomEthersEthereumService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class LoomEthersEthereumService extends EthersEthereumService {
8585
}
8686

8787
constructor() {
88-
super();
88+
super(true);
8989
const GETH_NODE = config.get('GETH_NODE');
9090

9191
logger.debug(`Connecting Ethers.js to [${GETH_NODE}]`);

0 commit comments

Comments
 (0)