From d0b0785f68b9eed06f6738a488c575b098b9316c Mon Sep 17 00:00:00 2001 From: bayram98 Date: Wed, 15 Nov 2023 11:17:01 +0900 Subject: [PATCH] feat: import aggregator-hash from variables --- core/src/por/fetcher.ts | 6 ++---- core/src/por/main.ts | 7 ++++++- core/src/settings.ts | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/por/fetcher.ts b/core/src/por/fetcher.ts index 8a7529600..15ffbca1c 100644 --- a/core/src/por/fetcher.ts +++ b/core/src/por/fetcher.ts @@ -56,8 +56,6 @@ export async function fetchWithAggregator(aggregatorHash: string) { const value = await fetchData(feed) await insertData({ aggregatorId: aggregator.id, feedId: feed.id, value }) - return { - value: BigInt(value), - aggregator - } + + return { value: BigInt(value), aggregator } } diff --git a/core/src/por/main.ts b/core/src/por/main.ts index 86d67c485..7460aa0c2 100644 --- a/core/src/por/main.ts +++ b/core/src/por/main.ts @@ -1,15 +1,20 @@ +import { logger } from 'ethers' import { buildLogger } from '../logger' +import { POR_AGGREGATOR_HASH } from '../settings' import { hookConsoleError } from '../utils' import { fetchWithAggregator } from './fetcher' import { reportData } from './reporter' -const aggregatorHash = '0x952f883b8d2fd47a790307cb569118a215ea45eb861cefd4ed3b83ae7550f8e8' +const aggregatorHash = POR_AGGREGATOR_HASH const LOGGER = buildLogger() const main = async () => { hookConsoleError(LOGGER) const { value, aggregator } = await fetchWithAggregator(aggregatorHash) + + logger.info(`Fetched data:${value}`) + await reportData({ value, aggregator, logger: LOGGER }) } diff --git a/core/src/settings.ts b/core/src/settings.ts index 821857305..5bdcf0750 100644 --- a/core/src/settings.ts +++ b/core/src/settings.ts @@ -21,6 +21,10 @@ export const SLACK_WEBHOOK_URL = process.env.SLACK_WEBHOOK_URL || '' export const LOCAL_AGGREGATOR = process.env.LOCAL_AGGREGATOR || 'MEDIAN' export const LISTENER_DELAY = Number(process.env.LISTENER_DELAY) || 500 +// POR Aggregator +export const POR_AGGREGATOR_HASH = (process.env.POR_AGGREGATOR_HASH = + '0x952f883b8d2fd47a790307cb569118a215ea45eb861cefd4ed3b83ae7550f8e8' || '') + // Gas mimimums export const VRF_FULFILL_GAS_MINIMUM = 650_000 export const REQUEST_RESPONSE_FULFILL_GAS_MINIMUM = 400_000