You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A node.js app that was originally designed for pulling 0x staking events info, but now expanded to all other 0x related events.
3
+
EVM Blockchain Scraper, mainly for 0x Protocol Events and some extra useful Events.
4
4
5
5
## Getting started
6
6
7
-
Test locally:
7
+
Run locally:
8
8
9
-
- Step 1
10
-
Rename the `.env.exmaple` file to `.env`, or create a new `.env` file. Add the required env variables (see below for configureation details)
11
-
12
-
- Step 2
13
-
Set up the database variables in `docker-compose.yml` file to the desired database destination.
14
-
15
-
```
16
-
$ docker-compose up # get postgres up
17
-
```
18
-
19
-
- Step 3 Test build & Debug
20
-
21
-
```
22
-
$ yarn install
23
-
$ yarn build
24
-
```
25
-
26
-
- Step 4 Build migrations
27
-
If there are new tables to be created, or schema changes, you will need to create migration files first:
28
-
29
-
```
30
-
yarn migrate:create -n <YourMigrationName>
31
-
```
32
-
33
-
Modify the migration file in `migrations/` folder with necessary changes.
34
-
35
-
Run migration:
36
-
37
-
```
38
-
$ yarn migrate:run
39
-
40
-
```
41
-
42
-
To revert migration:
9
+
1. Copy the `.env.exmaple` file to `.env`. Add the `RPC_URL` for the chain(s) you are going to run
43
10
11
+
2. Start Postgres
12
+
```sh
13
+
docker-compose up -d # get postgres up
44
14
```
45
-
$ yarn migrate:revert
46
15
16
+
3. Build the Scraper images
17
+
```sh
18
+
docker-compose build
47
19
```
48
20
49
-
- Step 5
50
-
Start the scraper:
51
-
52
-
```
53
-
$ yarn start
21
+
4. Start the scraper(s)
22
+
```sh
23
+
docker-compose up event-pipeline-ethereum # change the chain name
54
24
```
55
-
56
-
## Configuration
57
-
58
-
### Environment variables:
59
-
60
-
**Required**
61
-
62
-
`ETHEREUM_RPC_URL` - The RPC URL to use. Must match `CHAIN_ID`.
63
-
64
-
`CHAIN_ID` - The EVM chain id.
65
-
66
-
`EP_DEPLOYMENT_BLOCK` - The block on which the proxy contract was deployed
67
-
68
-
`SCHEMA` - The schema to use to store events in the DB
69
-
70
-
**Optional**
71
-
72
-
`POSTGRES_URI` - The full postgres URI to connect to. Defaults to local development.
73
-
74
-
`START_BLOCK_OFFSET` - How many blocks before the current block to search for events, allowing for updates to previously scraped events that may be in orphaned blocks.
75
-
76
-
`MAX_BLOCKS_TO_PULL` - The maximum number of blocks to pull at once.
77
-
78
-
`MAX_BLOCKS_TO_SEARCH` - The maximum number of blocks to search for events at once.
79
-
80
-
`BLOCK_FINALITY_THRESHOLD` - How many blocks before the current block to end the search, allowing you to limit your event scrape to blocks that are relatively more settled.
81
-
82
-
`MINUTES_BETWEEN_RUNS` - How long to wait between scrapes.
83
-
84
-
`SHOULD_SYNCHRONIZE` - Whether typeorm should synchronize with the database from `POSTGRES_URI`.
85
-
86
-
`STAKING_DEPLOYMENT_BLOCK` - The block on which the staking contract was deployed
87
-
88
-
`STAKING_POOLS_JSON_URL` - The source for the JSON mapping of staking pools to UUIDs (for grabbing metadata about pools). Defaults to the 0x staking pool registry GitHub repo.
89
-
90
-
`STAKING_POOLS_METADATA_JSON_URL` - The source for the JSON mapping of UUIDs to metadata. Defaults to the 0x staking pool registry GitHub repo.
91
-
92
-
`BASE_GITHUB_LOGO_URL` - The base URL for grabbing logos for staking pools. Defaults to the 0x staking pool registry GitHub repo.
93
-
94
-
## Database snapshots
95
-
96
-
When running the app on a new database it can take a long time to find new events depending on how much time has passed since the contracts were deployed. There are options to dump and restore data from other sources using `pg_dump` ([Documentation](https://www.postgresql.org/docs/9.6/app-pgdump.html)) and `pg_restore` ([Documentation](https://www.postgresql.org/docs/9.2/app-pgrestore.html)). Some examples are outlined below.
97
-
98
-
These examples will require `postgresql` to be installed.
99
-
100
-
```
101
-
$ brew install postgresql
102
-
```
103
-
104
-
### Getting data from another database
105
-
106
-
If you know of another database that contains up-to-date data, you can `pg_dump` data from the relevant schemas from that database by running:
0 commit comments