Monitoring service for Uniswap V3 pools that continuously tracks and logs essential data points with go-ethereum, stores them in a persistent datastore (sqlite3), and provides access to the data through a REST endpoint.
Open config.json file and fill in the eth_client_url field. This is useful to connect to the Ethereum Node.
Also fill in the pool_address of the Uniswap V3 Pool you want to track. Rest of the fields can be left to default.
Here are some details about the fields in the config file:
pause_duration: Pause duration between consecutive RPC Calls. Default is 6 seconds. (Default=6000)
log_frequency: After this many number of blocks the pool data be stored in the db. (Default=12)
Get dependencies:
go mod tidy
Run the app:
go run .
# use "--verbose" flag to get additional logs
go run . --verbose
Get latest data with pool_id being 1:
curl -X GET "http://127.0.0.1:3000/v1/api/pool/1?latest"
Get block 420 data with pool_id being 1:
curl -X GET "http://127.0.0.1:3000/v1/api/pool/1?block=420"
Get historic data:
curl -X GET "http://127.0.0.1:3000/v1/api/pool/1/historic"
In case you want to know the pool_id for all the pool addresses tracked:
curl -X GET "http://127.0.0.1:3000/v1/api/pool_mapping"