[#370] Backfill user_address on existing trade_history rows#372
Merged
realproject7 merged 1 commit intomainfrom Mar 19, 2026
Merged
[#370] Backfill user_address on existing trade_history rows#372realproject7 merged 1 commit intomainfrom
realproject7 merged 1 commit intomainfrom
Conversation
POST /api/backfill-user-address fetches trade_history rows with NULL user_address, reads tx receipts from chain, decodes Mint/Burn events to extract the user address, and updates the rows. Protected by CRON_SECRET auth. Groups by tx_hash to minimize RPC calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
approved these changes
Mar 19, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Auth pattern matches existing cron endpoints. tx_hash grouping minimizes RPC calls. Event decoding correctly targets mcv2BondEventAbi (Mint/Burn) which both expose the user field. 500-row batching is sensible for a one-off backfill — just re-run until 0 remaining. Error reporting is thorough.
project7-interns
approved these changes
Mar 19, 2026
Collaborator
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR matches issue #370 with a focused one-off backfill endpoint that populates trade_history.user_address from on-chain Mint/Burn receipts. The auth model and server-side Supabase usage match the existing cron/backfill routes.
Findings
- [info]
lint-and-typecheckwas still pending at review time.- File:
src/app/api/backfill-user-address/route.ts:1 - Suggestion: Wait for required checks before merging.
- File:
Decision
Approve. The change is scoped correctly to the backfill requirement and follows established patterns in the repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/backfill-user-addressendpoint that reads trade_history rows with NULLuser_address, fetches tx receipts from chain, decodes Mint/Burn events to extract the user address, and updates the rowsCRON_SECRETauth (same pattern as existing cron endpoints)tx_hashto minimize RPC callsFixes #370
Usage
curl -X POST https://plotlink.xyz/api/backfill-user-address \ -H "Authorization: Bearer $CRON_SECRET"Test plan
🤖 Generated with Claude Code