SwapScope publisher consumes Syntropy Data Layer's Ethereum event log stream. Liquidity addition (mint) and removal (burn) events are detected, decoded and expanded with additional information about involved tokens. Token information (symbol, decimals, prices) are received through CoinGecko API.
- Compile code.
make build
- Set variables.
-
Using .env file. See .example.env (works if running locally)
-
OR Using flags or environment variables:
Flag | Environment Variables | (Mandatory?) Description | Default value |
---|---|---|---|
nats | NATS_URL | (Y) NATS servers URL | - |
nats-sub-creds | NATS_SUB_CREDS_FILE | (Y/N1) NATS Subscriber Credentials File path (combined JWT and NKey file) | - |
nats-sub-jwt | NATS_SUB_JWT | (Y/N1) NATS Subscriber Credentials JWT string | - |
nats-sub-nkey | NATS_SUB_NKEY | (Y/N1) NATS Subscriber Credentials NKey string | - |
pub-subject-prefix | SUBJECT_PREFIX | (Y2) Subject prefix | syntropy.analytics |
nats-pub-creds | NATS_PUB_CREDS_FILE | (Y/N1) NATS Publisher Credentials File path (combined JWT and NKey file) | - |
nats-pub-jwt | NATS_PUB_JWT | (Y/N1) NATS Publisher Credentials JWT string | - |
nats-pub-nkey | NATS_PUB_NKEY | (Y/N1) NATS Publisher Credentials NKey string | - |
eth-node-address | ETH_NODE | (N) Ethereum Full Node address | - |
db-host | DB_HOST | (Y) Database host string | - |
db-port | DB_PORT | (Y) Database port | - |
db-user | DB_USER | (Y) Database User Name | - |
db-passw | DB_PASSWORD | (Y) Database Password | - |
db-name | DB_NAME | (Y) Database Name | - |
cache-logs-expire | LOG_CACHE_EXPIRY_TIME | (N2) Log Cache Record Expiration Time | 2m |
cache-logs-purge | LOG_CACHE_PURGE_TIME | (N2) Log Cache Record Purge Time | 3m |
cache-prices-expire | PRICE_CACHE_EXPIRY_TIME | (N2) Token Price Cache Record Expiration Time | 2m |
cache-prices-purge | PRICE_CACHE_PURGE_TIME | (N2) Token Price Cache Record Purge Time | 3m |
coingecko-api | COINGECKO_API_URL | (N2) CoinGecko API url | https://api.coingecko.com/api/v3 |
api-timeout | API_FETCH_TIMEOUT | (N2) API fetch timeout | 2m |
api-ratelimit | API_RATE_LIMIT | (N2) Conservative API Rate Limit (e.g. 10-30 calls per minute) | 12 |
- Run with golang (with flags if any).
go run ./cmd/swapscope [flags]
- Build image.
docker build -f ./docker/Dockerfile -t swapscope .
- Run container.
docker run -it --rm --env-file=.env swapscope
Footnotes
-
If
nats-sub-creds
(nats creds file location) is set, thennats-sub-jwt
andnats-sub-nkey
are not required. Otherwisenats-sub-jwt
andnats-sub-nkey
can be set andnats-sub-creds
has to be empty. The same applies tonats-pub-*
. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 -
Default value is set by the app in
env.go
. For Cache timings if set to 0 - cache elements will never expire. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8