Skip to content

Commit 6b31a35

Browse files
committed
Adding Scroll Block Scraper
1 parent 5e7a5ed commit 6b31a35

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

Dockerfile.dev

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ RUN apk add git python3 make g++
77
COPY package.json tsconfig.json yarn.lock ./
88
RUN yarn install --frozen-lockfile
99

10-
COPY migrations migrations
1110
COPY src src
1211

1312
#Start
1413
RUN yarn build
15-
CMD [ "yarn", "migrate_and_start" ]
14+
CMD [ "yarn", "start" ]

docker-compose-dev.yml

+31
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,33 @@ services:
282282
FEAT_WRAP_UNWRAP_NATIVE_EVENT: "true"
283283
WRAP_UNWRAP_NATIVE_CONTRACT_ADDRESS: '0x4200000000000000000000000000000000000006'
284284

285+
event-pipeline-scroll:
286+
build:
287+
context: .
288+
dockerfile: Dockerfile.dev
289+
platform: linux/amd64
290+
restart: always
291+
environment:
292+
SCRAPER_MODE: 'BLOCKS'
293+
EVM_RPC_URL: '${RPC_URL_SCROLL}'
294+
CHAIN_ID: '534352'
295+
POSTGRES_URI: 'postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}'
296+
SCHEMA: 'events_scroll'
297+
FEAT_ZEROEX_EXCHANGE_PROXY: "false"
298+
SETTLER_DEPLOYMENT_BLOCK: 7474150
299+
MAX_BLOCKS_TO_SEARCH: 1000
300+
MAX_BLOCKS_TO_PULL: 100
301+
SECONDS_BETWEEN_RUNS: 1
302+
RESCRAPE_BLOCKS: 10
303+
FEAT_WRAP_UNWRAP_NATIVE_EVENT: "true"
304+
WRAP_UNWRAP_NATIVE_CONTRACT_ADDRESS: '0x5300000000000000000000000000000000000004'
305+
FEAT_TOKENS_FROM_TRANSFERS: "true"
306+
FEAT_ERC20_TRANSFER_ALL: "true"
307+
FEAT_SETTLER_ERC721_TRANSFER_EVENT: "true"
308+
FEAT_SETTLER_RFQ_ORDER_EVENT: "true"
309+
networks:
310+
- 0x-data-migrations_default
311+
285312
token-scraper-ethereum:
286313
depends_on:
287314
- postgres
@@ -306,3 +333,7 @@ services:
306333
MAX_BLOCKS_TO_PULL: 1000
307334
MAX_TX_TO_PULL: 1000
308335
SECONDS_BETWEEN_RUNS: 5
336+
337+
networks:
338+
0x-data-migrations_default:
339+
external: true

src/config.ts

+12-11
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ const supportedChains: Map = {
7171
42161: { name: 'Arbitrum' },
7272
43114: { name: 'Avalanche' },
7373
42220: { name: 'Celo' },
74+
534352: { name: 'Scroll' },
7475
};
7576

7677
interface BridgeContract {
@@ -138,10 +139,10 @@ export const SCRAPER_MODE: ScraperMode =
138139
process.env.SCRAPER_MODE === undefined
139140
? DEFAULT_SCRAPER_MODE
140141
: process.env.SCRAPER_MODE === 'BLOCKS'
141-
? 'BLOCKS'
142-
: process.env.SCRAPER_MODE === 'EVENTS'
143-
? 'EVENTS'
144-
: throwError('Wrong SCRAPER_MODE');
142+
? 'BLOCKS'
143+
: process.env.SCRAPER_MODE === 'EVENTS'
144+
? 'EVENTS'
145+
: throwError('Wrong SCRAPER_MODE');
145146
export const METRICS_PATH = process.env.METRICS_PATH || DEFAULT_METRICS_PATH;
146147

147148
export const PROMETHEUS_PORT = getIntConfig('PROMETHEUS_PORT', DEFAULT_PROMETHEUS_PORT);
@@ -380,13 +381,13 @@ export const FEAT_UNISWAP_V2_PAIR_CREATED_EVENT = getBoolConfig(
380381
export const UNISWAP_V2_PAIR_CREATED_PROTOCOL_CONTRACT_ADDRESSES_AND_START_BLOCKS = process.env
381382
.UNISWAP_V2_PAIR_CREATED_PROTOCOL_CONTRACT_ADDRESSES_AND_START_BLOCKS
382383
? process.env.UNISWAP_V2_PAIR_CREATED_PROTOCOL_CONTRACT_ADDRESSES_AND_START_BLOCKS.split(',').map((contract) => {
383-
const [name, factoryAddress, startBlock] = contract.split(':');
384-
return {
385-
name,
386-
factoryAddress,
387-
startBlock: parseInt(startBlock),
388-
};
389-
})
384+
const [name, factoryAddress, startBlock] = contract.split(':');
385+
return {
386+
name,
387+
factoryAddress,
388+
startBlock: parseInt(startBlock),
389+
};
390+
})
390391
: [];
391392

392393
if (

src/scripts/pull_and_save_block_events.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export class BlockEventsScraper {
408408

409409
if (lastKnownBlock === undefined) {
410410
logger.warn('First Run');
411-
const firstStartBlock = Math.max(...eventScrperProps.map((props) => props.startBlock));
411+
const firstStartBlock = Math.min(...eventScrperProps.filter((props) => props.enabled).map((props) => props.startBlock));
412412
logger.warn(`Going to start from block: ${firstStartBlock}`);
413413
const newBlocks = await web3Source.getBatchBlockInfoForRangeAsync(firstStartBlock, firstStartBlock, true);
414414
await getParseSaveBlocksTransactionsEvents(connection, producer, newBlocks, true);

0 commit comments

Comments
 (0)