← Back to all products

Vault Subgraph

$10

TheGraph subgraph for indexing vault events with a GraphQL API for historical data.

📁 13 files
TypeScriptMarkdownYAMLJSON

📁 File Structure 13 files

vault-subgraph/ ├── LICENSE ├── README.md ├── config/ │ ├── arbitrum.json │ ├── base.json │ └── mainnet.json ├── examples/ │ └── queries.graphql ├── package.json ├── schema/ │ └── schema.graphql ├── security-notes.md ├── src/ │ ├── factory.ts │ ├── helpers.ts │ └── vault.ts └── subgraph.yaml

📖 Documentation Preview README excerpt

vault-subgraph

TheGraph subgraph for indexing CryptoForge ERC-4626 vault events with a full GraphQL API.

Price: $9.99 | Store: vault-forge | Product #8


Overview

vault-subgraph is a production-ready subgraph definition for indexing all events from the CryptoForge vault system. It provides a GraphQL API for querying vault TVL, deposits, withdrawals, harvest events, fee changes, strategy allocations, user positions, and daily snapshots.

What's Indexed

EntitySourceDescription
VaultFactory + vault eventsCore vault state and aggregated metrics
DepositDeposit eventIndividual deposit records
WithdrawalWithdraw eventIndividual withdrawal records
HarvestHarvest eventStrategy yield reports
FeeEventVarious eventsFee recipient + strategy changes
StrategyFactory eventsApproved strategy registry
UserDeposit/Withdraw eventsAggregated user positions
DailySnapshotDerivedDaily vault state for time-series

Architecture


CryptoForgeVaultFactory ──────────────────────┐
  VaultCreated → creates Vault entity         │
  StrategyApproved/Revoked → Strategy entity  │
  AssetApproved/Revoked → logged              │
                                              │
  Creates dynamic data source per vault ──────┤
                                              │
CryptoForgeVault (template) ──────────────────┤
  Deposit → Deposit entity + Vault update     │
  Withdraw → Withdrawal entity + Vault update │
  Harvest → Harvest entity + Vault update     │
  FeeRecipientChanged → FeeEvent entity       │
  StrategyChanged → FeeEvent entity           │
  Paused/Unpaused → Vault.paused update       │
                                              │
  All events → DailySnapshot update ──────────┘

Installation


# Install dependencies
npm install

# Generate AssemblyScript types from schema and ABIs
npm run codegen

# Build the subgraph
npm run build

... continues with setup instructions, usage examples, and more.

📄 Code Sample .yaml preview

subgraph.yaml specVersion: 0.0.5 schema: file: ./schema/schema.graphql description: > CryptoForge Vault Subgraph — Indexes all ERC-4626 vault events from CryptoForgeVaultFactory and individual CryptoForgeVault contracts. Provides a GraphQL API for vault TVL, deposits, withdrawals, harvests, fee events, strategy changes, and daily snapshots. repository: https://github.com/cryptoforge/vault-subgraph dataSources: # ───────────────────────────────────────────────────────── # CryptoForgeVaultFactory — indexes factory-level events # ───────────────────────────────────────────────────────── - kind: ethereum name: CryptoForgeVaultFactory network: mainnet source: address: "0x0000000000000000000000000000000000000000" # Replace with deployed factory abi: CryptoForgeVaultFactory startBlock: 0 # Replace with factory deployment block mapping: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript entities: - Vault - Strategy abis: - name: CryptoForgeVaultFactory file: ./abis/CryptoForgeVaultFactory.json - name: CryptoForgeVault file: ./abis/CryptoForgeVault.json eventHandlers: - event: VaultCreated(indexed address,indexed address,address,string,string) handler: handleVaultCreated - event: StrategyApproved(indexed address) handler: handleStrategyApproved - event: StrategyRevoked(indexed address) handler: handleStrategyRevoked - event: AssetApproved(indexed address) handler: handleAssetApproved - event: AssetRevoked(indexed address) handler: handleAssetRevoked file: ./src/factory.ts templates: # ───────────────────────────────────────────────────────── # CryptoForgeVault — dynamically created for each new vault # ───────────────────────────────────────────────────────── # ... 39 more lines ...
Buy Now — $10 Back to Products