Skip to content

[#890] Add daily price snapshot cron#909

Merged
realproject7 merged 2 commits intomainfrom
task/890-price-cron
Apr 21, 2026
Merged

[#890] Add daily price snapshot cron#909
realproject7 merged 2 commits intomainfrom
task/890-price-cron

Conversation

@realproject7
Copy link
Copy Markdown
Owner

Fixes #890

Summary

  • POST /api/cron/airdrop-price: daily cron that records PLOT USD price, circulating supply, and mcap into pl_daily_prices
  • Uses existing getPlotUsdPrice() for price and on-chain totalSupply via viem for supply
  • Idempotent: checks for existing entry before insert (one per day)
  • Skips snapshot if price or supply fetch fails (no zero/stale values) — logs failure
  • Auth via CRON_SECRET Bearer token (matches existing cron pattern)
  • Registered in vercel.json at 0 0 * * * (midnight UTC)

Test plan

  • Verify cron rejects unauthorized requests (401)
  • Verify idempotency — second call same day returns skipped
  • Verify price null → skip with log, no DB insert
  • Verify supply fetch failure → skip with log, no DB insert
  • Verify successful insert with correct price, supply, mcap values
  • Verify vercel.json cron schedule is correct

🤖 Generated with Claude Code

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

vercel Bot commented Apr 21, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plotlink Ignored Ignored Apr 21, 2026 6:03am

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: REQUEST CHANGES

Summary

The snapshot logic is mostly aligned with issue #890, but the Vercel cron registration will not actually invoke this route as implemented.

Findings

  • [high] The route only exports POST, but vercel.json cron jobs call the configured path with GET. That means the scheduled job at /api/cron/airdrop-price will hit a method mismatch instead of recording a daily snapshot.
    • File: src/app/api/cron/airdrop-price/route.ts:22
    • Suggestion: Either expose GET for the cron handler to match the existing Vercel cron behavior in this repo, or add a shared handler used by both GET and POST if manual POST triggering is still desired.

Decision

Requesting changes because the daily snapshot cron will not run successfully in production with the current method/export setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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 follow-up update resolves the cron invocation issue from my prior review. The scheduled route now exports GET, which matches the Vercel cron registration in vercel.json.

Findings

  • No remaining code-level blockers in the changed files.

Decision

Approving because the daily price snapshot cron I reviewed now matches issue #890 and the registered Vercel cron behavior.

@realproject7 realproject7 merged commit 38d9ede into main Apr 21, 2026
2 of 4 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.

[Airdrop P4] Daily price snapshot cron

2 participants