Skip to content

Add ERC20CommerceEscrowWrapper event indexing to payments-subgraphΒ #111

@MantisClone

Description

@MantisClone

Problem

Commerce payments use HTTP polling (contract.on()) to detect blockchain events. Events during API downtime (deployments, crashes, restarts) are permanently lost, causing webhook delivery failures and database inconsistencies.

Proposed Solution

Add ERC20CommerceEscrowWrapper contract indexing to the existing payments-subgraph repository (Base and Base Sepolia networks).

Schema: New CommercePayment entity with events (PaymentAuthorized, PaymentCaptured, PaymentVoided, PaymentRefunded). Separate from existing Escrow entity due to different state model.

Handler Pattern: Follow existing erc20EscrowToPay.ts pattern - handlers for each event type updating CommercePayment entity and creating CommercePaymentEvent records.

Deployment: Add datasource to subgraph.base.yaml and subgraph.sepolia.yaml with contract addresses from request-api environment config.

Considerations

  • Contract deployment blocks needed for Base and Base Sepolia
  • Schema design: separate CommercePayment entity vs extending existing Escrow entity
  • Deployment coordination: payments-subgraph must be deployed before request-api can integrate

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

πŸ”– Sprint Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions