Approved launch numbers; members earn for free; Boost = a 7-day board spot (placement only)

- config: 5 sponsor levels x 10% (company 20%), approved numbers labelled as such, POT_DAILY_CENTS display (2500).
- Eligibility: a network member with a linked wallet earns a level or the resharer cut, Boost or not. /api/my/order drops line
  members with no wallet (compression); empty levels and the no-resharer cut go to the company.
- shop.js: VASShop ABI after the contract fix (Purchase.boardDays, skus().boardDays, potDailyMaxCents, potCentsToday); purchase days
  from the chain. wire.js keeps the on-chain days.
- Copy: removed "sponsor levels pay people who have bought a Boost / passed over / none qualified" and the proposal labels; Boost page,
  chatbot, contract page (split fixed forever, pot daily cap) say a Boost buys placement only. Assets ?v=2.
- qa/e2e.mjs: deploys the new VASShop (5 x 10%, pot cap 2500, SKU 7 days); a no-wallet hub member between buyer and sponsor is
  skipped and both sponsors get exactly 10% without a Boost. 61/61. Chatbot QA 108/108.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 05:19:56 -06:00
parent a6c72a4a40
commit 608ec6547b
29 changed files with 114 additions and 91 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ CONTRACT_ADDRESS= # VASShop
CHAIN_RPC=
KEEPER_KEY= # signs orders + reward vouchers (a NEW key, never the ViralAdBlitz keeper)
RELAY_KEY= # pays gas for claimReward relays (holds a little POL only)
REWARD_PAYOUTS=0 # 1 = relay sign-up rewards. OFF until Marty confirms the amounts
REWARD_PAYOUTS=0 # 1 = relay sign-up rewards (amounts approved 2026-11-17; turn on at go-live only)
POT_DAILY_CENTS=2500 # display only: must match the contract potDailyMaxCents (the contract enforces it)
LS_TRACK=0 # 1 = LinkSpin tracked links for ads (needs LinkSpin's 'vas' partner entry)
LS_PARTNER=vas
+13 -6
View File
@@ -3,9 +3,16 @@
"Every ad has a source. Watch yours travel." Approved by Marty 2026-11-16 (mockup: Design canvas 2XuFAog3KEiuXbfEvVvTZk).
Plain Node http server, no framework (the ViralAdBlitz / VBB / Downline Banners pattern). Contract: `../contracts` (VASShop).
Every number marked **PROPOSAL** (Boost $5, resharer 20%, pot 10%, sponsor levels 5 x 5%, sign-up reward $0.25 with a daily cap of 10,
10 credits per 100 verified views, tier bonus every 25th sign-up $2.50 locked 14 days, Boost = 7 days on top) is Claude's proposal.
Marty has not set them. Payouts of sign-up rewards are OFF (`REWARD_PAYOUTS`).
Launch numbers APPROVED by Marty 2026-11-17: Boost $5 = a 7-day board spot (placement only); resharer cut 20% of a Boost bought through
their branch (paid by the contract in the same tx); reward pot 10% of every Boost; 5 sponsor levels x 10% (company keeps 20%); split
immutable on chain; new-member reward $0.25 in POL per verified brand-new network member through a branch, cap 10/day per person;
10 ad credits per 100 verified views. Still proposals: the global pot cap figure ($25/day, `POT_DAILY_CENTS` display + the contract's
`potDailyMaxCents`) and the tier bonus (every 25th sign-up $2.50 locked 14 days). Payouts of sign-up rewards are OFF on staging
(`REWARD_PAYOUTS`).
**Members earn for free.** A Boost buys placement only. Level shares and the resharer cut need only a network sign-in (hub member) and a
linked wallet. Compression: `/api/my/order` drops everyone in the hub sponsor line without a wallet, so each level passes up to the next
eligible person; levels left when the line runs out go to the company; with no resharer, the 20% resharer cut goes to the company.
## What it does
@@ -32,9 +39,9 @@ Marty has not set them. Payouts of sign-up rewards are OFF (`REWARD_PAYOUTS`).
contract pays from the pot. Admin can release / reject / recheck.
- **L1 Boost** (shop.js): `POST /api/my/order` builds a keeper-signed `Order(buyer, sku, qty, ref, line[], resharer, nonce, deadline)`:
line = the buyer's hub sponsor line (wallets, up to 20), resharer = the owner of the reshare link the buyer came through (never the
buyer). The contract pays the resharer cut, the sponsor levels (pass-up over people who never bought), the pot slice and the company in
buyer). The contract pays the resharer cut, the sponsor levels (places 1..5 of the compressed line, no Boost needed), the pot slice and the company in
the same transaction. The watcher records Purchase and RewardPaid events; a Boost puts the ad on top of the reshare board for 7 days per unit.
- **Trust pack** (proof.js): `/ledger` (Boost splits + sign-up rewards, no emails), `/contract` (live from the chain, or the proposals
- **Trust pack** (proof.js): `/ledger` (Boost splits + sign-up rewards, no emails), `/contract` (live from the chain, or the launch numbers
before deploy), toasts (new ads, reshares, Boosts), Telegram photo card per Boost (off unless `TG_*` are set), Terms / Earnings
Disclaimer / Privacy (TrustClickz), the network footer (netsites.js).
- **Chatbot** (chatbot.js + the shared chatcore / kb / netkb), **promo kit** (`/promote`, `/api/promo-kit`, 24 creatives
@@ -52,7 +59,7 @@ Marty has not set them. Payouts of sign-up rewards are OFF (`REWARD_PAYOUTS`).
npm install
node tools/pages.mjs # regenerate public/*.html (one source of copy + legal facts)
node tools/art.mjs # icon, OG image, proof cards, kit creatives (Playwright)
node qa/e2e.mjs # 59 checks: real VASShop on a local anvil chain + stand-in hub (needs ../contracts built)
node qa/e2e.mjs # 61 checks: real VASShop on a local anvil chain + stand-in hub (needs ../contracts built)
node qa/chatbot.test.mjs # the site assistant
```
Env: `.env.example`.
+5 -5
View File
@@ -28,10 +28,10 @@ const CANNED = [
a: 'Open any ad and tap "Reshare this ad". You get your own unique reshare link for that ad (one per ad, always the same). Anyone who arrives through it and reshares too grows the branch under you. Each click and view through your link is booked to you, so the ad owner sees your branch on their tree. A share alone is never paid: only real results through your link are.' },
{ id: 'rewards', title: 'How resharers are rewarded', q: ['Do I get paid for resharing?', 'What are the three rewards?', 'How do rewards work?'], tags: ['reward', 'paid', 'earn', 'resharer'],
re: /(reward|get paid|earn|paid for|commission|payout)/i,
a: 'Only results are rewarded, never a bare share. 1) A Boost bought through your branch: the contract pays you a resharer cut in POL in the same transaction (proposed ' + pct(SP.resharerBps) + '). 2) A brand-new network member who joins through your link and confirms their email: a small POL reward from the reward pot after real-time checks (proposed $' + (R.cents / 100).toFixed(2) + ', with a daily cap of ' + R.dailyCap + '). Sign-up reward payouts are switched off until the amounts are confirmed; they wait in the pending ledger. 3) Verified views through your link: ad credits for your own ad (proposed ' + CR.per + ' credits per ' + CR.views + ' views). ' + NOT_INCOME + ' Nothing is promised.' },
a: 'Only results are rewarded, never a bare share. 1) A Boost bought through your branch: the contract pays you a resharer cut in POL in the same transaction (' + pct(SP.resharerBps) + '). You never need to buy a Boost to earn: a network sign-in and a linked wallet are enough. 2) A brand-new network member who joins through your link and confirms their email: a small POL reward from the reward pot after real-time checks ($' + (R.cents / 100).toFixed(2) + ' in POL, with a daily cap of ' + R.dailyCap + ').' + (R.payouts ? '' : ' Sign-up reward payouts are switched off for now; they wait in the pending ledger.') + ' 3) Verified views through your link: ad credits for your own ad (' + CR.per + ' credits per ' + CR.views + ' views). ' + NOT_INCOME + ' Nothing is promised.' },
{ id: 'credits', title: 'Ad credits', q: ['What are ad credits?', 'How do I use my credits?'], tags: ['credits', 'ad credits', 'views'],
re: /\bcredits?\b/i,
a: 'Every ' + CR.views + ' verified views through your reshare links earn ' + CR.per + ' ad credits (a proposal until confirmed). Credits are spent automatically on your own ad: it is shown in the "Featured with credits" places, and each verified view there uses 1 credit. Credits are never paid out. ' + NOT_INCOME },
a: 'Every ' + CR.views + ' verified views through your reshare links earn ' + CR.per + ' ad credits. Credits are spent automatically on your own ad: it is shown in the "Featured with credits" places, and each verified view there uses 1 credit. Credits are never paid out. ' + NOT_INCOME },
{ id: 'spin-link', title: 'Use one of my LinkSpin spin links as my ad link', q: ['Can I use my LinkSpin spin link in my ad?'], tags: ['linkspin', 'spin link', 'rotator'],
re: /(spin ?links?|\brotator\b|linkspin link)/i,
a: 'Yes. In the ad form on ' + URL_ + '/my tap "Use one of my spin links" and pick one of your own LinkSpin spin links. LinkSpin confirms it is yours on every save. Clicks through a reshare link carry the resharer (s2) and the reshare link (s3), so your LinkSpin Reports show which branch brought each click and sign-up.' },
@@ -40,7 +40,7 @@ const CANNED = [
a: 'Sign in on ' + URL_ + '/my with your network account (InstantAdPay or LinkSpin, through the network sign-in) or with your wallet (a free signature that cannot move funds). Posting a text ad and resharing are free for network members.' },
{ id: 'boost', title: 'What a Boost is', q: ['What is a Boost?', 'How much is a Boost?', 'Where does the Boost money go?'], tags: ['boost', 'price', 'split'],
re: /\bboost/i,
a: 'A Boost (proposed $' + B.usd + ', one-time, never a subscription) puts your ad at the top of the reshare board for ' + B.days + ' days, so more people see it and pass it on. Paid in POL with SafePal or any other crypto wallet. The contract splits it in the same transaction (proposed): ' + pct(SP.resharerBps) + ' to the resharer whose branch sold it, ' + pct(SP.potBps) + ' to the reward pot, ' + SP.levelBps.map(pct).join(' / ') + ' to your sponsor line (people who have bought a Boost; others are passed over), the rest to the company. Every payment is on ' + URL_ + '/ledger.' },
a: 'A Boost ($' + B.usd + ', one-time, never a subscription) is a ' + B.days + '-day board spot: your ad sits at the top of the reshare board for ' + B.days + ' days, so more people see it and pass it on. A Boost buys placement only; you never need one to earn. Paid in POL with SafePal or any other crypto wallet. The contract splits it in the same transaction: ' + pct(SP.resharerBps) + ' to the resharer whose branch sold it, ' + pct(SP.potBps) + ' to the reward pot, ' + SP.levelBps.map(pct).join(' / ') + ' to the 5 nearest people in your sponsor line who have a network sign-in and a linked wallet (anyone without one is skipped and the share passes up), the rest to the company (and any level or resharer cut with nobody to pay). The split is fixed in the contract and can never change. Every payment is on ' + URL_ + '/ledger.' },
{ id: 'old', title: 'Old ViralAdSource accounts', q: ['I was a ViralAdSource member before', 'Does my old link work?'], tags: ['old account', 'old link'],
re: /(old (account|link|balance|member)|was a member|member before|before the rebuild)/i,
a: 'Old ViralAdSource members were matched to the network by email and keep their sponsor. Sign in with your network account. Old referral links open your new member page. Old balances were not carried over.' }
@@ -55,8 +55,8 @@ const FAQ = [
];
const FACTS = () => [
'- WHAT IT IS: ViralAdSource (' + URL_ + '): "Every ad has a source. Watch yours travel." One free text ad per network member (headline ' + C.ad.headline + ', two lines of ' + C.ad.line + ', an https link or the member\'s own LinkSpin spin link). Anyone reshares an ad with their own unique reshare link /s/<code>; each reshare is a branch; the owner\'s dashboard shows the family tree: branch, step, reshares under it, views, clicks, sign-ups.',
'- REWARDS (results only, never a bare share; all amounts are PROPOSALS until Marty confirms): L1 Boost through a branch: resharer cut ' + pct(SP.resharerBps) + ' paid by the VASShop contract in the same transaction. L2 verified brand-new network member through a branch: $' + (R.cents / 100).toFixed(2) + ' in POL from the reward pot, cap ' + R.dailyCap + ' a day per resharer; checks: hub-new, confirmed email, not the resharer\'s device/IP/wallet, no throwaway email, daily cap, fraud score; payouts currently ' + (R.payouts ? 'ON' : 'OFF (rewards wait in the pending ledger)') + '. L3 verified views: ' + CR.per + ' ad credits per ' + CR.views + ' verified views through the resharer\'s links, spent on their own ad, never paid out.',
'- BOOST: one-time $' + B.usd + ' (proposal) = top of the reshare board for ' + B.days + ' days per unit, 1 to ' + B.maxQty + ' per purchase. Split: resharer ' + pct(SP.resharerBps) + ', reward pot ' + pct(SP.potBps) + ', sponsor levels ' + SP.levelBps.map(pct).join('/') + ' (pass-up over people who never bought, up to ' + SP.maxDepth + ' places), company the rest. The pot can only pay sign-up rewards, never more than it holds.',
'- REWARDS (results only, never a bare share; members earn for free: no Boost needed, only a network sign-in and a linked wallet): L1 Boost through a branch: resharer cut ' + pct(SP.resharerBps) + ' paid by the VASShop contract in the same transaction. L2 verified brand-new network member through a branch: $' + (R.cents / 100).toFixed(2) + ' in POL from the reward pot, cap ' + R.dailyCap + ' a day per resharer; checks: hub-new, confirmed email, not the resharer\'s device/IP/wallet, no throwaway email, daily cap, fraud score; payouts currently ' + (R.payouts ? 'ON' : 'OFF (rewards wait in the pending ledger)') + '. L3 verified views: ' + CR.per + ' ad credits per ' + CR.views + ' verified views through the resharer\'s links, spent on their own ad, never paid out.',
'- BOOST: one-time $' + B.usd + ' = a ' + B.days + '-day board spot (top of the reshare board) per unit, placement only, never needed to earn, 1 to ' + B.maxQty + ' per purchase. Split: resharer ' + pct(SP.resharerBps) + ', reward pot ' + pct(SP.potBps) + ', sponsor levels ' + SP.levelBps.map(pct).join('/') + ' to the 5 nearest eligible people in the sponsor line (network sign-in + linked wallet; the ineligible are skipped and the share passes up), company the rest plus any level or resharer cut with nobody to pay. The split is immutable. The pot can only pay sign-up rewards, never more than it holds, at most $' + (R.potDailyCents / 100).toFixed(2) + ' a day across everyone.',
'- VERIFIED VIEWS: page visible ' + C.visitSeconds + ' s, one view per visitor per ad per 24 h, never the owner\'s own, max ' + C.perIpDay + ' browsers per connection a day.',
'- TRUST: ' + URL_ + '/ledger, ' + URL_ + '/contract, toasts of real events. Terms ' + URL_ + '/terms, Earnings Disclaimer ' + URL_ + '/disclaimer, Privacy ' + URL_ + '/privacy. Run by TrustClickz. SUPPORT: ' + SUPPORT
].join('\n');
+12 -8
View File
@@ -7,7 +7,10 @@
// checks (hub-new, confirmed email, not the resharer's device/IP/wallet, no throwaway email, daily cap, fraud score).
// PAYOUTS ARE OFF (REWARD_PAYOUTS=1 turns the relay on) until Marty confirms the amounts.
// L3 verified views through a branch: ad credits for the resharer, spent on their own ad. Ad credits buy advertising, not income.
// Every number below marked PROPOSAL is Claude's proposal (2026-11-16); Marty has not set them.
// Launch numbers APPROVED by Marty 2026-11-17: Boost $5 = a 7-day board spot; resharer 20%, pot 10%, 5 sponsor levels x 10%
// (company 20%), split immutable on chain; $0.25 POL new-member reward, 10 a day per person; 10 ad credits per 100 verified views.
// Members earn for free: a Boost buys placement only. Level shares and the resharer cut need a network sign-in + a linked wallet.
// Still a proposal: the $25/day global pot cap figure and the reward tiers.
const path = require('path');
let cfg = null;
@@ -19,7 +22,7 @@ function get() {
const addr = v => /^0x[0-9a-fA-F]{40}$/.test(String(v || '').trim()) ? require('ethers').getAddress(String(v).trim().toLowerCase()) : '';
let tiers = [];
try { tiers = JSON.parse(e.REWARD_TIERS || '[]'); } catch (x) { tiers = []; }
if (!Array.isArray(tiers) || !tiers.length) tiers = [{ every: 25, cents: 250, lockDays: 14 }]; // PROPOSAL: each 25th verified sign-up from one resharer = a $2.50 bonus, withdrawable after 14 days
if (!Array.isArray(tiers) || !tiers.length) tiers = [{ every: 25, cents: 250, lockDays: 14 }]; // PROPOSAL (not yet approved): each 25th verified sign-up from one resharer = a $2.50 bonus, withdrawable after 14 days
cfg = {
port: Number(e.PORT || 3000),
isProd: e.NODE_ENV === 'production',
@@ -32,18 +35,19 @@ function get() {
chainName: e.CHAIN_NAME || 'Polygon',
publicRpc: e.PUBLIC_RPC || 'https://polygon-bor-rpc.publicnode.com',
walletConnectProjectId: (e.WALLETCONNECT_PROJECT_ID || '').trim(),
// ---- Boost (PROPOSAL $5). The contract's SKU holds the real price; this is display copy and must match it.
// ---- Boost ($5, approved). The contract's SKU holds the real price and board days; this is display copy and must match it.
// A Boost puts the ad at the top of the reshare board for `days` days per unit. One-time, never a subscription.
boost: { sku: int(e.BOOST_SKU, 1, 1, 1000), usd: num(e.BOOST_USD, 5, 0.01, 1000), days: int(e.BOOST_DAYS, 7, 1, 365), maxQty: 10 },
// VASShop split (PROPOSAL; owner-settable on the contract, read live from it when the contract is set): basis points
split: { resharerBps: int(e.SPLIT_RESHARER_BPS, 2000, 0, 9000), potBps: int(e.SPLIT_POT_BPS, 1000, 0, 9000), levelBps: String(e.SPLIT_LEVEL_BPS || '500,500,500,500,500').split(',').map(x => int(x, 0, 0, 9000)).slice(0, 5), maxDepth: 20 },
// ---- L2 sign-up rewards (PROPOSAL $0.25, 10 a day per resharer). Payouts OFF unless REWARD_PAYOUTS=1.
// VASShop split (approved 2026-11-17; IMMUTABLE on the contract, read live from it when the contract is set): basis points
split: { resharerBps: int(e.SPLIT_RESHARER_BPS, 2000, 0, 9000), potBps: int(e.SPLIT_POT_BPS, 1000, 0, 9000), levelBps: String(e.SPLIT_LEVEL_BPS || '1000,1000,1000,1000,1000').split(',').map(x => int(x, 0, 0, 9000)).slice(0, 5), maxDepth: 20 },
// ---- L2 new-member rewards ($0.25 in POL, 10 a day per resharer, approved). Payouts OFF unless REWARD_PAYOUTS=1.
// potDailyCents = the contract's global pot cap across everyone (display; the contract enforces it). PROPOSAL $25/day.
reward: { cents: int(e.REWARD_CENTS, 25, 1, 10000), dailyCap: int(e.REWARD_DAILY_CAP, 10, 0, 1000), tiers,
payouts: e.REWARD_PAYOUTS === '1', fraudHold: int(e.FRAUD_HOLD, 50, 1, 100), voucherDays: int(e.REWARD_VOUCHER_DAYS, 30, 1, 365),
joinWindowHours: int(e.JOIN_WINDOW_HOURS, 72, 1, 720) },
joinWindowHours: int(e.JOIN_WINDOW_HOURS, 72, 1, 720), potDailyCents: int(e.POT_DAILY_CENTS, 2500, 1, 100000) },
hubJoin: e.HUB_JOIN === '1', // a confirmed sign-up is written to the hub (join-all). OFF on staging: a dry check instead
mail: { from: String(e.MAIL_FROM || 'ViralAdSource <noreply@viraladsource.com>'), url: String(e.MAIL_URL || '').trim() }, // MAIL_URL unset = no mail sent (staging)
// ---- L3 ad credits (PROPOSAL: 10 credits per 100 verified views through a branch; 1 credit = 1 verified view of your own ad)
// ---- L3 ad credits (approved: 10 credits per 100 verified views through a branch; 1 credit = 1 verified view of your own ad)
credits: { per: int(e.CREDITS_PER, 10, 1, 1000), views: int(e.CREDITS_VIEWS, 100, 1, 100000), slots: int(e.CREDIT_SLOTS, 2, 0, 10) },
// verified visitors (the VBB / ViralAdBlitz rules)
visitSeconds: int(e.VISIT_SECONDS, 6, 2, 60),
+3 -3
View File
@@ -1,6 +1,6 @@
// Trust pack (Marty 2026-11-14, standing for every network site): live ledger, contract proof, toasts, a Telegram photo card per sale.
// - ledger(): every Boost (the Purchase events shop.js recorded) with its split read from the receipt: the resharer's cut (kind 6),
// each sponsor level (kinds 1..5, with the person's place in the line), who was passed over, the reward pot slice and the company;
// each sponsor level (kinds 1..5, with the person's place in the compressed line), the reward pot slice and the company;
// plus the sign-up rewards ledger (signup.js publicRows: name, amount, status, tx; never an email).
// - contract(): live facts for /contract (owner, company, keeper, paused, split, pot, reward rules), cached 5 minutes.
// - Telegram: one photo card per Boost to TG_CHAT / TG_PAY_TOPIC (off unless TG_TOKEN and TG_CHAT are set; staging leaves them empty).
@@ -56,7 +56,7 @@ async function contract() {
if (cCache && Date.now() - cCache.at < 300000) return cCache.v;
const v = { address: C.contractAddress || null, chainId: C.chainId, explorer: C.explorer, proposal: true,
split: { resharerBps: C.split.resharerBps, potBps: C.split.potBps, levelBps: C.split.levelBps, maxDepth: C.split.maxDepth },
reward: { cents: C.reward.cents, dailyCap: C.reward.dailyCap, payouts: C.reward.payouts }, boost: { usd: C.boost.usd, days: C.boost.days },
reward: { cents: C.reward.cents, dailyCap: C.reward.dailyCap, payouts: C.reward.payouts, potDailyCents: C.reward.potDailyCents }, boost: { usd: C.boost.usd, days: C.boost.days },
verified: { sourcify: process.env.VERIFIED_SOURCIFY === '1', polygonscan: process.env.VERIFIED_POLYGONSCAN === '1' }, ownerNote: "Marty's Tangem hardware wallet", live: false };
if (shop && shop.watching()) {
try {
@@ -65,7 +65,7 @@ async function contract() {
const r = await shop.liveRules();
Object.assign(v, { owner: lc(owner), company: lc(company), keeper: lc(keeper), paused: !!paused, totalOwedWei: totalOwed.toString(), orderCount: Number(orderCount),
pot: { balanceWei: potBalance.toString(), fundedWei: potFunded.toString(), paidWei: potPaid.toString() }, live: true, proposal: false, readAt: Date.now() });
if (r) { v.split = { resharerBps: r.resharerBps, potBps: r.potBps, levelBps: r.levelBps, maxDepth: 20 }; v.reward.maxCents = r.rewardMaxCents; v.reward.chainDailyCap = r.rewardDailyCap; }
if (r) { v.split = { resharerBps: r.resharerBps, potBps: r.potBps, levelBps: r.levelBps, maxDepth: 20 }; v.reward.maxCents = r.rewardMaxCents; v.reward.chainDailyCap = r.rewardDailyCap; if (r.potDailyCents) v.reward.potDailyCents = r.potDailyCents; }
} catch (e) { v.error = 'The chain did not answer just now. Try again in a minute.'; }
}
cCache = { at: Date.now(), v }; if (v.error) cCache.at = Date.now() - 240000;
+2 -2
View File
@@ -36,8 +36,8 @@
</div>
<section id="featured" hidden style="margin-top:32px"><h2 style="font-size:24px">Featured with credits</h2><div class="ads"></div></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/adpage.js?v=1"></script>
<script src="/assets/adpage.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -26,8 +26,8 @@
<section class="panel" style="margin-top:18px" id="testBox"><h2 style="font-size:22px">Staging: mark a test member</h2><p class="muted">Staging only. Lets a wallet post and reshare without a real network account.</p>
<div class="row"><input type="text" id="tAddr" placeholder="0x wallet" style="max-width:420px"><input type="text" id="tName" placeholder="username" style="max-width:200px"><button class="btn sm" id="tGo" type="button">Mark</button></div><p id="status" class="note" hidden></p></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/admin.js?v=1"></script>
<script src="/assets/admin.js?v=2"></script>
</body>
</html>
+3 -3
View File
@@ -1,4 +1,4 @@
// Boost page: the split (live from the contract, else the proposal), the live POL price, and the Buy button.
// Boost page: the split (live from the contract, else the approved launch numbers), the live POL price, and the Buy button.
(async function () {
const $ = VAS.$;
VAS.wire('other').catch(() => {});
@@ -6,8 +6,8 @@
const rows = [['Resharer whose branch sold it', VAS.pct(sp.resharerBps)], ['Reward pot (pays sign-up rewards only)', VAS.pct(sp.potBps)]]
.concat((sp.levelBps || []).map((x, i) => ['Sponsor level ' + (i + 1), VAS.pct(x)]));
const used = (sp.resharerBps || 0) + (sp.potBps || 0) + (sp.levelBps || []).reduce((t, x) => t + x, 0);
rows.push(['Company (the rest, plus any level nobody qualifies for)', VAS.pct(10000 - used)]);
$('splitRows').innerHTML = rows.map(r => '<tr><td>' + r[0] + '</td><td class="n">' + r[1] + '</td></tr>').join('') + (sp.live ? '' : '<tr><td colspan="2" class="muted">Proposed numbers, not final.</td></tr>');
rows.push(['Company (the rest, plus any level with nobody eligible in your line, and the resharer cut when there is no resharer)', VAS.pct(10000 - used)]);
$('splitRows').innerHTML = rows.map(r => '<tr><td>' + r[0] + '</td><td class="n">' + r[1] + '</td></tr>').join('') + (sp.live ? '' : '<tr><td colspan="2" class="muted">Launch numbers. The contract is not live yet.</td></tr>');
const live = !!(c.shop && c.shop.live);
const qty = () => Number($('qty').value) || 1;
async function price() {
+3 -4
View File
@@ -21,7 +21,7 @@ window.VAS = (function () {
+ '<nav class="links" aria-label="Main">' + links.map(l => '<a href="' + l[0] + '"' + (l[0] === active ? ' class="on" aria-current="page"' : '') + '>' + l[1] + '</a>').join('') + '</nav>'
+ '<div class="row"><a class="btn sm" id="navSign" href="/my">Sign in</a><a class="btn sm ink" href="/my#post">Post your ad free</a></div></div>';
document.body.prepend(h);
getConfig().then(c => { if (c.staging) { const b = document.createElement('div'); b.className = 'stage-bar'; b.textContent = 'Staging copy for testing. Numbers marked as proposals are not final. No real payouts happen here.'; h.after(b); } }).catch(() => {});
getConfig().then(c => { if (c.staging) { const b = document.createElement('div'); b.className = 'stage-bar'; b.textContent = 'Staging copy for testing. No real payouts happen here.'; h.after(b); } }).catch(() => {});
getJSON('/api/me').then(m => { if (m.signedIn) { const a = $('navSign'); if (a) { a.textContent = m.username ? '@' + m.username : short(m.address); } } }).catch(() => {});
if (framed) document.querySelectorAll('a[href^="/my"]').forEach(a => { a.target = '_blank'; a.rel = 'noopener'; });
}
@@ -105,18 +105,17 @@ window.VAS = (function () {
async function copy(text, btn) { try { await navigator.clipboard.writeText(text); if (btn) { const o = btn.textContent; btn.textContent = 'Copied'; setTimeout(() => { btn.textContent = o; }, 1600); } } catch (e) { if (btn) { btn.textContent = 'Select the link above to copy it'; } } }
return { MARK, $, esc, getConfig, short, framed, status, getJSON, post, n, pct, usd, renderNav, renderFooter, adCard, wire, featured, decorate, goHref, polOf, when, copy };
})();
// every page: header, footer and the numbers from /api/config (proposals are labelled as proposals)
// every page: header, footer and the numbers from /api/config
(function () {
const boot = () => {
VAS.renderNav(document.body.dataset.nav || ''); VAS.renderFooter();
VAS.getConfig().then(c => {
const sp = c.split || {}, rw = c.reward || {}, cr = c.credits || {}, b = c.boost || {};
const prop = sp.live ? '' : '(proposal)';
const lv = sp.levelBps || []; const lvTxt = lv.length ? (lv.every(x => x === lv[0]) ? lv.length + ' x ' + VAS.pct(lv[0]) : lv.map(VAS.pct).join(' / ')) : 'none';
const tier = (rw.tiers || [])[0] || {};
const V = { cut: VAS.pct(sp.resharerBps), pot: VAS.pct(sp.potBps), levels: lvTxt, signup: VAS.usd(rw.cents), cap: String(rw.dailyCap), lockDays: String(tier.lockDays || 14),
creditsPer: String(cr.per), creditsViews: String(cr.views), boostDays: String(b.days), boostUsd: '$' + b.usd, headline: String((c.ad || {}).headline || 60),
proposalTag: prop, proposalNote: sp.live ? '' : 'The percentages and amounts shown are proposals and are not final yet.',
proposalTag: '', proposalNote: '',
payoutsNote: rw.payouts ? '' : 'Sign-up reward payouts are switched off for now: verified rewards wait in the pending ledger.' };
document.querySelectorAll('[data-cfg]').forEach(el => { const k = el.dataset.cfg; if (V[k] != null) el.textContent = V[k]; });
}).catch(() => {});
+5 -5
View File
@@ -1,4 +1,4 @@
// Contract page: live facts from /api/contract (read from Polygon, cached 5 minutes), or the proposed rules before it is deployed.
// Contract page: live facts from /api/contract (read from Polygon, cached 5 minutes), or the approved launch rules before it is deployed.
(async function () {
const el = VAS.$('facts'); const esc = VAS.esc;
const d = await VAS.getJSON('/api/contract').catch(() => ({}));
@@ -6,10 +6,10 @@
const addr = (a, note) => (a ? '<a class="mono" href="' + esc(ex) + '/address/' + esc(a) + '" target="_blank" rel="noopener">' + esc(a) + '</a>' : '<span class="muted">not deployed yet</span>') + (note ? '<br><span class="muted" style="font-size:13px">' + note + '</span>' : '');
const sp = d.split || {}; const lv = (sp.levelBps || []).map(VAS.pct).join(' / ');
const rows = [
['Contract', addr(d.address, 'VASShop on Polygon' + (d.proposal ? '. Not deployed: the numbers below are proposals.' : ''))],
['Owner', addr(d.owner, 'Marty\'s Tangem hardware wallet. It can pause, set future prices and percentages, and change the keeper. It cannot take the reward pot.')],
['Split of each Boost', 'Resharer ' + VAS.pct(sp.resharerBps) + ' · reward pot ' + VAS.pct(sp.potBps) + ' · sponsor levels ' + esc(lv) + ' · company the rest'],
['Sign-up reward', VAS.usd(d.reward && d.reward.cents) + ' in POL, up to ' + esc(d.reward && d.reward.dailyCap) + ' a day per wallet' + (d.reward && !d.reward.payouts ? ' (payouts switched off for now)' : '')],
['Contract', addr(d.address, 'VASShop on Polygon' + (d.proposal ? '. Not deployed yet: the numbers below are the launch numbers.' : ''))],
['Owner', addr(d.owner, 'Marty\'s Tangem hardware wallet. It can pause, set Boost prices and the reward limits, and change the keeper. It can never change the split and cannot take the reward pot.')],
['Split of each Boost', 'Resharer ' + VAS.pct(sp.resharerBps) + ' · reward pot ' + VAS.pct(sp.potBps) + ' · sponsor levels ' + esc(lv) + ' · company the rest (fixed in the contract, it can never change)'],
['Sign-up reward', VAS.usd(d.reward && d.reward.cents) + ' in POL, up to ' + esc(d.reward && d.reward.dailyCap) + ' a day per wallet' + (d.reward && d.reward.potDailyCents ? '; the pot pays at most ' + VAS.usd(d.reward.potDailyCents) + ' a day across everyone' : '') + (d.reward && !d.reward.payouts ? ' (payouts switched off for now)' : '')],
['Reward pot', d.live && d.pot ? VAS.polOf(d.pot.balanceWei) + ' POL now · ' + VAS.polOf(d.pot.fundedWei) + ' POL in · ' + VAS.polOf(d.pot.paidWei) + ' POL paid out' : '<span class="muted">' + esc(d.error || 'not deployed yet') + '</span>'],
['Sales', d.live ? (d.paused ? '<b>Paused</b>' : 'Open') + ' · ' + VAS.n(d.orderCount) + ' orders' : '<span class="muted">not open yet</span>']
];
+1 -1
View File
@@ -9,7 +9,7 @@
[VAS.n((d.rewards || []).filter(r => r.status === 'paid').length), 'sign-up rewards paid']].map(x => '<div class="stat"><b>' + x[0] + '</b><span>' + x[1] + '</span></div>').join('');
const tx = h => h ? '<a href="' + esc(ex) + '/tx/' + esc(h) + '" target="_blank" rel="noopener">verify</a>' : '';
if (d.items.length) $('rows').innerHTML = d.items.map(r => {
const lv = (r.pays || []).filter(p => p.kind >= 1 && p.kind <= 5).map(p => 'L' + p.kind + ' ' + pol(p.wei) + ' ' + who(p.to, p.name)).join('<br>') || '<span class="muted">none qualified</span>';
const lv = (r.pays || []).filter(p => p.kind >= 1 && p.kind <= 5).map(p => 'L' + p.kind + ' ' + pol(p.wei) + ' ' + who(p.to, p.name)).join('<br>') || '<span class="muted">no sponsor line</span>';
const co = (r.pays || []).find(p => p.kind === 0);
return '<tr><td>' + VAS.when(r.at) + '</td><td>' + who(r.buyer, r.buyerName) + '</td><td class="n">' + VAS.usd(r.usdCents) + '<br>' + pol(r.weiPaid) + '</td><td>'
+ (r.resharer ? who(r.resharer.to, r.resharer.name) + '<br>' + pol(r.resharer.wei) : '<span class="muted">none</span>') + '</td><td>' + lv + '</td><td class="n">' + pol(r.potWei) + '</td><td class="n">' + (co ? pol(co.wei) : '') + '</td><td>' + tx(r.tx) + '</td></tr>';
+1 -1
View File
@@ -29,7 +29,7 @@ window.VASWallet = (function () {
// networks advertise the WalletConnect RPC proxy
// (rpc.walletconnect.org/v1/?chainId=…&projectId=…) as the chain RPC, and
// wallets reject that query-string URL as "Invalid URL" when adding/switching
// the network — the cause of Trust's "Invalid URL", MetaMask's switch loop,
// the network: the cause of Trust's "Invalid URL", MetaMask's switch loop,
// and the failed mobile buy (the chain switch never completed).
const rpc = String(c.rpc || '').trim();
const net = rpc ? Object.assign({}, base, { rpcUrls: { default: { http: [rpc] }, public: { http: [rpc] } } }) : base;
+5 -5
View File
@@ -31,15 +31,15 @@
<h2 style="font-size:28px">Where the POL goes</h2>
<p style="color:var(--ink3)">The VASShop contract splits every Boost in the buyer's own transaction. Nobody holds it.</p>
<div class="tbl"><table><tbody id="splitRows"></tbody></table></div>
<p class="muted" style="font-size:14px">Sponsor levels pay people in your network sponsor line who have bought a Boost; anyone who has not is passed over and the share goes up the line (up to 20 places). A level nobody qualifies for goes to the company. If you did not arrive through someone's reshare link, the resharer share goes to the company.</p>
<p class="muted" style="font-size:14px">A Boost buys placement only. Nobody needs to buy one to earn: sponsor levels pay the 5 nearest people in your network sponsor line who have a network sign-in and a linked wallet. Anyone without one is skipped and the share passes up to the next person who has. Levels left when the line runs out go to the company. If you did not arrive through someone's reshare link, the resharer share goes to the company. The split is fixed in the contract and can never change.</p>
<p class="muted" style="font-size:14px">Pay with SafePal or any other crypto wallet on Polygon. Anything you send above the exact price comes back in the same transaction. A Boost buys advertising, not income.</p>
</div>
</div></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/buy.js?v=1"></script>
<script src="/assets/boost.js?v=1"></script>
<script src="/assets/wallet.js?v=2"></script>
<script src="/assets/buy.js?v=2"></script>
<script src="/assets/boost.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -22,8 +22,8 @@
<p id="status" class="note">One moment...</p>
<div class="row" style="margin-top:16px"><a class="btn ink" href="/my">Sign in</a><a class="btn" href="/">Front page</a></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/join.js?v=1"></script>
<script src="/assets/join.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -27,8 +27,8 @@
<li>A sign-up reward needs a keeper-signed voucher, used once, under the per-reward cap and the per-wallet daily cap, and never more than the pot holds.</li>
<li>No proxy, no owner withdrawal of the pot, no self-destruct. The owner is Marty's Tangem hardware wallet.</li></ul></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/contract.js?v=1"></script>
<script src="/assets/contract.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -23,8 +23,8 @@
<p>Crypto prices change. A reward or payment priced in dollars is paid in POL at the price when it is paid; its value can go down afterwards. Network fees apply to every transaction.</p>
<p>Any example on this site is an illustration of how the contract splits a payment, not a prediction of what you will receive.</p>
<p>TrustClickz. Questions: <a href="https://instantadpay.com/support?from=viraladsource">network support</a>.</p></main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/static.js?v=1"></script>
<script src="/assets/static.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -108,8 +108,8 @@
<div class="panel" id="hunt"><h3 style="margin:0 0 6px;font-size:19px">Hunt it on PolHunter</h3><p style="margin:0;color:var(--ink3)">A find code hides in one of the three "How an ad spreads" steps.</p></div>
</div></div></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/front.js?v=1"></script>
<script src="/assets/front.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -28,8 +28,8 @@
</form>
<p id="status" class="note" hidden></p>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/join.js?v=1"></script>
<script src="/assets/join.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -25,8 +25,8 @@
<section class="panel" style="margin-top:22px"><h2 style="font-size:26px">Sign-up rewards</h2><p class="muted" id="payNote" style="margin:6px 0 0"></p>
<div class="tbl"><table><thead><tr><th>When</th><th>Resharer</th><th>Kind</th><th>Amount</th><th>Status</th><th>Proof</th></tr></thead><tbody id="rrows"><tr><td colspan="6" class="muted">No rewards yet.</td></tr></tbody></table></div></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/ledger.js?v=1"></script>
<script src="/assets/ledger.js?v=2"></script>
</body>
</html>
+3 -3
View File
@@ -64,9 +64,9 @@
<div class="row" style="margin-top:22px"><button class="btn sm" id="logout" type="button">Sign out</button><button class="btn sm" id="logoutAll" type="button">Sign out everywhere</button></div>
</div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/wallet.js?v=1"></script>
<script src="/assets/my.js?v=1"></script>
<script src="/assets/wallet.js?v=2"></script>
<script src="/assets/my.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -23,8 +23,8 @@
<h2>Sharing</h2><p>Your account is part of the network: your username, wallet and sponsor are shared with the network hub so one account works on every network site. We do not sell personal data. Blockchain transactions are public by nature.</p>
<h2>Your choices</h2><p>Ask network support to delete your data; the network hub removes it from every network site, except what the blockchain or the law keeps.</p>
<p>TrustClickz. Questions: <a href="https://instantadpay.com/support?from=viraladsource">network support</a>.</p></main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/static.js?v=1"></script>
<script src="/assets/static.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -23,8 +23,8 @@
<label class="f" style="max-width:360px;margin-top:18px">Your network username<input type="text" id="kitUser" placeholder="username"></label>
<div id="kit" style="margin-top:22px"></div>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/promote.js?v=1"></script>
<script src="/assets/promote.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -50,8 +50,8 @@
<div class="panel"><h2 style="font-size:26px">Where to see it</h2><p class="muted">Your rewards and credits are on <a href="/my">My ad tree</a>. Every paid reward and every Boost split is on the <a href="/ledger">public ledger</a> with its Polygon transaction.</p></div>
</div></section>
</main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/static.js?v=1"></script>
<script src="/assets/static.js?v=2"></script>
</body>
</html>
+2 -2
View File
@@ -27,8 +27,8 @@
<h2>No promise of income</h2><p>What you buy is advertising. We do not promise any income, views, sign-ups or results. See the Earnings Disclaimer.</p>
<h2>Changes</h2><p>We can change these terms and the program's numbers going forward; a change never alters a payment already made on chain.</p>
<p>TrustClickz. Questions: <a href="https://instantadpay.com/support?from=viraladsource">network support</a>.</p></main>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/common.js?v=2"></script>
<script src="/assets/chat.js?v=1" defer></script>
<script src="/assets/static.js?v=1"></script>
<script src="/assets/static.js?v=2"></script>
</body>
</html>
+13 -8
View File
@@ -5,7 +5,9 @@
// a visitor through R2's link -> verified view booked to R2 + ad credits; a verified click carries the branch (s2/s3 on LinkSpin links);
// the family tree sums it up; sign-ups through R2's link: a clean one passes every check (pending reward + keeper voucher),
// a throwaway email is rejected, R2's own device is rejected, someone already in the network is rejected;
// B arrives through R1's link and buys a Boost: the contract pays R1 the resharer cut, the pot, the company, to the wei;
// B arrives through R1's link and buys a Boost: the contract pays R1 the resharer cut, the pot, the company, to the wei, and the
// sponsor levels with no Boost needed: B's hub line is B -> X (no wallet, not eligible) -> O -> S, so X is skipped (compression)
// and O gets level 1, S level 2; levels 3..5 have nobody and go to the company;
// rewards relay (payouts ON in this test only): claimReward pays R2 from the pot; a replay is refused by the contract;
// the staging test switch works on a staging host and is refused on the real domain.
// node qa/e2e.mjs (needs anvil ~/.foundry/bin and `forge build` output in ../contracts/out)
@@ -44,7 +46,7 @@ http.createServer(async (q, r) => {
const all = [...people.entries()];
const w = j.wallet ? String(j.wallet).toLowerCase() : j.id ? (all.find(([, p]) => p.id === j.id) || [])[0] : j.ref ? (all.find(([a, p]) => a === String(j.ref).toLowerCase() || p.username === String(j.ref).toLowerCase()) || [])[0] : null;
const p = w && people.get(w); const sp = p && p.sponsor && people.get(p.sponsor);
r.end(JSON.stringify({ person: p ? { id: p.id, username: p.username, wallet: w, blocked: false, sponsor: sp ? { id: sp.id, username: sp.username } : null } : null }));
r.end(JSON.stringify({ person: p ? { id: p.id, username: p.username, wallet: p.noWallet ? null : w, blocked: false, sponsor: sp ? { id: sp.id, username: sp.username } : null } : null }));
}).listen(HPORT, '127.0.0.1').unref();
// a browser: its own cookie jar and user agent (so its own visitor key)
@@ -80,13 +82,14 @@ async function main() {
people.set(lc(O), { id: 'h_' + '0'.repeat(16), username: 'owner', sponsor: lc(S) });
people.set(lc(R1), { id: 'h_' + '1'.repeat(16), username: 'reshareone', sponsor: lc(S) });
people.set(lc(R2), { id: 'h_' + '2'.repeat(16), username: 'resharetwo', sponsor: lc(R1) });
people.set(lc(B), { id: 'h_' + 'b'.repeat(16), username: 'buyerb', sponsor: lc(O) });
people.set('x-no-wallet', { id: 'h_' + 'c'.repeat(16), username: 'nowallet', sponsor: lc(O), noWallet: true }); // a hub member with no linked wallet
people.set(lc(B), { id: 'h_' + 'b'.repeat(16), username: 'buyerb', sponsor: 'x-no-wallet' });
const art = n => JSON.parse(fs.readFileSync(path.join(ART, n + '.sol', n + '.json'), 'utf8'));
const feedA = art('MockV3Aggregator'), shopA = art('VASShop');
const feed = await new ethers.ContractFactory(feedA.abi, feedA.bytecode.object, deployer).deploy(25000000n); await feed.waitForDeployment();
const shopC = await new ethers.ContractFactory(shopA.abi, shopA.bytecode.object, deployer).deploy(company, keeper.address, await feed.getAddress(), 2000, 1000, [500, 500, 500, 500, 500], 25, 10, 0);
await shopC.waitForDeployment(); await (await shopC.setSku(1, 500, 500, true)).wait();
const shopC = await new ethers.ContractFactory(shopA.abi, shopA.bytecode.object, deployer).deploy(company, keeper.address, await feed.getAddress(), 2000, 1000, [1000, 1000, 1000, 1000, 1000], 25, 10, 2500);
await shopC.waitForDeployment(); await (await shopC.setSku(1, 500, 7, true)).wait();
const CA = await shopC.getAddress(); console.log('VASShop at', CA);
await (await deployer.sendTransaction({ to: relay.address, value: ethers.parseEther('1') })).wait();
@@ -166,14 +169,16 @@ async function main() {
console.log('\n-- Boost through R1\'s branch, to the wei');
await cB.post('/api/my/ad', { headline: 'Buyer ad for testing here', line1: 'A line about it', link: 'https://example.org/b' });
await cB.get('/s/' + s1.j.code); // B came through R1's reshare link
const od = await cB.post('/api/my/order', { qty: 1 }); ok(od.j.to === CA && od.j.resharer === lc(R1) && od.j.line === 2 && od.j.resharerName === 'reshareone', 'signed order names R1 and the 2-wallet line', od.j);
const od = await cB.post('/api/my/order', { qty: 1 }); ok(od.j.to === CA && od.j.resharer === lc(R1) && od.j.line === 2 && od.j.resharerName === 'reshareone', 'signed order names R1 and the 2-wallet line (the no-wallet member is skipped)', od.j);
const rc = await (await B.sendTransaction({ to: od.j.to, data: od.j.data, value: od.j.value })).wait();
const bal = (a, t) => provider.getBalance(a, t == null ? rc.blockNumber : t);
const [c0, r10, o0, s0, b0] = await Promise.all([company, R1.address, O.address, S.address, B.address].map(a => bal(a, rc.blockNumber - 1)));
const price = BigInt(od.j.wei); const res = price * 2000n / 10000n, pot = price * 1000n / 10000n;
const price = BigInt(od.j.wei); const res = price * 2000n / 10000n, pot = price * 1000n / 10000n, lvl = price * 1000n / 10000n;
const [c1, r11, o1, s1b, b1] = await Promise.all([company, R1.address, O.address, S.address, B.address].map(a => bal(a)));
ok(r11 - r10 === res, 'R1 got exactly 20% (' + ethers.formatEther(res) + ' POL)', (r11 - r10).toString());
ok(c1 - c0 === price - res - pot && o1 === o0 && s1b === s0, 'company got 70% (nobody in the line has bought), sponsors 0', (c1 - c0).toString());
ok(o1 - o0 === lvl && s1b - s0 === lvl, 'O (level 1) and S (level 2) each got exactly 10% without ever buying a Boost (compression over the no-wallet member)', { o: (o1 - o0).toString(), s: (s1b - s0).toString() });
ok((await shopC.boostsBought(O.address)) === 0n && (await shopC.boostsBought(S.address)) === 0n, 'neither sponsor has bought a Boost');
ok(c1 - c0 === price - res - pot - 2n * lvl, 'company got 20% + the 3 empty levels (50% in all)', (c1 - c0).toString());
ok(b0 - b1 === price + rc.gasUsed * rc.gasPrice, 'the 1% overpay came back in the same transaction');
ok((await shopC.potBalance()) === pot, 'reward pot holds 10%');
for (let i = 0; i < 40; i++) { const L = await (await fetch(BASE + '/api/ledger')).json(); if (L.items.length && L.items[0].pays && L.items[0].pays.length) break; await sleep(250); }
+3
View File
@@ -460,6 +460,9 @@ const server = http.createServer(async (req, res) => {
const a = store.adOf(me); if (!a || a.status !== 'live') return json(res, 400, { error: 'Post your text ad first. A Boost is for your ad.' });
const lo = await hubline.lineOf({ wallet: me }, shop.MAX_LINE);
if (!lo.ok) return json(res, 503, { error: 'Your sponsor line could not be checked with the network just now. Try again in a minute, so your team gets paid.' });
// eligibility (Marty 2026-11-17): a network member (hub) with a linked wallet earns a level, Boost or not. Dropping the
// ineligible here IS the compression: each level passes up to the next eligible person; the contract pays places 1..5 and
// whatever levels are left when the line runs out go to the company
const line = lo.line.filter(x => x.wallet && x.wallet !== me).map(x => x.wallet);
// the resharer whose branch sold it: the reshare link this buyer came through (last touch), never the buyer
const via = viaOf(req); const vs = via ? store.share(via.code) : null;
+14 -10
View File
@@ -1,8 +1,11 @@
// On-chain side (VASShop, ../contracts). Each job is inert until configured:
// (a) orders: KEEPER_KEY (the keeper the contract trusts) signs EIP-712 Order(buyer, sku, qty, ref, line[], resharer, nonce, deadline).
// line = the buyer's network sponsor line from the hub (wallets, nearest first, up to 20); resharer = the wallet of the member whose
// reshare link the buyer came through (or zero). The contract pays the resharer's cut, the sponsor levels (pass-up over people
// who never bought), the reward-pot slice and the company in the same transaction. A keeper signature is required for every buy.
// reshare link the buyer came through (or zero). The contract pays the resharer's cut, the sponsor levels (places 1..5 of the
// line; nobody needs a Boost to earn), the reward-pot slice and the company in the same transaction. A keeper signature is required
// for every buy. Compression happens HERE (server.js /api/my/order): only network members with a linked wallet go in the line, so
// a level passes up to the next eligible person; levels left when the line runs out, and the resharer cut with no resharer, go to
// the company.
// (b) rewards: the keeper signs Reward(to, usdCents, unlockAt, nonce, deadline) for an L2 sign-up reward that passed every check.
// The voucher is kept in the pending-rewards ledger. relayReward() sends claimReward() from RELAY_KEY's wallet (gas only) and is
// called ONLY when REWARD_PAYOUTS=1 (OFF until Marty confirms the amounts). The contract enforces the per-reward cap, the
@@ -18,7 +21,7 @@ const store = require('./store');
const ADDR_RE = /^0x[0-9a-fA-F]{40}$/;
const ZERO = '0x0000000000000000000000000000000000000000';
const IFACE = new Interface([
'event Purchase(uint256 indexed orderId, address indexed buyer, uint256 indexed sku, uint256 qty, uint256 ref, uint256 views, uint256 usdCents, uint256 weiPaid, address resharer, uint256 resharerPaid, uint256 potAdded, uint256 companyPaid)',
'event Purchase(uint256 indexed orderId, address indexed buyer, uint256 indexed sku, uint256 qty, uint256 ref, uint256 boardDays, uint256 usdCents, uint256 weiPaid, address resharer, uint256 resharerPaid, uint256 potAdded, uint256 companyPaid)',
'event Paid(uint256 indexed orderId, address indexed to, uint256 amount, uint8 kind, uint8 depth)',
'event PaymentFailed(uint256 indexed orderId, address indexed to, uint256 amount, uint8 kind, uint8 depth)',
'event PassedOver(uint256 indexed orderId, address indexed who, uint8 depth)',
@@ -30,9 +33,9 @@ const CALLS = new Interface(['function quoteWei(uint256 sku, uint256 qty) view r
'function claimReward(address to, uint256 usdCents, uint256 unlockAt, uint256 nonce, uint256 deadline, bytes sig) returns (uint256 weiPaid)',
'function boostsBought(address) view returns (uint256)', 'function potBalance() view returns (uint256)', 'function potFunded() view returns (uint256)', 'function potPaid() view returns (uint256)',
'function rewardsToday(address) view returns (uint256)', 'function rewardNonceUsed(uint256) view returns (bool)', 'function resharerBps() view returns (uint256)', 'function potBps() view returns (uint256)',
'function levelBps() view returns (uint16[])', 'function rewardMaxCents() view returns (uint256)', 'function rewardDailyCap() view returns (uint256)', 'function potDailyMaxWei() view returns (uint256)',
'function levelBps() view returns (uint16[])', 'function rewardMaxCents() view returns (uint256)', 'function rewardDailyCap() view returns (uint256)', 'function potDailyMaxCents() view returns (uint256)', 'function potCentsToday() view returns (uint256 paid, uint256 left)',
'function owner() view returns (address)', 'function company() view returns (address)', 'function keeper() view returns (address)', 'function paused() view returns (bool)',
'function totalOwed() view returns (uint256)', 'function orderCount() view returns (uint256)', 'function skus(uint256) view returns (uint64 usdCents, uint64 views, bool active)']);
'function totalOwed() view returns (uint256)', 'function orderCount() view returns (uint256)', 'function skus(uint256) view returns (uint64 usdCents, uint64 boardDays, bool active)']);
const TYPES = {
Order: [{ name: 'buyer', type: 'address' }, { name: 'sku', type: 'uint256' }, { name: 'qty', type: 'uint256' }, { name: 'ref', type: 'uint256' }, { name: 'line', type: 'address[]' },
{ name: 'resharer', type: 'address' }, { name: 'nonce', type: 'uint256' }, { name: 'deadline', type: 'uint256' }],
@@ -96,7 +99,7 @@ function apply(ev) {
const key = String(ev.txHash).toLowerCase() + ':' + ev.logIndex;
if (P[key]) { st.dupes++; return false; }
const a = ev.buyer.toLowerCase(); if (!store.member(a)) store.upsertMember(a, { via: 'wallet' });
const rec = { at: Date.now(), blockAt: ev.blockAt || null, block: ev.block, orderId: ev.orderId, buyer: a, sku: ev.sku, qty: ev.qty, ref: ev.ref, views: ev.views,
const rec = { at: Date.now(), blockAt: ev.blockAt || null, block: ev.block, orderId: ev.orderId, buyer: a, sku: ev.sku, qty: ev.qty, ref: ev.ref, days: ev.days,
usdCents: ev.usdCents, weiPaid: ev.weiPaid, resharer: ev.resharer, resharerPaid: ev.resharerPaid, potAdded: ev.potAdded, companyPaid: ev.companyPaid };
if (hooks.attach) { try { hooks.attach(rec); } catch (e) {} }
P[key] = rec; store.save(); st.recorded++;
@@ -110,7 +113,7 @@ function decode(l) {
if (t0 === TOPIC) {
const d = IFACE.parseLog({ topics: l.topics, data: l.data }).args; const r = String(d.resharer).toLowerCase();
return { kind: 'purchase', txHash: l.transactionHash, logIndex: parseInt(l.logIndex, 16), block: parseInt(l.blockNumber, 16), orderId: Number(d.orderId), buyer: d.buyer, sku: Number(d.sku),
qty: Number(d.qty), ref: d.ref.toString(), views: Number(d.views), usdCents: Number(d.usdCents), weiPaid: d.weiPaid.toString(), resharer: r === ZERO ? null : r,
qty: Number(d.qty), ref: d.ref.toString(), days: Number(d.qty) ? Number(d.boardDays) / Number(d.qty) : null, usdCents: Number(d.usdCents), weiPaid: d.weiPaid.toString(), resharer: r === ZERO ? null : r,
resharerPaid: d.resharerPaid.toString(), potAdded: d.potAdded.toString(), companyPaid: d.companyPaid.toString() };
}
if (t0 === RTOPIC) {
@@ -119,7 +122,8 @@ function decode(l) {
}
return null;
}
// the split of one order from its receipt: kind 0 company, 1..5 sponsor levels (with depth), 6 resharer; who was passed over
// the split of one order from its receipt: kind 0 company, 1..5 sponsor levels (with depth), 6 resharer (`over` stays empty: the
// contract has no pass-over since 2026-11-17, compression is done when the line is built)
async function readSplit(tx, orderId) {
const r = await rpc('eth_getTransactionReceipt', [tx]); if (!r || !Array.isArray(r.logs)) return null;
const pays = [], over = [];
@@ -187,8 +191,8 @@ async function liveRules() {
if (!watching()) return null;
if (rules && Date.now() - rules.at < 300000) return rules.v;
try {
const [r, p, l, mx, cap, pot] = await Promise.all(['resharerBps', 'potBps', 'levelBps', 'rewardMaxCents', 'rewardDailyCap', 'potBalance'].map(f => call(f).then(x => x[0])));
const v = { resharerBps: Number(r), potBps: Number(p), levelBps: l.map(Number), rewardMaxCents: Number(mx), rewardDailyCap: Number(cap), potWei: pot.toString() };
const [r, p, l, mx, cap, pot, pdc] = await Promise.all(['resharerBps', 'potBps', 'levelBps', 'rewardMaxCents', 'rewardDailyCap', 'potBalance', 'potDailyMaxCents'].map(f => call(f).then(x => x[0])));
const v = { resharerBps: Number(r), potBps: Number(p), levelBps: l.map(Number), rewardMaxCents: Number(mx), rewardDailyCap: Number(cap), potWei: pot.toString(), potDailyCents: Number(pdc) };
rules = { at: Date.now(), v }; return v;
} catch (e) { return rules ? rules.v : null; }
}
+3 -3
View File
@@ -1,13 +1,13 @@
// Writes public/*.html from one place (one source of copy + legal facts per site). Run after editing: node tools/pages.mjs
// Copy rules: no em dashes, no income promises ("Ad credits buy advertising, not income."), never an earnings cap,
// wallets = "SafePal or any other crypto wallet", one-time Boosts, never a subscription. Numbers that Marty has not set are
// filled in live from /api/config by the page scripts (data-cfg spans) and labelled as proposals there.
// filled in live from /api/config by the page scripts (data-cfg spans).
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const PUB = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'public');
const SITE = 'https://viraladsource.com';
const V = { css: 1, common: 1, page: 1, chat: 1 };
const V = { css: 1, common: 2, page: 2, chat: 1 };
const F = { co: 'TrustClickz', updated: 'November 16, 2026' };
const FONTS = 'https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap';
const I = n => `<img src="/art/icons/${n}.svg" alt="" width="34" height="34">`;
@@ -223,7 +223,7 @@ page('boost.html', { path: '/boost', nav: '/boost', title: 'Boost your ad | Vira
<h2 style="font-size:28px">Where the POL goes</h2>
<p style="color:var(--ink3)">The VASShop contract splits every Boost in the buyer's own transaction. Nobody holds it.</p>
<div class="tbl"><table><tbody id="splitRows"></tbody></table></div>
<p class="muted" style="font-size:14px">Sponsor levels pay people in your network sponsor line who have bought a Boost; anyone who has not is passed over and the share goes up the line (up to 20 places). A level nobody qualifies for goes to the company. If you did not arrive through someone's reshare link, the resharer share goes to the company.</p>
<p class="muted" style="font-size:14px">A Boost buys placement only. Nobody needs to buy one to earn: sponsor levels pay the 5 nearest people in your network sponsor line who have a network sign-in and a linked wallet. Anyone without one is skipped and the share passes up to the next person who has. Levels left when the line runs out go to the company. If you did not arrive through someone's reshare link, the resharer share goes to the company. The split is fixed in the contract and can never change.</p>
<p class="muted" style="font-size:14px">Pay with SafePal or any other crypto wallet on Polygon. Anything you send above the exact price comes back in the same transaction. A Boost buys advertising, not income.</p>
</div>
</div></section>
+1 -1
View File
@@ -40,7 +40,7 @@ function boostedUntil(adId) {
const isBoosted = adId => boostedUntil(adId) > Date.now();
function attach(rec) {
const a = store.ad(Number(rec.ref)); const own = a && a.owner === rec.buyer && a.status !== 'removed' ? a : store.adOf(rec.buyer);
rec.adId = own ? own.id : null; rec.days = C().boost.days; return rec.adId;
rec.adId = own ? own.id : null; rec.days = rec.days || C().boost.days; return rec.adId;
}
function attachPending(owner, adId) { let n = 0; for (const x of Object.values(store.state().purchases || {})) if (x.buyer === owner && !x.adId) { x.adId = adId; n++; } if (n) store.save(); return n; }
function boostView(b) {