Free members refer from day one: share codes with late chain binding

Every account gets a share code at signup; /join/<code> attributes
first-touch site-side and resolves to the referrer's CURRENT on-chain id at
the referral's buy time, so activating any time before your people buy
locks the line to you. Joining through a code emails the referrer an
activate-payouts nudge. Buy flow re-resolves the sponsor at click time.
Copy updated across home and members; assets bumped to v=20260904g.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-04 13:54:45 -05:00
parent 9dc5989aa3
commit dea279eed0
8 changed files with 112 additions and 49 deletions
+7 -3
View File
@@ -5,10 +5,11 @@
IAP.$('contractLink').href = c.explorer + '/address/' + c.contract;
const sp = await (await fetch('/api/sponsor')).json();
if (sp.sponsorId) {
if (sp.invited) {
const el = IAP.$('sponsorLine');
el.hidden = false;
el.textContent = 'You were invited by member #' + sp.sponsorId + '. Your purchases pay their team, and your own link will do the same for you.';
el.textContent = (sp.sponsorId ? 'You were invited by member #' + sp.sponsorId + '.' : 'You arrived through a member’s invite.')
+ ' Your purchases pay their team, and your own link will do the same for you.';
}
async function loadLadder() {
@@ -41,7 +42,10 @@
await IAPWallet.signIn();
}
IAP.status('Confirm the purchase in your wallet…');
const r = await IAPWallet.buy(Number(btn.dataset.id), sp.sponsorId || 0, btn.dataset.cost);
// resolve the sponsor at buy time: a code referrer who activated since
// page load still gets locked in
const spNow = await (await fetch('/api/sponsor')).json();
const r = await IAPWallet.buy(Number(btn.dataset.id), spNow.sponsorId || 0, btn.dataset.cost);
if (r.receipt.status !== '0x1') throw new Error('Transaction reverted. Check the explorer.');
IAP.status('Purchase settled on-chain. Credits are yours, payouts delivered. Watch it on the ledger.', 'ok');
IAP.refreshNavWallet();
+11 -7
View File
@@ -34,21 +34,25 @@
$('campaignCard').hidden = !me.memberId;
if (me.memberId) loadCampaigns();
// the share link works from day one; codes resolve to your chain id later
if (me.refCode || me.memberId) {
$('inviteLine').textContent = location.origin + '/join/' + (me.refCode || me.memberId);
$('copyInvite').hidden = false;
} else {
$('inviteLine').textContent = 'Sign in with your email to get your link.';
$('copyInvite').hidden = true;
}
if (me.memberId) {
const bc = me.buyerCount || 0;
$('qualLine').innerHTML = '<b>' + bc + '</b> qualifying buyer(s) referred<br>'
+ (bc >= 5 ? '<span class="badge">Level 3 unlocked: full three-level earnings</span>'
: bc >= 2 ? '<span class="badge">Level 2 unlocked</span> · ' + (5 - bc) + ' more for level 3'
: (2 - bc) + ' more buyer(s) of $20+ unlock level 2');
$('inviteLine').textContent = location.origin + '/join/' + me.memberId;
$('copyInvite').hidden = false;
loadActivity();
} else {
$('qualLine').textContent = 'Level 1 pays the moment you are on-chain. Referrals who buy packages of $20 or more unlock levels 2 and 3.';
$('inviteLine').textContent = me.address
? 'Activate payouts above and your invite link appears here.'
: 'Link a wallet and switch on payouts to get your invite link.';
$('copyInvite').hidden = true;
$('qualLine').innerHTML = 'Share your link now. Then switch on payouts (free, above) '
+ '<b>before your people start buying</b>: the contract locks each buyer to their sponsor at '
+ 'their first purchase, and payments only route to wallets that are switched on.';
}
}
+3 -3
View File
@@ -5,7 +5,7 @@
<title>The contract | InstantAdPay</title>
<meta name="description" content="Plain-language review of the InstantAdPay settlement contract: what it does, what nobody can change, what the operator can and cannot touch, and how to verify all of it yourself.">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=20260904f">
<link rel="stylesheet" href="/assets/site.css?v=20260904g">
</head>
<body>
<div class="wrap">
@@ -129,7 +129,7 @@
<div class="small">Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.</div>
</footer>
</div>
<script src="/assets/common.js?v=20260904f"></script>
<script src="/assets/contract.js?v=20260904f"></script>
<script src="/assets/common.js?v=20260904g"></script>
<script src="/assets/contract.js?v=20260904g"></script>
</body>
</html>
+5 -5
View File
@@ -5,7 +5,7 @@
<title>InstantAdPay: advertise and earn, locked in code</title>
<meta name="description" content="Real ad packages with instant on-chain settlement. Every purchase pays the sponsor line in the same transaction, verifiable by anyone on the live ledger.">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=20260904f">
<link rel="stylesheet" href="/assets/site.css?v=20260904g">
</head>
<body>
@@ -255,7 +255,7 @@
<h3>Free membership includes</h3>
<ul class="checks">
<li>A member account and the live ledger</li>
<li>Your personal referral link, once payouts are switched on</li>
<li>Your personal referral link, working from day one</li>
<li>Earnings from day one on your referrals' package purchases</li>
<li>Access to the member dashboard</li>
</ul>
@@ -345,8 +345,8 @@
</div>
</section>
<script src="/assets/common.js?v=20260904f"></script>
<script src="/assets/wallet.js?v=20260904f"></script>
<script src="/assets/home.js?v=20260904f"></script>
<script src="/assets/common.js?v=20260904g"></script>
<script src="/assets/wallet.js?v=20260904g"></script>
<script src="/assets/home.js?v=20260904g"></script>
</body>
</html>
+3 -3
View File
@@ -5,7 +5,7 @@
<title>Live ledger | InstantAdPay</title>
<meta name="description" content="Every purchase, payout, and pass-up on InstantAdPay, streamed straight from the blockchain with a verify link on every line.">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=20260904f">
<link rel="stylesheet" href="/assets/site.css?v=20260904g">
</head>
<body>
<div class="wrap">
@@ -25,7 +25,7 @@
<div>InstantAdPay · <a href="/">how it works</a> · <a id="contractLink" href="#" target="_blank" rel="noopener">contract source ↗</a></div>
</footer>
</div>
<script src="/assets/common.js?v=20260904f"></script>
<script src="/assets/ledger.js?v=20260904f"></script>
<script src="/assets/common.js?v=20260904g"></script>
<script src="/assets/ledger.js?v=20260904g"></script>
</body>
</html>
+8 -7
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>My account | InstantAdPay</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&display=swap">
<link rel="stylesheet" href="/assets/site.css?v=20260904f">
<link rel="stylesheet" href="/assets/site.css?v=20260904g">
</head>
<body>
<div class="wrap">
@@ -71,9 +71,10 @@
</div>
<div class="card">
<h3>Your invite link</h3>
<p class="muted small">Share it anywhere. Everyone who joins through it becomes part of your line.
You earn 50 percent of every ad package they ever buy, plus levels 2 and 3 of their teams as you qualify.</p>
<h3>Your invite link, live from day one</h3>
<p class="muted small">Share it anywhere, starting now. Everyone who joins through it becomes part of
your line, and you earn 50 percent of every ad package they ever buy, plus levels 2 and 3 as you
qualify. Just switch on payouts before your people start buying so every payment locks to you.</p>
<p class="mono" id="inviteLine">…</p>
<button class="btn small sec" id="copyInvite" hidden>Copy link</button>
</div>
@@ -130,8 +131,8 @@
<footer><div>InstantAdPay · <a href="/ledger">live ledger</a></div></footer>
</div>
<script src="/assets/common.js?v=20260904f"></script>
<script src="/assets/wallet.js?v=20260904f"></script>
<script src="/assets/my.js?v=20260904f"></script>
<script src="/assets/common.js?v=20260904g"></script>
<script src="/assets/wallet.js?v=20260904g"></script>
<script src="/assets/my.js?v=20260904g"></script>
</body>
</html>