Skip to content

feat(indexer): persist swap fee amount from event payload - #676

Merged
Mimah97 merged 1 commit into
Vatix-Protocol:mainfrom
Xaxxoo:feature/564-swap-fee-persistence
Jul 27, 2026
Merged

feat(indexer): persist swap fee amount from event payload#676
Mimah97 merged 1 commit into
Vatix-Protocol:mainfrom
Xaxxoo:feature/564-swap-fee-persistence

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add optional feeAmount field to SwapProcessedJobData so upstream events can carry the fee directly
  • Extract fee resolution into resolveFeeAmount(): uses event-level fee when present, falls back to deriving from pool's feeTier
  • Both valid and invalid-sqrtPrice code paths now persist feeAmount on indexed swaps
  • Fix missing Prisma relation fields on Pool model for TvlAlertThreshold and TvlSnapshot

Test plan

  • New test: event-level feeAmount is persisted when provided
  • New test: feeAmount derived from pool feeTier when event omits it
  • New test: feeAmount defaults to "0" when pool not found and no event fee
  • New test: feeAmount persisted even when sqrtPriceX96 is invalid
  • All 47 existing IndexerWorker tests continue to pass

Closes #564

🤖 Generated with Claude Code

…ocol#564)

Add optional feeAmount field to SwapProcessedJobData so the upstream
event can carry the fee directly. When present, the event value is
used; otherwise the fee is derived from the pool's feeTier as before.
Both the valid and invalid-sqrtPrice code paths now persist feeAmount.

Also fix missing relation fields on Pool model for TvlAlertThreshold
and TvlSnapshot.

Closes Vatix-Protocol#564

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Mimah97
Mimah97 merged commit 425eba0 into Vatix-Protocol:main Jul 27, 2026
0 of 5 checks passed
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.

Swap fee amount persisted on indexed swaps

2 participants