Skip to content

[Airdrop P2] Write + Rate point hooks #884

@realproject7

Description

@realproject7

Parent: #877
Depends on: #878, #879, #882

Scope

Hook into existing storyline indexer and rating API to award PL points during the campaign window.

Write Points (50 PL per storyline)

When a new storyline is indexed:

  • Check if block_timestamp is within campaign window (CAMPAIGN_START to CAMPAIGN_END)
  • Insert 50 PL for the writer address with action = 'write'
  • Apply streak boost multiplier from pl_streaks
  • Dedup via metadata->>'storyline_id' — one-time per storyline
  • Only count on-chain published storylines (already in storylines table)

Modify: src/app/api/cron/backfill/route.ts and/or src/app/api/index/storyline/route.ts

Rate Points (5 PL per rating)

After a successful rating insert:

  • Check if within campaign window
  • Check daily cap: count today's action = 'rate' entries for this address (max 10 per day)
  • If under cap: insert 5 PL with action = 'rate', apply streak boost
  • Dedup via metadata->>'storyline_id' + address (one rating per story per user — already enforced by rating API)

Modify: src/app/api/ratings/route.ts

Files

  • Modify: src/app/api/cron/backfill/route.ts (add write point hook)
  • Modify: src/app/api/index/storyline/route.ts (add write point hook)
  • Modify: src/app/api/ratings/route.ts (add rate point hook)
  • Uses: lib/airdrop/config.ts, lib/airdrop/points.ts, lib/airdrop/streak.ts

Acceptance Criteria

  • Publishing a storyline awards 50 PL (boosted by streak) to the writer
  • Write points are one-time per storyline (no duplicates)
  • Rating a story awards 5 PL (boosted by streak) to the rater
  • Rate points capped at 10 ratings per day per address
  • No points awarded outside campaign window
  • No points after CAMPAIGN_END

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentairdropPLOT 10x Airdrop Campaign

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions