{"id":29089632,"url":"https://github.com/openzeppelin/openzeppelin-subgraphs","last_synced_at":"2025-06-28T04:04:17.892Z","repository":{"id":37486549,"uuid":"375154679","full_name":"OpenZeppelin/openzeppelin-subgraphs","owner":"OpenZeppelin","description":"Subgraph schema and templates to index the activity of OpenZeppelin Contracts.","archived":false,"fork":false,"pushed_at":"2025-02-25T15:09:18.000Z","size":358,"stargazers_count":146,"open_issues_count":4,"forks_count":84,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-29T13:59:31.835Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.openzeppelin.com/subgraphs/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenZeppelin.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":"2021-06-08T21:53:55.000Z","updated_at":"2025-04-14T17:52:55.000Z","dependencies_parsed_at":"2024-01-15T15:55:15.169Z","dependency_job_id":"99336f0b-ee10-4c81-9cc2-48b5b3eb4169","html_url":"https://github.com/OpenZeppelin/openzeppelin-subgraphs","commit_stats":{"total_commits":125,"total_committers":8,"mean_commits":15.625,"dds":0.128,"last_synced_commit":"600adbee8be29e0ef668bcfcbaef2cdb5b82f652"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/OpenZeppelin/openzeppelin-subgraphs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-subgraphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-subgraphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-subgraphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-subgraphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenZeppelin","download_url":"https://codeload.github.com/OpenZeppelin/openzeppelin-subgraphs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenZeppelin%2Fopenzeppelin-subgraphs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262371684,"owners_count":23300595,"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":[],"created_at":"2025-06-28T04:04:16.457Z","updated_at":"2025-06-28T04:04:17.881Z","avatar_url":"https://github.com/OpenZeppelin.png","language":"TypeScript","readme":"# OpenZeppelin Subgraphs\n\n## Introduction\n\nThis repo contains subgraph schema and templates to index the activity of OpenZeppelin Contracts. For each of the supported OpenZeppelin modules `x`, this repo provides:\n\n- **Primitives to generate a graphql schema:** `src/datasource/x.gql.json`\n\n  In order to allow composability, the schema are not defined in the graphql format but rather in a dedicated json format which can be assembled and compiled to graphql using the `graph-compiler` tool from `@amxx/graphprotocol-utils`. Graphql version for each module is also available in `generated/x.schema.graphql`\n\n- **Template to generate a subgraph manifest:** `src/datasource/x.yaml`\n\n  This file lists all the events that the datasources should listen to, and links that to the corresponding indexing logic. Similarly to the schema, the manifest can be generated procedurally from a JSON app description.\n\n- **Indexing logic:** `src/datasources/x.ts` and (optionally) `src/fetch/x.ts`\n\n  This is the core logic that processes the events and to index the onchain activity.\n\n## Suported modules\n\n- AccessControl\n- ERC20\n- ERC721\n- ERC1155\n- ERC1967Upgrade\n- Governor\n- Ownable\n- Pausable\n- Timelock\n\n\u003c!--\nPaymentSplitter\nERC20Snapshot\nERC20Votes\nERC777\nEscrow\n--\u003e\n\n## Usage\n\nTo use OpenZeppelin Subgraphs, install them in your local project directory and follow the steps outlined in __How to build my app's subgraph__:\n\n```sh\nnpm install @openzeppelin/subgraphs\n```\n\n## How to build my app's subgraph\n\nIn order to build your subgraph, the first step is to create a JSON file listing the modules you want to index. Examples of such config can be found in the `config` folder.\n\nFor example, `configs/sample.json` describes an app with 4 contracts, the first one is an `ERC20` with `AccessControl`, while the 3 others are `ERC721` registries.\n\n```\n{\n  \"output\": \"generated/sample.\",\n  \"chain\": \"mainnet\",\n  \"datasources\": [\n    { \"address\": \"0xA3B26327482312f70E077aAba62336f7643e41E1\", \"startBlock\": 11633151, \"module\": [ \"erc20\", \"accesscontrol\" ] },\n    { \"address\": \"0xB1C52075b276f87b1834919167312221d50c9D16\", \"startBlock\":  9917641, \"module\": \"erc721\" },\n    { \"address\": \"0x799DAa22654128d0C64d5b79eac9283008158730\", \"startBlock\":  9917642, \"module\": \"erc721\" },\n    { \"address\": \"0xC76A18c78B7e530A165c5683CB1aB134E21938B4\", \"startBlock\":  9917639, \"module\": \"erc721\" }\n  ]\n}\n```\n\nIt can be compiled by doing\n\n```\nnpx graph-compiler \\\n  --config configs/sample.json \\\n  --include node_modules/@openzeppelin/subgraphs/src/datasources \\\n  --export-schema \\\n  --export-subgraph\n```\n\nThis will create two files: `generated/sample.schema.graphql` and `generated/sample.subgraph.yaml` that can be used to build and deploy the corresponding subgraph.\n\nNote: `startBlock` is optional but will improve your subgraph initial indexing speed.\n\n\n## Live deployments\n\n### Admin (Access Control + Ownable + ERC1967)\n\n| Network | Config                                                                 | Queries (HTTP)                                                                                                                         | Subscriptions (WS)                                                                                                                 |\n|---------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| Mainnet | [configs/live/mainnet/admin.json](configs/live/mainnet/admin.json)     | [https://api.thegraph.com/subgraphs/name/amxx/access-control](https://api.thegraph.com/subgraphs/name/amxx/access-control)             | [wss://api.thegraph.com/subgraphs/name/amxx/access-control](wss://api.thegraph.com/subgraphs/name/amxx/access-control)             |\n| BSC     | [configs/live/bsc/admin.json](configs/live/bsc/admin.json)             | [https://api.thegraph.com/subgraphs/name/amxx/access-control-bsc](https://api.thegraph.com/subgraphs/name/amxx/access-control-bsc)     | [wss://api.thegraph.com/subgraphs/name/amxx/access-control-bsc](wss://api.thegraph.com/subgraphs/name/amxx/access-control-bsc)     |\n| Matic   | [configs/live/matic/admin.json](configs/live/matic/admin.json)         | [https://api.thegraph.com/subgraphs/name/amxx/access-control-matic](https://api.thegraph.com/subgraphs/name/amxx/access-control-matic) | [wss://api.thegraph.com/subgraphs/name/amxx/access-control-matic](wss://api.thegraph.com/subgraphs/name/amxx/access-control-matic) |\n| XDai    | [configs/live/xdai/admin.json](configs/live/xdai/admin.json)           | [https://api.thegraph.com/subgraphs/name/amxx/access-control-xdai](https://api.thegraph.com/subgraphs/name/amxx/access-control-xdai)   | [wss://api.thegraph.com/subgraphs/name/amxx/access-control-xdai](wss://api.thegraph.com/subgraphs/name/amxx/access-control-xdai)   |\n\n### NFTs (ERC721 + ERC1155)\n\n| Network | Config                                                                 | Queries (HTTP)                                                                                                                         | Subscriptions (WS)                                                                                                                 |\n|---------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| Mainnet | [configs/live/mainnet/nfts.json](configs/live/mainnet/nfts.json)       | [https://api.thegraph.com/subgraphs/name/amxx/nft-mainnet](https://api.thegraph.com/subgraphs/name/amxx/nft-mainnet)                   | [wss://api.thegraph.com/subgraphs/name/amxx/nft-mainnet](wss://api.thegraph.com/subgraphs/name/amxx/nft-mainnet)                   |\n| BSC     | [configs/live/bsc/nfts.json](configs/live/bsc/nfts.json)               | [https://api.thegraph.com/subgraphs/name/amxx/nft-bsc](https://api.thegraph.com/subgraphs/name/amxx/nft-bsc)                           | [wss://api.thegraph.com/subgraphs/name/amxx/nft-bsc](wss://api.thegraph.com/subgraphs/name/amxx/nft-bsc)                           |\n| Matic   | [configs/live/matic/nfts.json](configs/live/matic/nfts.json)           | [https://api.thegraph.com/subgraphs/name/amxx/nft-matic](https://api.thegraph.com/subgraphs/name/amxx/nft-matic)                       | [wss://api.thegraph.com/subgraphs/name/amxx/nft-matic](wss://api.thegraph.com/subgraphs/name/amxx/nft-matic)                       |\n| XDai    | [configs/live/xdai/nfts.json](configs/live/xdai/nfts.json)             | [https://api.thegraph.com/subgraphs/name/amxx/nft-xdai](https://api.thegraph.com/subgraphs/name/amxx/nft-xdai)                         | [wss://api.thegraph.com/subgraphs/name/amxx/nft-xdai](wss://api.thegraph.com/subgraphs/name/amxx/nft-xdai)                         |\n\n### ERC721 only\n\n| Network | Config                                                                 | Queries (HTTP)                                                                                                                         | Subscriptions (WS)                                                                                                                 |\n|---------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| Mainnet | [configs/live/mainnet/eip721.json](configs/live/mainnet/eip721.json)   | [https://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph](https://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph)           | [wss://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph](wss://api.thegraph.com/subgraphs/name/amxx/eip721-subgraph)           |\n\n### ERC1155 only\n\n| Network | Config                                                                 | Queries (HTTP)                                                                                                                         | Subscriptions (WS)                                                                                                                 |\n|---------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| Mainnet | [configs/live/mainnet/eip1155.json](configs/live/mainnet/eip1155.json) | [https://api.thegraph.com/subgraphs/name/amxx/eip1155-subgraph](https://api.thegraph.com/subgraphs/name/amxx/eip1155-subgraph)         | [wss://api.thegraph.com/subgraphs/name/amxx/eip1155-subgraph](wss://api.thegraph.com/subgraphs/name/amxx/eip1155-subgraph)         |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-subgraphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-subgraphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenzeppelin%2Fopenzeppelin-subgraphs/lists"}