Skip to content

feat: add FileAddedV2 event handler to capture schema IDs#5

Closed
tnunamak wants to merge 1 commit intomainfrom
feat/file-added-v2
Closed

feat: add FileAddedV2 event handler to capture schema IDs#5
tnunamak wants to merge 1 commit intomainfrom
feat/file-added-v2

Conversation

@tnunamak
Copy link
Member

@tnunamak tnunamak commented Aug 18, 2025

Summary

This PR fixes a critical indexing gap where files with schema IDs were not being indexed properly by the subgraph. The contract was upgraded to emit FileAddedV2 events (which include schemaId), but the subgraph was never updated to listen for these events.

Problem

  • The blockchain explorer shows schema IDs for files
  • The subgraph shows schemaId: 0 for all files
  • This inconsistency was causing issues for DLPs like UNWRAPPED that rely on schema associations

Solution

  • Added FileAddedV2 event definition to the DataRegistryImplementationV3 ABI
  • Created handleFileAddedV2V3 handler to properly capture the schemaId parameter
  • Updated all three subgraph manifests (moksha, vana, vana-moksha) to listen for FileAddedV2 events
  • The handler maintains backward compatibility with existing FileAdded events

Technical Details

  • FileAddedV2 events started at block 4020468 on Moksha network
  • Old files (before this block) continue to have schemaId: 0
  • New files (after this block) will have their proper schemaId values indexed
  • The change is non-breaking and maintains backward compatibility

Test Plan

  • Code generation successful (npm run codegen)
  • Subgraph builds successfully (npm run build)
  • Deploy to test environment and verify schema IDs are captured
  • Query for files with non-zero schema IDs after deployment
  • Verify UNWRAPPED DLP files show correct schema associations

Related Discussion

See Linear thread PRO-493 for context on the FileAddedV2 event addition.

🤖 Generated with Claude Code

This fixes the critical indexing gap where files with schema IDs were not being indexed properly.

Changes:
- Added FileAddedV2 event to DataRegistryImplementationV3 ABI
- Created handleFileAddedV2V3 handler to capture schemaId parameter
- Updated all subgraph manifests to listen for FileAddedV2 events
- FileAddedV2 events start at block 4020468 on Moksha network

This resolves the inconsistency between the blockchain explorer (which shows schema IDs)
and the subgraph (which was showing schemaId: 0 for all files).

Fixes: Files added with schema IDs after the contract upgrade are now properly indexed.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dumedco dumedco closed this Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments