Skip to content

Commit

Permalink
Merge pull request #154 from 0xProject/nicolas/deng-379-scroll-chain-…
Browse files Browse the repository at this point in the history
…block-scraper

Adding Scroll Block Scraper
  • Loading branch information
nicoalencar committed Sep 11, 2024
2 parents fd2f815 + 69dd69a commit ebf7e81
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ RUN apk add git python3 make g++
COPY package.json tsconfig.json yarn.lock ./
RUN yarn install --frozen-lockfile

COPY migrations migrations
COPY src src

#Start
RUN yarn build
CMD [ "yarn", "migrate_and_start" ]
CMD [ "yarn", "start" ]
31 changes: 31 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,33 @@ services:
FEAT_WRAP_UNWRAP_NATIVE_EVENT: "true"
WRAP_UNWRAP_NATIVE_CONTRACT_ADDRESS: '0x4200000000000000000000000000000000000006'

event-pipeline-scroll:
build:
context: .
dockerfile: Dockerfile.dev
platform: linux/amd64
restart: always
environment:
SCRAPER_MODE: 'BLOCKS'
EVM_RPC_URL: '${RPC_URL_SCROLL}'
CHAIN_ID: '534352'
POSTGRES_URI: 'postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}'
SCHEMA: 'events_scroll'
FEAT_ZEROEX_EXCHANGE_PROXY: "false"
SETTLER_DEPLOYMENT_BLOCK: 7474150
MAX_BLOCKS_TO_SEARCH: 1000
MAX_BLOCKS_TO_PULL: 100
SECONDS_BETWEEN_RUNS: 1
RESCRAPE_BLOCKS: 10
FEAT_WRAP_UNWRAP_NATIVE_EVENT: "true"
WRAP_UNWRAP_NATIVE_CONTRACT_ADDRESS: '0x5300000000000000000000000000000000000004'
FEAT_TOKENS_FROM_TRANSFERS: "true"
FEAT_ERC20_TRANSFER_ALL: "true"
FEAT_SETTLER_ERC721_TRANSFER_EVENT: "true"
FEAT_SETTLER_RFQ_ORDER_EVENT: "true"
networks:
- 0x-data-migrations_default

token-scraper-ethereum:
depends_on:
- postgres
Expand All @@ -306,3 +333,7 @@ services:
MAX_BLOCKS_TO_PULL: 1000
MAX_TX_TO_PULL: 1000
SECONDS_BETWEEN_RUNS: 5

networks:
0x-data-migrations_default:
external: true
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const supportedChains: Map = {
42161: { name: 'Arbitrum' },
43114: { name: 'Avalanche' },
42220: { name: 'Celo' },
534352: { name: 'Scroll' },
};

interface BridgeContract {
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/pull_and_save_block_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ export class BlockEventsScraper {

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

0 comments on commit ebf7e81

Please sign in to comment.