Skip to content

[T2.2] v1 code cleanup (points, award, cron, checkin) #1237

Description

@realproject7

Epic: #1229 · Spec: §6.2 · Type: CODE · Estimate: 0.5 day · Depends on: T2.1

Scope

Critical correctness fix: v5 finalize SQL assumes pl_points.action='buy'.points = raw PLOT spent. If streak boost stays in cron writes, distribution is wrong.

(a) lib/airdrop/points.ts

  • Strip streak boost from computeBuyPoints(plotSpent, _streak). Return raw plotSpent only. _streak param can stay (no-op) for API compat.
  • DELETE computeReferralPoints — v5 handles referrals via multiplier at finalize time.

(b) lib/airdrop/award.ts

  • awardWritePoints → no-op (return early, no DB write).
  • awardRatePoints → no-op.
  • Keep function signatures for caller compatibility.

(c) src/app/api/cron/airdrop-points/route.ts

  • Remove the if (referrer) { inserts.push({ action: "referral", ... }) } block.
  • Remove streak fetch (no longer needed since computeBuyPoints ignores streak).

(d) src/app/api/airdrop/checkin/route.ts

  • Replace handler body with return new Response(null, { status: 410 }) (410 Gone).
  • OR delete the route file entirely (cleaner). Decide at PR time.

Acceptance

  • computeBuyPoints(100, 5) === 100 (no streak multiplication)
  • computeReferralPoints deleted
  • awardWritePoints + awardRatePoints return early, no DB writes
  • Cron writes only action='buy' rows (no action='referral' from same code path)
  • /api/airdrop/checkin returns 410 OR route deleted
  • No regressions in existing storyline-buy flow

Dependencies

T2.1 (config provides empty STREAK_BOOSTS)

Metadata

Metadata

Assignees

No one assigned

    Labels

    airdropPLOT 10x Airdrop Campaign

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions