Skip to content

refactor: standardize event emission payloads for indexer reliability - #87

Merged
Robotron2 merged 4 commits into
Padi-Pay:mainfrom
dumbdev:refactor/event-schema
Jul 24, 2026
Merged

refactor: standardize event emission payloads for indexer reliability#87
Robotron2 merged 4 commits into
Padi-Pay:mainfrom
dumbdev:refactor/event-schema

Conversation

@dumbdev

@dumbdev dumbdev commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

closes #70

This pull request addresses this issue by auditing and standardizing the contract's event emission schemas in src/events.rs. Off-chain indexers and data feeds require consistent topic structures and predictable payload shapes. Previously, the contract published loose tuple fragments or varying types as the payload value for events (e.g. only the transfer amount).

To ensure indexer reliability, every event (EscrowCreated, FundsLocked, FundsReleased, and EscrowRefunded) has been refactored to conform to a highly uniform structure. The primary identifier, EscrowId, is now consistently placed as the first data topic immediately following the event name symbol. Additionally, the event payloads have been standardized to pass the fully detailed EscrowState struct as a structured payload instead of raw values, guaranteeing a deterministic schema that is easy for indexers to parse.

To maintain correctness, we also updated the test assertions throughout tests/test.rs to construct and verify these new event signatures. The refactoring was performed and committed step-by-step to isolate changes to each event emitter and test update.

Key Changes
src/events.rs: Modified all event publishing functions to consistently use (Symbol, EscrowId) as the topics tuple and the EscrowState struct as the value.
tests/test.rs: Updated all event assertion expectations to verify matching (Symbol, EscrowId) topics and structured EscrowState payloads

@dumbdev
dumbdev force-pushed the refactor/event-schema branch from abf9555 to 955df94 Compare July 24, 2026 06:50
@dumbdev
dumbdev force-pushed the refactor/event-schema branch from 955df94 to d871c3e Compare July 24, 2026 07:33
@Robotron2
Robotron2 merged commit d17ded0 into Padi-Pay:main Jul 24, 2026
1 check passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jul 24, 2026
4 tasks
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.

Event Schema Hardening

2 participants