Skip to content

feat(growth): implement referral reward loop engine (#2) - #104

Open
jihadMo wants to merge 1 commit into
Nexussyn:mainfrom
jihadMo:agent/jihadMo/issue-2
Open

feat(growth): implement referral reward loop engine (#2)#104
jihadMo wants to merge 1 commit into
Nexussyn:mainfrom
jihadMo:agent/jihadMo/issue-2

Conversation

@jihadMo

@jihadMo jihadMo commented Aug 19, 2026

Copy link
Copy Markdown

Closes #2

Summary of Changes:

  • Migration: Created migrations/add_referral_system.sql with idempotent referral_codes and referral_conversions tables and process_referral stored procedure.
  • Engine Implementation: Implemented src/growth/referral.ts with ReferralEngine class providing createCode and processReferral methods, awarding 5 credits to referrers upon conversion and emitting referral_conversion system events.
  • Idempotency: Enforced duplicate prevention key ${code}:${newUserId}.
  • Tests: Added comprehensive test suite in tests/referral.test.ts covering happy path conversion, duplicate prevention, and invalid code rejection.

Wallet for Base USDC settlement:

0x3AD489c09A5C750b29155B0d0426Fc70654D59e5

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.

[AGENT-TASK] Implement referral reward loop — +20% conversion

1 participant