Skip to content

[SO-279] Engagement Tracking, Airdrop Points & Leaderboard MVP (Twitter Mentions + Discord Bot) - #281

Open
ewitulsk wants to merge 2 commits into
stagingfrom
claude/engagement-airdrop-leaderboard-mvp-usfv1y
Open

[SO-279] Engagement Tracking, Airdrop Points & Leaderboard MVP (Twitter Mentions + Discord Bot)#281
ewitulsk wants to merge 2 commits into
stagingfrom
claude/engagement-airdrop-leaderboard-mvp-usfv1y

Conversation

@ewitulsk

Copy link
Copy Markdown
Owner

SO-279

Engagement→airdrop pipeline MVP — fleshed-out plan in docs/engagement-airdrop-plan.md.

  • twitter-service: two new signed read endpoints reusing the existing OAuth 1.0a signer — GET /mentions?account=…[&since_id=…] (recent search: original tweets mentioning @account, with public_metrics + author expansion) and GET /tweets/metrics?account=…&ids=… (refresh counters for up to 100 known tweets). Existing POST /tweets path untouched.
  • engagement-service (new, internal :9017): poll loop (5 min) ingests new mentions since the stored cursor and refreshes the stalest counters among tweets younger than 7 days; persists per-tweet like/retweet/reply/quote counters in Postgres (diesel + embedded migrations, engagement_<env> DB). Points are derived at read time from [points] config weights (engagement_points = likes*1 + replies*2 + retweets*3 + quotes*4, airdrop_points = engagement*10 * 1.5x for ambassadors), so tuning weights/the ambassador roster is a config deploy with no backfill. Serves GET /leaderboard?limit=N and GET /points/{handle}.
  • airdrop-bot (new, public :9018 via nginx /staging/airdrop-bot/): Discord slash-command bot — deliberately a separate Discord application + deployment from social-bot — with read-only /leaderboard [count] and /points <handle> commands (Ed25519-verified webhooks, defer + follow-up, no allow list needed).
  • Deployment wiring (staging-only, like twitter-service/social-bot): Dockerfiles, bake.hcl targets, affected.py, deploy.sh, render-secrets.sh (options/staging/airdrop-bot), docker-compose.staging.yml, nginx route, terraform secret placeholder.

Notes

  • Design decision: airdrop conversion is a pure module (engagement-service/src/points.rs) rather than a fourth service — it has no state of its own yet; split it out when the airdrop program grows claims/epochs/on-chain distribution (rationale in the design doc).
  • Verified end-to-end locally: throwaway Postgres + mock twitter-service → poll ingests mentions, cursor prevents re-ingest, refresh updates counters, leaderboard ranks with ambassador multiplier, /points is case-insensitive (404 when untracked); airdrop-bot answers a signed Discord PING, rejects unsigned requests (401), and defers + follows up on a signed /leaderboard command. Unit tests cover points math, ranking/ties, OAuth signature vector, Discord signature verify, and message formatting.
  • One-time ops before first deploy: provision engagement_staging DB + role, terraform apply for the new secret, fill the new Discord app's public key, register slash commands (see services/airdrop-bot/README.md).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CacZTy2eX51YUrMNcnpKm7


Generated by Claude Code

Engagement→airdrop pipeline (design doc: docs/engagement-airdrop-plan.md):

- twitter-service: signed read endpoints GET /mentions (recent search for
  tweets mentioning an account) and GET /tweets/metrics (refresh counters
  for up to 100 tweets), sharing the existing OAuth 1.0a signer.
- engagement-service (new, internal :9017): polls twitter-service for
  mentions, persists per-tweet like/retweet/reply/quote counters in
  Postgres (diesel + embedded migrations), derives engagement/airdrop
  points from config weights (ambassador multiplier), serves
  GET /leaderboard and GET /points/{handle}.
- airdrop-bot (new, public :9018): Discord slash-command bot — a separate
  Discord application + deployment from social-bot — with read-only
  /leaderboard and /points commands served from engagement-service.
- Deployment wiring (staging-only, like twitter-service/social-bot):
  Dockerfiles, bake.hcl targets, affected.py, deploy.sh, render-secrets.sh
  (options/<env>/airdrop-bot), compose entries, nginx route, terraform
  secret placeholder.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CacZTy2eX51YUrMNcnpKm7
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
sui-options Ready Ready Preview, Comment Jul 15, 2026 7:25am

Request Review

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CacZTy2eX51YUrMNcnpKm7
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.

2 participants