From 608ec6547b61d8be256b82980eb1150e0219c83e Mon Sep 17 00:00:00 2001 From: martbost Date: Tue, 17 Nov 2026 05:19:56 -0600 Subject: [PATCH] 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 --- .env.example | 3 ++- README.md | 19 +++++++++++++------ chatbot.js | 10 +++++----- config.js | 20 ++++++++++++-------- proof.js | 6 +++--- public/ad.html | 4 ++-- public/admin.html | 4 ++-- public/assets/boost.js | 6 +++--- public/assets/common.js | 7 +++---- public/assets/contract.js | 10 +++++----- public/assets/ledger.js | 2 +- public/assets/wallet.js | 2 +- public/boost.html | 10 +++++----- public/confirm.html | 4 ++-- public/contract.html | 4 ++-- public/disclaimer.html | 4 ++-- public/index.html | 4 ++-- public/join.html | 4 ++-- public/ledger.html | 4 ++-- public/my.html | 6 +++--- public/privacy.html | 4 ++-- public/promote.html | 4 ++-- public/rewards.html | 4 ++-- public/terms.html | 4 ++-- qa/e2e.mjs | 21 +++++++++++++-------- server.js | 3 +++ shop.js | 24 ++++++++++++++---------- tools/pages.mjs | 6 +++--- wire.js | 2 +- 29 files changed, 114 insertions(+), 91 deletions(-) diff --git a/.env.example b/.env.example index 9ae08a4..398eafd 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/README.md b/README.md index ba1c724..80cb330 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/chatbot.js b/chatbot.js index 0e95ef4..fcf7059 100644 --- a/chatbot.js +++ b/chatbot.js @@ -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/; 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'); diff --git a/config.js b/config.js index 28c09fc..98fe5a5 100644 --- a/config.js +++ b/config.js @@ -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 '), 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), diff --git a/proof.js b/proof.js index e8a30cd..8b7baf2 100644 --- a/proof.js +++ b/proof.js @@ -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; diff --git a/public/ad.html b/public/ad.html index 8d49111..df74b88 100644 --- a/public/ad.html +++ b/public/ad.html @@ -36,8 +36,8 @@ - + - + diff --git a/public/admin.html b/public/admin.html index 3af5463..6031bfa 100644 --- a/public/admin.html +++ b/public/admin.html @@ -26,8 +26,8 @@

Staging: mark a test member

Staging only. Lets a wallet post and reshare without a real network account.

- + - + diff --git a/public/assets/boost.js b/public/assets/boost.js index 9bc14fb..e4c4918 100644 --- a/public/assets/boost.js +++ b/public/assets/boost.js @@ -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 => '' + r[0] + '' + r[1] + '').join('') + (sp.live ? '' : 'Proposed numbers, not final.'); + 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 => '' + r[0] + '' + r[1] + '').join('') + (sp.live ? '' : 'Launch numbers. The contract is not live yet.'); const live = !!(c.shop && c.shop.live); const qty = () => Number($('qty').value) || 1; async function price() { diff --git a/public/assets/common.js b/public/assets/common.js index 2bf660b..d75a636 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -21,7 +21,7 @@ window.VAS = (function () { + '' + ''; 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(() => {}); diff --git a/public/assets/contract.js b/public/assets/contract.js index 17075e4..19126c4 100644 --- a/public/assets/contract.js +++ b/public/assets/contract.js @@ -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 ? '' + esc(a) + '' : 'not deployed yet') + (note ? '
' + note + '' : ''); 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' : '' + esc(d.error || 'not deployed yet') + ''], ['Sales', d.live ? (d.paused ? 'Paused' : 'Open') + ' · ' + VAS.n(d.orderCount) + ' orders' : 'not open yet'] ]; diff --git a/public/assets/ledger.js b/public/assets/ledger.js index 07433b1..fc793c4 100644 --- a/public/assets/ledger.js +++ b/public/assets/ledger.js @@ -9,7 +9,7 @@ [VAS.n((d.rewards || []).filter(r => r.status === 'paid').length), 'sign-up rewards paid']].map(x => '
' + x[0] + '' + x[1] + '
').join(''); const tx = h => h ? 'verify' : ''; 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('
') || 'none qualified'; + 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('
') || 'no sponsor line'; const co = (r.pays || []).find(p => p.kind === 0); return '' + VAS.when(r.at) + '' + who(r.buyer, r.buyerName) + '' + VAS.usd(r.usdCents) + '
' + pol(r.weiPaid) + '' + (r.resharer ? who(r.resharer.to, r.resharer.name) + '
' + pol(r.resharer.wei) : 'none') + '' + lv + '' + pol(r.potWei) + '' + (co ? pol(co.wei) : '') + '' + tx(r.tx) + ''; diff --git a/public/assets/wallet.js b/public/assets/wallet.js index a382a3f..0c46f4c 100644 --- a/public/assets/wallet.js +++ b/public/assets/wallet.js @@ -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; diff --git a/public/boost.html b/public/boost.html index be0ca5c..56dd78a 100644 --- a/public/boost.html +++ b/public/boost.html @@ -31,15 +31,15 @@

Where the POL goes

The VASShop contract splits every Boost in the buyer's own transaction. Nobody holds it.

-

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.

+

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.

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.

- + - - - + + + diff --git a/public/confirm.html b/public/confirm.html index bc82dc3..84202a0 100644 --- a/public/confirm.html +++ b/public/confirm.html @@ -22,8 +22,8 @@

One moment...

- + - + diff --git a/public/contract.html b/public/contract.html index 1d57f63..4876b42 100644 --- a/public/contract.html +++ b/public/contract.html @@ -27,8 +27,8 @@
  • 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.
  • No proxy, no owner withdrawal of the pot, no self-destruct. The owner is Marty's Tangem hardware wallet.
  • - + - + diff --git a/public/disclaimer.html b/public/disclaimer.html index 86efee0..a88c629 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -23,8 +23,8 @@

    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.

    Any example on this site is an illustration of how the contract splits a payment, not a prediction of what you will receive.

    TrustClickz. Questions: network support.

    - + - + diff --git a/public/index.html b/public/index.html index e17618b..dd99db2 100644 --- a/public/index.html +++ b/public/index.html @@ -108,8 +108,8 @@

    Hunt it on PolHunter

    A find code hides in one of the three "How an ad spreads" steps.

    - + - + diff --git a/public/join.html b/public/join.html index af92aa6..521294b 100644 --- a/public/join.html +++ b/public/join.html @@ -28,8 +28,8 @@ - + - + diff --git a/public/ledger.html b/public/ledger.html index 821077b..45555f5 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -25,8 +25,8 @@

    Sign-up rewards

    WhenResharerKindAmountStatusProof
    No rewards yet.
    - + - + diff --git a/public/my.html b/public/my.html index d13b6f8..2db15fc 100644 --- a/public/my.html +++ b/public/my.html @@ -64,9 +64,9 @@
    - + - - + + diff --git a/public/privacy.html b/public/privacy.html index f5795ef..fd98bd6 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -23,8 +23,8 @@

    Sharing

    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.

    Your choices

    Ask network support to delete your data; the network hub removes it from every network site, except what the blockchain or the law keeps.

    TrustClickz. Questions: network support.

    - + - + diff --git a/public/promote.html b/public/promote.html index 949c4f4..3768aac 100644 --- a/public/promote.html +++ b/public/promote.html @@ -23,8 +23,8 @@
    - + - + diff --git a/public/rewards.html b/public/rewards.html index bcf009f..f1e5a30 100644 --- a/public/rewards.html +++ b/public/rewards.html @@ -50,8 +50,8 @@

    Where to see it

    Your rewards and credits are on My ad tree. Every paid reward and every Boost split is on the public ledger with its Polygon transaction.

    - + - + diff --git a/public/terms.html b/public/terms.html index be813c4..11170de 100644 --- a/public/terms.html +++ b/public/terms.html @@ -27,8 +27,8 @@

    No promise of income

    What you buy is advertising. We do not promise any income, views, sign-ups or results. See the Earnings Disclaimer.

    Changes

    We can change these terms and the program's numbers going forward; a change never alters a payment already made on chain.

    TrustClickz. Questions: network support.

    - + - + diff --git a/qa/e2e.mjs b/qa/e2e.mjs index be7d7aa..b75cf62 100644 --- a/qa/e2e.mjs +++ b/qa/e2e.mjs @@ -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); } diff --git a/server.js b/server.js index 662de66..49ee857 100644 --- a/server.js +++ b/server.js @@ -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; diff --git a/shop.js b/shop.js index 5bf60db..14141ef 100644 --- a/shop.js +++ b/shop.js @@ -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; } } diff --git a/tools/pages.mjs b/tools/pages.mjs index 8d0c159..fd74ba3 100644 --- a/tools/pages.mjs +++ b/tools/pages.mjs @@ -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 => ``; @@ -223,7 +223,7 @@ page('boost.html', { path: '/boost', nav: '/boost', title: 'Boost your ad | Vira

    Where the POL goes

    The VASShop contract splits every Boost in the buyer's own transaction. Nobody holds it.

    -

    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.

    +

    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.

    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.

    diff --git a/wire.js b/wire.js index 8ee2394..242fb5e 100644 --- a/wire.js +++ b/wire.js @@ -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) {