← Back to all products
$15
Data Indexer Template
Custom data indexer for off-chain to on-chain data pipelines with verification.
TypeScriptMarkdownYAMLJSONLLM
📁 File Structure 13 files
data-indexer-template/
├── LICENSE
├── README.md
├── config/
│ ├── networks.json
│ └── subgraph.yaml
├── examples/
│ └── queries.graphql
├── package.json
├── schema/
│ └── schema.graphql
├── security-notes.md
├── src/
│ ├── custom-feed.ts
│ ├── helpers.ts
│ ├── price-feed.ts
│ └── vrf-events.ts
└── tsconfig.json
📖 Documentation Preview README excerpt
Data Indexer Template
Production-ready subgraph template for indexing oracle and DeFi data using The Graph protocol. Pre-configured mappings for price feeds, custom data feeds, and VRF events.
Features
- Price Feed Indexing — Track Chainlink AggregatorV3 round updates
- Custom Feed Indexing — Index custom oracle data feed events
- VRF Event Indexing — Track randomness requests and fulfillments
- Helper Utilities — Decimal conversion, BigInt math, entity loading
- Multi-network — Configured for Ethereum mainnet and Sepolia
Architecture
schema/schema.graphql Entity definitions
config/subgraph.yaml Subgraph manifest
src/price-feed.ts Chainlink price feed handler
src/custom-feed.ts Custom data feed handler
src/vrf-events.ts VRF event handler
src/helpers.ts Shared utility functions
examples/queries.graphql Example GraphQL queries
config/networks.json Network deployment addresses
Quick Start
# Install dependencies
npm install
# Generate types from schema
graph codegen
# Build the subgraph
graph build
# Deploy to hosted service
graph deploy --studio oracle-indexer
Example Query
{
priceFeedUpdates(first: 10, orderBy: timestamp, orderDirection: desc) {
feed { id name }
price
timestamp
roundId
}
}
License
MIT — see [LICENSE](./LICENSE)
📄 Code Sample .yaml preview
config/subgraph.yaml
specVersion: 0.0.5
description: Oracle & Data Provider Indexer — CryptoForge Oracle Forge
repository: https://github.com/cryptoforge/oracle-data-indexer
schema:
file: ../schema/schema.graphql
dataSources:
# ── Chainlink Price Feed ────────────────────────────────────────────
- kind: ethereum
name: ChainlinkPriceFeed
network: mainnet
source:
address: "0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419" # ETH/USD
abi: AggregatorV3Interface
startBlock: 16000000
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- PriceFeed
- PriceFeedUpdate
abis:
- name: AggregatorV3Interface
file: ../abis/AggregatorV3Interface.json
eventHandlers:
- event: AnswerUpdated(indexed int256,indexed uint256,uint256)
handler: handleAnswerUpdated
file: ../src/price-feed.ts
# ── Custom Data Feed ────────────────────────────────────────────────
- kind: ethereum
name: CustomDataFeed
network: mainnet
source:
abi: CustomDataFeed
startBlock: 16000000
mapping:
kind: ethereum/events
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- CustomFeed
- CustomFeedUpdate
abis:
- name: CustomDataFeed
file: ../abis/CustomDataFeed.json
eventHandlers:
- event: ValueUpdated(indexed bytes32,int256,uint256,indexed address)
handler: handleValueUpdated
# ... 26 more lines ...