Skip to content

Commit

Permalink
feat: external adapter running as task
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbn committed May 28, 2021
1 parent 35098ea commit ecf76cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 2 additions & 5 deletions services/external-adapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function getValidatorAPR(params) {
const analyticsData = await getAnalyticsFromNetworkAnalyticsContract(
params,
hexToUtf8(slaData.networkName),
slaData.periodType,
slaData.periodType
);
console.log('Analytics data:');
console.log(analyticsData);
Expand Down Expand Up @@ -97,7 +97,4 @@ app.post('/', async (req, res) => {
},
});
});

app.listen(port, () => {
console.log(`External adapter initialized at http://localhost:${port}`);
});
export default app;
12 changes: 12 additions & 0 deletions tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { task } from 'hardhat/config';
import { SUB_TASK_NAMES } from './subtasks';
import { printSeparator } from './utils';
import app from './services/external-adapter';

enum TASK_NAMES {
EXPORT_DATA = 'stacktical:export-data',
Expand All @@ -13,6 +14,7 @@ enum TASK_NAMES {
SET_PRECOORDINATOR = 'stacktical:set-precoordinator',
CHAINLINK_DOCKER_COMPOSE = 'stacktical:chainlink-docker-compose',
PREPARE_CHAINLINK_NODES = 'stacktical:prepare-chainlink-nodes',
EXTERNAL_ADAPTER = 'stacktical:external-adapter',
}

task(
Expand Down Expand Up @@ -115,4 +117,14 @@ task(
await run(SUB_TASK_NAMES.SETUP_DOCKER_COMPOSE);
});

task(
TASK_NAMES.EXTERNAL_ADAPTER,
'Deploys Oracle and LinkToken contracts and creates the proper docker-compose files'
).setAction(async (_, { run }) => {
app.listen(6060, () => {
console.log(`External adapter initialized at http://localhost:${6060}`);
});
return new Promise(() => {});
});

module.exports = {};

0 comments on commit ecf76cd

Please sign in to comment.