{"id":21097347,"url":"https://github.com/dl-nft-books/tracker-svc","last_synced_at":"2026-04-30T07:36:45.698Z","repository":{"id":148774042,"uuid":"609033690","full_name":"dl-nft-books/tracker-svc","owner":"dl-nft-books","description":"Service responsible for tracking events from factory and token contracts","archived":false,"fork":false,"pushed_at":"2024-03-25T13:11:42.000Z","size":58268,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-27T10:46:34.722Z","etag":null,"topics":["backend","contracts","golang","goroutines","psql","tracker"],"latest_commit_sha":null,"homepage":"","language":"Rich Text Format","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dl-nft-books.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-03T08:34:15.000Z","updated_at":"2023-03-03T09:01:12.000Z","dependencies_parsed_at":"2024-11-19T22:57:41.459Z","dependency_job_id":null,"html_url":"https://github.com/dl-nft-books/tracker-svc","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dl-nft-books/tracker-svc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dl-nft-books%2Ftracker-svc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dl-nft-books%2Ftracker-svc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dl-nft-books%2Ftracker-svc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dl-nft-books%2Ftracker-svc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dl-nft-books","download_url":"https://codeload.github.com/dl-nft-books/tracker-svc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dl-nft-books%2Ftracker-svc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261582674,"owners_count":23180634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","contracts","golang","goroutines","psql","tracker"],"created_at":"2024-11-19T22:47:24.231Z","updated_at":"2026-04-30T07:36:40.665Z","avatar_url":"https://github.com/dl-nft-books.png","language":"Rich Text Format","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contract-tracker\n\n## Description\n\nContract Tracker service is responsible for tracking events from factory and token contracts. You might read about service functionality in more details below.  \n\n### Factory Tracker\n- Listen to the newly deployed contracts.\n\n### Token Tracker\n- Listen to successful mint events, get book file ipfs hash, download file from the s3 storage and upload it to the IPFS using either _Pinata_ or _Infura_ clients.\n- Listen to transfer events.\n- Listen to update events.\n\nThe service contains metadata and files IPFS uploading logic. The uploader client is configurable. Currently, there is a support just for _Infura_ and _Pinata_ clients (_Infura_ is not recommended as it was proven to process files way too slowly)\n\n## Tracking Flow\n\nTracking flow functions as follows: we firstly initialize a `factory_tracker` and `factory_consumer` for a factory contract using `factory_combiner`. That is, `factory_tracker` runs a web socket and when it catches a deploy event, sends it to the internal channel `internalCh`. Then the `factory_consumer` catches this event, processes it, and after that sends it to the deployed contracts channel `deployedContractsCh`. Then, the `token_routiner` catches this event and creates a separate `token_combiner` which includes a `token_tracker` and `token_consumer`, similarly to the `factory_combiner`. In some sense, `token_routiner` works as a manager of all goroutines, that is why it is called so :)\n\n![alt text](./docs/images/tracker_structure.png)\n\n\n## Install\n\n  ```bash\n  git clone contract-runners\n  cd \n  go build main.go\n  export KV_VIPER_FILE=./config.yaml\n  ./main migrate up\n  ./main run service\n  ```\n\n## Documentation\n\nWe do use openapi:json standard for API. We use swagger for documenting our API.\n\nTo open online documentation, go to [swagger editor](http://localhost:8080/swagger-editor/) here is how you can start it\n```bash\n  cd docs\n  npm install\n  npm start\n```\nTo build documentation use `npm run build` command,\nthat will create open-api documentation in `web_deploy` folder.\n\nTo generate resources for Go models run `./generate.sh` script in root folder.\nuse `./generate.sh --help` to see all available options.\n\n\n## Running from docker \n  \nMake sure that the docker is installed.\nUse `docker run ` with `-p 8080:80` to expose port 80 to 8080\n\n```bash\ndocker build -t contract-tracker .\ndocker run -e KV_VIPER_FILE=/config.yaml contract-tracker\n```\n\n## Running from Source\n\n* Set up environment value with config file path `KV_VIPER_FILE=./config.yaml`\n* Provide valid config file\n* Launch the service with `migrate up` command to create database schema\n* Launch the service with `run service` command\n\n\n### Database\nFor services, we do use ***PostgresSQL*** database. \nYou can [install it locally](https://www.postgresql.org/download/) or use [docker image](https://hub.docker.com/_/postgres/).\n\n\n### Third-party services\n- RPC and Websocket — [Alchemy](https://www.alchemy.com/) in this particular case.\n- IPFS Uploader Client — either [Pinata](https://www.pinata.cloud/) or [Infura](https://www.infura.io/). We recommend using former.  \n\n## Contacts\n\nDmytro Zakharov is responsible for this service. Can be contacted via the _Telegram_ (`@ZamDimon`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdl-nft-books%2Ftracker-svc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdl-nft-books%2Ftracker-svc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdl-nft-books%2Ftracker-svc/lists"}