{"id":18493079,"url":"https://github.com/graphprotocol/augur-subgraph","last_synced_at":"2025-08-24T09:20:57.955Z","repository":{"id":43018718,"uuid":"159412412","full_name":"graphprotocol/augur-subgraph","owner":"graphprotocol","description":"Subgraph for the Augur protocol ","archived":false,"fork":false,"pushed_at":"2022-03-23T00:23:50.000Z","size":103,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-09T16:50:47.874Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-27T23:04:56.000Z","updated_at":"2022-04-09T20:51:44.000Z","dependencies_parsed_at":"2022-09-09T13:52:39.723Z","dependency_job_id":null,"html_url":"https://github.com/graphprotocol/augur-subgraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/graphprotocol/augur-subgraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphprotocol%2Faugur-subgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphprotocol%2Faugur-subgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphprotocol%2Faugur-subgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphprotocol%2Faugur-subgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphprotocol","download_url":"https://codeload.github.com/graphprotocol/augur-subgraph/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphprotocol%2Faugur-subgraph/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271834477,"owners_count":24830799,"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","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2024-11-06T13:12:37.510Z","updated_at":"2025-08-24T09:20:57.933Z","avatar_url":"https://github.com/graphprotocol.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Augur Subgraph\n\nThis is a subgraph for [Augur](https://github.com/AugurProject/augur).\n\n## Events and Contracts\n\nThe Augur smart contracts are set up so that all the events are emitted from a single address. The solidity file that has all the events is `Augur.sol`.\n\nWe are using the exact source code and abi from [etherscan](https://etherscan.io/address/0x75228dce4d82566d93068a8d5d49435216551599#code), as the code from the master branch on github is updated, as Augur was launched on mainnet months ago. \n\nMost events are included and tracked in the subgraph. The following events were not tracked:\n\n* `DisputeWindowCreated` - Exists in the most up to date master branch, but doesn't exist on the live version on mainnet yet. \n* `EscapeHatchChanged` - Not essential to Dapp user experience\n* `TimestampSet` - Not essential to Dapp user experience\n* `FeeWindowRedeemed` - Exists in the current live version, but has been removed from the most up to date master branch\n* `FeeWindowCreated` - Exists in the current live version, but has been removed from the most up to date master branch\n\n\n\nThis can be used for the mainnet Augur, and all testnets. In order to do\nso the `subgraph.yaml` file will need to have the contract addresses changed to point to the \ncorrect address for each respective network. It is typical to test on the Rinkeby testnet, since that is the network that has a browser Dapp accessible over the internet. All other testnets can be accessed by downloading the Augur desktop application. \n\nThe subgraph can take somewhere in the range of 3-5 hours when syncing all events, including token transfers of REP, which take a long time to process. If the token minting and transfers are commented out (recommended for quick testing), the subgraph takes about 20-30 minutes to ingest all the events when connected to Infura for mainnet. \n\n\n## Brief Description of The Graph Node Setup\n\nA Graph Node can run multiple subgraphs. The subgraph ingests event data by calling to Infura through http. It can also connect to any geth node or parity node that accepts RPC calls. Fast synced geth nodes work. To use parity, the `--no-warp` flag must be used. Setting up a local Ethereum node is more reliable and faster, but Infura is the easiest way to get started. \n\nThis subgraph has three types of files which tell the Graph Node to ingest events from specific contracts. They are:\n* The subgraph manifest (subgraph.yaml)\n* A GraphQL schema      (schema.graphql)\n* Mapping scripts       (augur.ts, disputeCrowdsourcer.ts, disputeWindow.ts, initialReport.ts, market.ts, order.ts, token.ts, universe.ts) \n\nThis repository has these files created and ready to compile, so a user can start this subgraph on their own. The only thing that needs to be edited is the contract addresses in the `subgraph.yaml` file to change between mainnet and testnets.  \n\nWe have provided a quick guide on how to start up the Augur-Subgraph graph node below. If these steps aren't descriptive enough, the [getting started guide](https://github.com/graphprotocol/graph-node/blob/master/docs/getting-started.md) has in depth details on running a subgraph. \n\n## Steps to Deploy The Augur Subgraph Locally \n  1. Install IPFS and run `ipfs init` followed by `ipfs daemon`\n  2. Install PostgreSQL and run `initdb -D .postgres` followed by `pg_ctl -D .postgres start` and `createdb graph-node-mainnet` (note this db name is used in the commands below for the mainnet examples)\n  3. If using Ubuntu, you may need to install additional packages: `sudo apt-get install -y clang libpq-dev libssl-dev pkg-config`\n  4. Clone this repository, and run the following:\n     * `yarn`\n     * `yarn codegen` \n  5. Clone https://github.com/graphprotocol/graph-node from master and `cargo build` (this might take a while)\n  6. a) Now that all the dependencies are running, you can run the following command to connect to Infura Mainnet (it may take a few minutes for Rust to compile). Password might be optional, it depends on your postrgres setup:\n\n```\n  cargo run -p graph-node --release -- \\\n  --postgres-url postgresql://USERNAME:[PASSWORD]@localhost:5432/graph-node-mainnet \\\n  --ipfs 127.0.0.1:5001 \\\n  --ethereum-rpc mainnet-infura:https://mainnet.infura.io --debug\n```\n  6. b) Or Mainnet with a Local Ethereum node. This is very common if you are working with brand new contracts, and you have deployed them to a testnet environment like *ganache* (note that ganache commonly uses port 9545 rather than 8545):\n  ```\n  cargo run -p graph-node --release -- \\\n  --postgres-url postgresql://USERNAME:[PASSWORD]@localhost:5432/graph-node-mainnet \\\n  --ipfs 127.0.0.1:5001 \\\n  --ethereum-rpc mainnet-local:http://127.0.0.1:8545 \n```\n  6. c) Or Infura Rinkeby _(NOTE: Infura testnets are not reliable right now, we get inconsistent results returned. If Rinkeby data is needed, it is suggested to run your own Rinkeby node)_\n```\n    cargo run -p graph-node --release --   \\\n    --postgres-url postgresql://USERNAME:[PASSWORD]@localhost:5432/graph-node-testnet \\\n    --ipfs 127.0.0.1:5001 \\\n    --ethereum-rpc rinkeby-infura:https://rinkeby.infura.io \n\n```\n  \n 7. Now create the subgraph locally on The Graph Node with `yarn create-local`. On The Graph Hosted service, creating the subgraph is done in the web broswer. \n\n  \n 8. Now deploy the Augur subgraph to The Graph Node with `yarn deploy --debug`. You should see a lot of blocks being skipped in the `graph-node` terminal, and then it will start ingesting events from the moment the contracts were uploaded to the network. \n\nNow that you have subgraph is running you may open a [Graphiql](https://github.com/graphql/graphiql) browser at `127.0.0.1:8000` and get started with querying.\n\n## Viewing the Subgraph on the Graph Hosted Service\nThis subgraph is not yet on [The Graph Explorer](https://thegraph.com/explorer/). To understand how deploying to the hosted service works, check out the [Deploying Instructions](https://thegraph.com/docs/deploy-a-subgraph) in the official documentation. The most important part of deploying to the hosted service is ensuring that the npm script for `deploy` is updated to the correct name that you want to deploy with. \n\n## Getting started with querying \n\nBelow are a few ways to show how to query the Augur-Subgraph for data. \n\n### Querying all possible data that is stored in the subgraph\nThe query below shows all the information that is possible to query, but is limited to the first 5 instances. There are many other filtering options that can be used, just check out the [querying api](https://github.com/graphprotocol/graph-node/blob/master/docs/graphql-api.md).\n\nThere are five high level queries - `market`, `universe`, `order`, `tokens`, `users`. There are entities nested within these queries as well. \n\n```\n{\n  markets(first: 100) {\n    id\n    topic\n    description\n    extraInfo\n    universe\n    marketCreator\n    outcomes\n    marketCreationFee\n    minPrice\n    maxPrice\n    marketType\n    reportingParticipantDisavowed\n    marketParticipantsDisavowed\n    finalized\n    migrated\n    numCompleteSetsPurchase\n    numCompleteSetsSold\n    marketOwners\n    marketMailboxOwners\n    completeSetPurchasers\n    completeSetSellers\n    tradingProceedsClaimed {\n      id\n      universe\n      shareToken\n      sender\n      numShares\n      numPayoutTokens\n      finalTokenBalance\n    }\n    initialReports {\n      id\n      universe\n      amountStaked\n      isDesignatedReporter\n      payoutNumerators\n      invalid\n      reporter\n      amountRedeemed\n      repReceived\n      reportingFeesReceived\n    }\n    disputeCrowdsourcer {\n      id\n      universe\n      disputeCrowdsourcer\n      payoutNumerators\n      size\n      invalid\n      reporters\n      amountStaked\n      dcc\n      completed\n      amountRedeemed\n      repReceived\n      reportingFeesReceived\n      payoutNumerators2\n    }\n  }\n  universes {\n    id\n    parentUniverse\n    payoutNumerators\n    forked\n    invalid\n  }\n  orders {\n    id\n    orderType\n    amount\n    price\n    creator\n    moneyEscrowed\n    sharesEscrowed\n    tradeGroupIDCreator\n    universe\n    shareToken\n    canceller\n    tokenRefund\n    sharesRefund\n    filler\n    numCreatorShares\n    numCreatorTokens\n    numFillerShares\n    numFillerTokens\n    marketCreatorFees\n    reporterFees\n    amountFilled\n    tradeGroupIDFilled\n  }\n  tokens(first: 10) {\n    id\n    universe\n    market\n    tokenType\n    owners {\n      id\n      tokenAddress\n      amount\n    }\n  }\n  users(first: 10) {\n    id\n    marketsCreated\n    claimedTrades {\n      id\n      universe\n      shareToken\n      sender\n      numShares\n      numPayoutTokens\n      finalTokenBalance\n    }\n    initialReports {\n      id\n      universe\n      amountStaked\n      isDesignatedReporter\n      payoutNumerators\n      invalid\n      reporter\n      amountRedeemed\n      repReceived\n      reportingFeesReceived\n    }\n    disputeCrowdsourcers\n    ordersCreated\n    ordersCancelled\n    ordersFilled\n    tokensOwned {\n      id\n      tokenAddress\n      amount\n    }\n  }\n}\n\n```\nThe command above can be copy pasted into the Graphiql interface in your browser at `127.0.0.1:8000`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphprotocol%2Faugur-subgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphprotocol%2Faugur-subgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphprotocol%2Faugur-subgraph/lists"}