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
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:
block_timestampis within campaign window (CAMPAIGN_STARTtoCAMPAIGN_END)action = 'write'pl_streaksmetadata->>'storyline_id'— one-time per storylinestorylinestable)Modify:
src/app/api/cron/backfill/route.tsand/orsrc/app/api/index/storyline/route.tsRate Points (5 PL per rating)
After a successful rating insert:
action = 'rate'entries for this address (max 10 per day)action = 'rate', apply streak boostmetadata->>'storyline_id'+ address (one rating per story per user — already enforced by rating API)Modify:
src/app/api/ratings/route.tsFiles
src/app/api/cron/backfill/route.ts(add write point hook)src/app/api/index/storyline/route.ts(add write point hook)src/app/api/ratings/route.ts(add rate point hook)lib/airdrop/config.ts,lib/airdrop/points.ts,lib/airdrop/streak.tsAcceptance Criteria
CAMPAIGN_END