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:
@@ -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() {
|
||||
|
||||
@@ -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(() => {});
|
||||
|
||||
@@ -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>']
|
||||
];
|
||||
|
||||
@@ -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>';
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user