Skip to content

Instantly share code, notes, and snippets.

@Aboudjem
Last active March 30, 2026 08:07
Show Gist options
  • Select an option

  • Save Aboudjem/586ca376db1d9064862f1b61607ed1e4 to your computer and use it in GitHub Desktop.

Select an option

Save Aboudjem/586ca376db1d9064862f1b61607ed1e4 to your computer and use it in GitHub Desktop.
Integra PRD: 25-referrals (HTML)
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>PRD: Referrals & Points</title><style>*{margin:0;padding:0;box-sizing:border-box}body{background:#0A0A1A;color:#E8E8F0;font-family:'Inter',system-ui,sans-serif;line-height:1.7}a{color:#00CEC9;text-decoration:none}a:hover{text-decoration:underline}.hero{padding:48px 32px 36px;border-bottom:1px solid #2A2A4A;background:linear-gradient(135deg,#0A0A1A 0%,#1A1040 50%,#0A0A1A 100%)}.hero h1{font-size:2rem;font-weight:800;color:#fff;margin-bottom:8px}.hero .meta{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:12px}.badge{display:inline-block;padding:4px 12px;border-radius:6px;font-size:12px;font-weight:700}.badge-owner{background:rgba(108,92,231,0.15);color:#A29BFE;border:1px solid rgba(108,92,231,0.3)}.badge-week{background:rgba(0,206,201,0.15);color:#00CEC9;border:1px solid rgba(0,206,201,0.3)}.badge-est{background:rgba(0,184,148,0.15);color:#00B894;border:1px solid rgba(0,184,148,0.3)}.container{max-width:900px;margin:0 auto;padding:32px 24px}.section{background:#12122A;border:1px solid #2A2A4A;border-radius:12px;padding:24px;margin-bottom:20px}.section h2{font-size:0.8rem;font-weight:700;color:#8888AA;text-transform:uppercase;letter-spacing:1.5px;margin-bottom:14px;padding-bottom:8px;border-bottom:1px solid #2A2A4A}.section h3{font-size:0.95rem;font-weight:600;color:#E8E8F0;margin:12px 0 6px}.section p{font-size:0.95rem;margin-bottom:8px}.section ul{list-style:none;padding:0}.section ul li{padding:6px 0 6px 20px;position:relative;font-size:0.95rem}.section ul li::before{content:'>';position:absolute;left:0;color:#A29BFE;font-weight:700;font-family:monospace}.section code{background:rgba(108,92,231,0.1);padding:2px 6px;border-radius:4px;font-size:0.88rem;color:#A29BFE}table{width:100%;border-collapse:collapse;font-size:0.9rem;margin:8px 0}th{text-align:left;padding:8px 12px;background:rgba(108,92,231,0.08);color:#A29BFE;font-size:0.75rem;text-transform:uppercase;letter-spacing:1px;border-bottom:1px solid #2A2A4A}td{padding:8px 12px;border-bottom:1px solid rgba(42,42,74,0.5)}.checklist li::before{content:'\2610' !important;color:#8888AA !important;font-family:inherit !important}.back{display:inline-block;margin-bottom:16px;color:#8888AA;font-size:0.9rem}.footer{text-align:center;padding:24px;color:#555577;font-size:0.82rem;border-top:1px solid #2A2A4A;margin-top:32px}</style></head><body><div class="hero"><a class="back" href="https://gist.githack.com/Aboudjem/0af8c2ce9d5b62038a18eeff09603553/raw/integra-testnet-master-plan.html">&larr; Back to Master Plan</a><h1>Referrals & Points</h1><div class="meta"><span class="badge badge-owner">Kalki</span><span class="badge badge-week">Week 3</span><span class="badge badge-est">0.5 day</span></div><p style="color:#8888AA;font-size:0.9rem">referrals.integralayer.com</p></div><div class="container"><div class="section"><h2>Overview</h2><div class=""><p>On-chain referral system where users generate unique invite links, share them across social channels, and earn 10% of their referee's XP permanently. Referral relationships are recorded on-chain for full transparency and auditability. A competitive leaderboard ranks top inviters, turning power users into ecosystem evangelists. This is the primary viral growth loop for testnet adoption.</p></div></div>
<div class="section"><h2>Features</h2><div class=""><ul><li><strong>Unique Invite Links</strong> — Each wallet gets a short-code referral link tied to their address, usable across all ecosystem dApps</li></ul><ul><li><strong>On-Chain Attribution</strong> — Referee-to-referrer mapping stored in contract state, immutable and publicly verifiable</li></ul><ul><li><strong>10% Passive XP Share</strong> — Referrer earns 10% of all XP their referee accumulates across every ecosystem dApp, forever</li></ul><ul><li><strong>Signup Bonus</strong> — Both referrer (+50 XP) and referee (+100 XP) receive a one-time bonus on successful registration</li></ul><ul><li><strong>Social Share Buttons</strong> — One-click sharing to Twitter and Telegram with pre-filled templates mentioning @IntegraLayer</li></ul><ul><li><strong>Referral Leaderboard</strong> — Public ranking of top inviters by invite count and total XP earned from referrals</li></ul><ul><li><strong>Referral Dashboard</strong> — Personal stats page showing invite count, XP earned from referrals, and referral tree</li></ul><ul><li><strong>Anti-Abuse Guards</strong> — No self-referral, one referrer per address, sybil-resistant claim gating</li></ul><ul><li><strong>Milestone Badges</strong> — Achievement badges at 10, 50, and 100 successful referrals</li></ul><ul><li><strong>Ecosystem-Wide Onboarding</strong> — Referral link works as the entry point to any dApp in the ecosystem, not just the referral page</li></ul><ul><li><strong>Share Templates</strong> — Pre-written copy for Twitter ("I'm exploring the @IntegraLayer testnet and earning XP. Join me and we both get bonus points: [link]") and Telegram</li></ul></div></div>
<div class="section"><h2>Functions</h2><div class=""><ul><li><code>generateLink(referrer)</code> — Creates a unique short-code referral link for the caller's address</li></ul><ul><li><code>registerReferral(referee, referrer)</code> — Records the referral relationship on-chain (called once on referee signup)</li></ul><ul><li><code>claimBonus(referee)</code> — Referee claims signup bonus, which also triggers the referrer's bonus</li></ul><ul><li><code>getReferrer(referee)</code> — Returns the referrer address for a given referee</li></ul><ul><li><code>getReferralCount(referrer)</code> — Returns total successful referral count for an address</li></ul><ul><li><code>getLeaderboard()</code> — Returns top referrers ranked by invite count or XP earned</li></ul><ul><li><code>getReferralXP(referrer)</code> — Returns total passive XP accumulated from all referees</li></ul></div></div>
<div class="section"><h2>User Flow</h2><div class=""><ul><li>User connects via Web3Auth</li></ul><ul><li>User sees their referral dashboard with unique link, invite count, and XP earned</li></ul><ul><li>User copies their link or clicks one-click share (Twitter/Telegram)</li></ul><ul><li>Friend clicks the link and lands on the ecosystem signup page</li></ul><ul><li>Friend signs up and is attributed to the referrer on-chain</li></ul><ul><li>Both parties receive their one-time XP bonus</li></ul><ul><li>Referrer passively earns 10% of referee's ongoing XP from all ecosystem activity</li></ul><ul><li>User checks the leaderboard to see their ranking among top inviters</li></ul></div></div>
<div class="section"><h2>Deliverables</h2><div class="checklist"><ul class="checklist"><li>Referrals smart contract with on-chain referee-referrer mapping</li></ul><ul class="checklist"><li>Referral link generation and resolution service</li></ul><ul class="checklist"><li>Referral dashboard page (stats, referral tree, XP breakdown)</li></ul><ul class="checklist"><li>Leaderboard page (ranked by invite count and XP earned)</li></ul><ul class="checklist"><li>Social share buttons with pre-filled Twitter and Telegram templates</li></ul><ul class="checklist"><li>Anti-abuse validation (no self-referral, one referrer per address)</li></ul><ul class="checklist"><li>XP multiplier integration (10% passive share across all ecosystem dApps)</li></ul><ul class="checklist"><li>Milestone badge system (10/50/100 referrals)</li></ul></div></div>
<div class="section"><h2>Integration Points</h2><div class=""><ul><li><strong>Depends on:</strong> Web3Auth (@integra/web3auth-provider), XP system (all ecosystem dApps report XP)</li></ul><ul><li><strong>Used by:</strong> All ecosystem dApps (referral link is the universal onboarding entry point)</li></ul><ul><li><strong>Explorer:</strong> Integra Explorer (referral registrations visible as on-chain txs)</li></ul></div></div>
<div class="section"><h2>XP Rewards</h2><div class=""><table><thead><tr><th>Action</th><th>Points</th></tr></thead><tbody><tr><td>Referee signup bonus (one-time, for new user)</td><td>+100 XP</td></tr><tr><td>Referrer bonus per successful invite</td><td>+50 XP</td></tr><tr><td>Ongoing passive share of referee's XP</td><td>+10%</td></tr><tr><td>Reach 10 successful referrals (milestone)</td><td>+500 XP</td></tr></tbody></table></div></div>
<div class="section"><h2>Success Metrics</h2><div class=""><table><thead><tr><th>Metric</th><th>Target</th></tr></thead><tbody><tr><td>Unique referral links generated</td><td>5,000+</td></tr><tr><td>Successful referral signups</td><td>1,000+</td></tr><tr><td>Referral conversion rate (click to signup)</td><td>>15%</td></tr><tr><td>Users with 10+ referrals</td><td>50+</td></tr><tr><td>% of new users arriving via referral link</td><td>>30%</td></tr></tbody></table></div></div>
</div><div class="footer">Integra Testnet PRD — Referrals & Points — Chain: integra-testnet-1 (EVM 26218)</div></body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment