2021-07-06 14:35:40 +00:00
|
|
|
# Uniswap Watcher
|
|
|
|
|
2021-07-14 12:30:26 +00:00
|
|
|
## Setup
|
|
|
|
|
|
|
|
Create a postgres12 database for the job queue:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo su - postgres
|
|
|
|
createdb uni-watcher-job-queue
|
|
|
|
```
|
|
|
|
|
|
|
|
Enable the `pgcrypto` extension on the job queue database (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro).
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```
|
|
|
|
postgres@tesla:~$ psql -U postgres -h localhost uni-watcher-job-queue
|
|
|
|
Password for user postgres:
|
|
|
|
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
|
|
|
|
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
|
|
|
|
Type "help" for help.
|
|
|
|
|
|
|
|
uni-watcher-job-queue=# CREATE EXTENSION pgcrypto;
|
|
|
|
CREATE EXTENSION
|
|
|
|
uni-watcher-job-queue=# exit
|
|
|
|
```
|
|
|
|
|
|
|
|
Create a postgres12 database for the address watcher:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo su - postgres
|
|
|
|
createdb uni-watcher
|
|
|
|
```
|
|
|
|
|
|
|
|
Update `environments/local.toml` with database connection settings for both the databases.
|
|
|
|
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
2021-07-06 14:35:40 +00:00
|
|
|
Run the server:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ yarn server
|
|
|
|
```
|
|
|
|
|
|
|
|
Start watching the factory contract:
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```bash
|
2021-07-07 05:40:10 +00:00
|
|
|
$ yarn watch:contract --address 0xfE0034a874c2707c23F91D7409E9036F5e08ac34 --kind factory --startingBlock 100
|
2021-07-06 14:35:40 +00:00
|
|
|
```
|
|
|
|
|
2021-07-07 05:40:10 +00:00
|
|
|
## Scripts
|
|
|
|
|
|
|
|
* `yarn server`
|
|
|
|
|
|
|
|
Start the GraphQL server.
|
|
|
|
|
|
|
|
* `yarn watch:contract`
|
|
|
|
|
|
|
|
Add contract to watch.
|
|
|
|
|
|
|
|
* `yarn lint`
|
|
|
|
|
|
|
|
Lint files.
|
2021-07-14 12:30:26 +00:00
|
|
|
|
2021-07-07 05:40:10 +00:00
|
|
|
```bash
|
|
|
|
# Lint fix.
|
|
|
|
$ yarn lint --fix
|
|
|
|
```
|