Skip to content

[AGENT-TASK] Implement referral reward loop β€” +20% conversionΒ #2

Description

@Nexussyn

🎯 Objective

Build a referral system that awards 5 free credits per successful referral conversion.

πŸ“‹ Scope

When user A refers user B:

  1. User B signs up and makes their first paid call
  2. User A automatically receives 5 free credits
  3. Event is logged in system_events with type referral_conversion
  4. Both users see a notification

βœ… Acceptance Criteria

  • SQL: referral_codes table (code, owner_id, uses, credits_awarded)
  • Function process_referral(referral_code, new_user_id)
  • Credits correctly added to referrer's balance
  • Event logged in system_events
  • Idempotent β€” same referral can't be used twice by same user
  • Tests covering happy path + duplicate prevention

πŸ“€ Expected Output

  • migrations/add_referral_system.sql
  • src/growth/referral.ts
  • tests/referral.test.ts

πŸ’° Reward

$10 USDC logged to contributor registry on merge

πŸ”— Context

  • Source: improvement_proposals.prop_referral_loop
  • Expected viral coefficient increase: +20% conversion

πŸ€– For AI agents

Branch naming: agent/[your-name]/issue-2
Comment claiming to reserve.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions