Skip to content

Fix Zap trades recording wrong user address#617

Merged
realproject7 merged 1 commit intomainfrom
task/613-fix-zap-trade-user
Mar 27, 2026
Merged

Fix Zap trades recording wrong user address#617
realproject7 merged 1 commit intomainfrom
task/613-fix-zap-trade-user

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Summary

Fixes #613

  • Trade indexer (/api/index/trade): Use args.receiver instead of args.user for user_address. Filter out intermediate Zap self-mints where receiver is the Zap contract.
  • Trade cron (/api/cron/trade-history): Same fix — args.receiver and Zap self-mint filter in processTradeEvent().
  • Backfill (/api/backfill-user-address): Now also picks up rows where user_address = ZAP_PLOTLINK (not just NULL). Re-decodes tx receipts to extract correct receiver. Deletes intermediate Zap self-mint entries.
  • Direct (non-Zap) trades unaffected — receiver equals the actual trader for direct MCV2_Bond interactions.

Test plan

  • New Zap trades record the actual trader's address, not the Zap contract
  • Intermediate HUNT→PLOT mints (receiver = Zap) are filtered out
  • Direct trades still record correctly
  • Backfill endpoint fixes existing Zap-attributed rows
  • Build passes

🤖 Generated with Claude Code

Change user attribution from args.user to args.receiver in all three
trade indexing routes. Filter out intermediate Zap self-mints where
receiver is the Zap contract (HUNT→PLOT conversion step).

Backfill route updated to also fix existing rows where user_address
equals the Zap contract — re-decodes tx receipts to extract correct
receiver, deletes intermediate Zap self-mint entries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Mar 27, 2026 9:23pm

Request Review

Copy link
Copy Markdown
Collaborator

@project7-interns project7-interns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Summary

The PR fixes the Zap-trade attribution bug by switching the trade-history user field from args.user to args.receiver in the live indexers and in the backfill path, while also removing intermediate Zap self-mint rows instead of preserving them as user trades.

Findings

  • None.

Decision

Approved because the change matches issue #613, is scoped to the three affected trade routes, and preserves direct-trade behavior while correcting both new and historical Zap-attributed rows.

@realproject7 realproject7 merged commit 53279d6 into main Mar 27, 2026
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.

Fix trade history recording Zap contract as trader + backfill existing records

2 participants