Skip to content

graphprotocol/indexing-payments-subgraph

Repository files navigation


Indexing Payments Subgraph

On-chain event indexer for the indexing agreement lifecycle in The Graph protocol.

CI License The Graph Docs


What It Does

This subgraph tracks the full lifecycle of Direct Indexing Payments (DIPs) agreements on-chain. It indexes events emitted by the SubgraphService contract through the IndexingAgreement library and exposes them via a GraphQL API that downstream services can query.

Dipper is the primary consumer -- its chain listener polls this subgraph to detect when indexers accept or cancel agreements, keeping its internal state in sync with on-chain reality without direct RPC polling.


Events

IndexingAgreementAcceptedIndexer accepts an RCA on-chain, creating an allocation
IndexingAgreementCanceledAgreement canceled by payer or indexer
IndexingAgreementUpdatedAgreement terms or allocation changed
IndexingFeesCollectedV1Fees collected against an active agreement

Architecture

graph LR
    A[SubgraphService<br>Contract] -->|emits events| B[graph-node]
    B -->|indexes| C[GraphQL API]
    C -->|polls| D[dipper<br>chain_listener]
    D -->|updates| E[(agreement<br>state)]

    style A fill:#6747ED,stroke:#5438c5,color:#fff
    style B fill:#1a1a2e,stroke:#333,color:#fff
    style C fill:#1a1a2e,stroke:#333,color:#fff
    style D fill:#2d6a4f,stroke:#1b4332,color:#fff
    style E fill:#2d6a4f,stroke:#1b4332,color:#fff
Loading

Quick Start

npm install
npm run prepare:hardhat     # generate manifest from template
npx graph codegen           # generate AssemblyScript types
npx graph build             # compile to WASM
npm test                    # matchstick unit tests (Linux only)

Deployment

Each network has a config file in config/ with the contract address and start block.

# 1. Generate manifest for target network
npm run prepare:hardhat

# 2. Create and deploy
npx graph create --node http://localhost:8020 indexing-payments
npx graph deploy --node http://localhost:8020 --ipfs http://localhost:5001 \
  --version-label v0.1.0 indexing-payments
Available networks
Network Config SubgraphService Address
Hardhat (local) config/hardhat.json 0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9
Arbitrum One config/arbitrum-one.json TBD
Arbitrum Sepolia config/arbitrum-sepolia.json TBD

License

MIT

About

Subgraph indexing events from the SubgraphService contract for DIPs lifecycle tracking

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors