Skip to content

feat: add cross-chain redemption tracking via Wormhole VAA parsing#3

Open
mswilkison wants to merge 1 commit intomasterfrom
feat/cross-chain-redemption-tracking
Open

feat: add cross-chain redemption tracking via Wormhole VAA parsing#3
mswilkison wants to merge 1 commit intomasterfrom
feat/cross-chain-redemption-tracking

Conversation

@mswilkison
Copy link
Copy Markdown

Summary

  • Add support for tracking the origin chain of L2 redemptions via L1BTCRedeemerWormhole contract
  • Parse Wormhole VAA messages to extract source chain ID (Arbitrum, Base, Sui, Starknet, etc.)
  • Enable filtering and querying redemptions by their origin L2 chain

Changes

Schema

  • Add WormholeChain enum with supported chains (ARBITRUM, BASE, SUI, STARKNET, etc.)
  • Add sourceChainId, sourceChain, wormholeSequence fields to Redemption entity
  • Add WormholeSender entity to track allowed L2 senders
  • Add CrossChainRedemptionTracker entity for linking VAA data to redemptions

Data Source

  • Add L1BTCRedeemerWormhole contract (0x5D4d83aaB53B7E7cA915AEB2d4d3f4e03823DbDe)
  • Handle RedemptionRequested and AllowedSenderUpdated events
  • Handle requestRedemption(bytes) calls to decode Wormhole VAA

Mapping

  • Implement parseWormholeVAA() to decode VAA structure and extract emitter chain ID
  • Link cross-chain data to redemptions when events fire

Example Query

{
  redemptions(where: { sourceChain: ARBITRUM }) {
    id
    amount
    sourceChainId
    sourceChain
    wormholeSequence
  }
}

Notes

  • Fulltext search feature temporarily commented out (causes non-determinism error in some graph-node versions)
  • Call handlers require archive node access for historical data

🤖 Generated with Claude Code

Add support for tracking the origin chain of L2 redemptions that come
through the L1BTCRedeemerWormhole contract. This allows the subgraph
to identify whether a redemption originated from Arbitrum, Base, or
other supported L2 chains.

Changes:
- Add WormholeChain enum with supported chains (Arbitrum, Base, Sui, etc.)
- Add sourceChainId, sourceChain, wormholeSequence fields to Redemption
- Add WormholeSender entity to track allowed L2 senders
- Add CrossChainRedemptionTracker entity for VAA-to-redemption linking
- Add L1BTCRedeemerWormhole data source with event/call handlers
- Implement VAA parsing to extract emitter chain ID from Wormhole messages

The implementation uses a call handler on requestRedemption(bytes) to
decode the Wormhole VAA and extract the source chain, then links it
to the Redemption entity when the RedemptionRequested event fires.

Note: Fulltext search feature temporarily disabled for local testing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant