Skip to content

Commit

Permalink
feat: import aggregator-hash from variables
Browse files Browse the repository at this point in the history
  • Loading branch information
bayram98 committed Nov 15, 2023
1 parent 01d4488 commit d0b0785
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions core/src/por/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
7 changes: 6 additions & 1 deletion core/src/por/main.ts
Original file line number Diff line number Diff line change
@@ -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 })
}

Expand Down
4 changes: 4 additions & 0 deletions core/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d0b0785

Please sign in to comment.