From 5bbb1125ebece69c80e8661c71b92dd5298b24db Mon Sep 17 00:00:00 2001 From: Theodore Song Date: Sun, 12 Jul 2026 16:45:34 -0400 Subject: [PATCH] Add live money readiness controls --- index.html | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 0e8f554..11e47bf 100644 --- a/index.html +++ b/index.html @@ -320,6 +320,7 @@ footer{margin-top:34px;padding-top:22px;border-top:1px solid var(--border);color + + +
+
🔐 Live Money Readiness
+
+
+

Launch checklist

+
+
+
+

User wallet & funds

simulation only
+ +
+ + + + +
+
Real deposits stay locked until eligibility, wallet signing, payment rails, and legal approval are complete.
+
+
+
+

Agent permissions & risk limits

what a live account would allow
+
+
+
+
+

Execution console

locked until backend exists
+
    +
  1. Wallet signature — user signs EIP-712 orders; the site never signs unauthorized trades.
  2. +
  3. CLOB router — backend submits, cancels, and tracks orders through authenticated Polymarket APIs.
  4. +
  5. Fill sync — real positions, cash, unsettled orders, and agent actions reconcile continuously.
  6. +
  7. Emergency controls — user can pause agents, cancel orders, and withdraw available funds any time.
  8. +
+
+
+

Audit trail preview

required for real money
+
+
+
+
+
â„šī¸ The competition
@@ -603,8 +650,9 @@ const PF_SORT_KEY = "pma_portfolio_sort_v1"; const CHART_RANGE_KEY = "pma_chart_range_v1"; const INVEST_KEY = "pma_invest_allocations_v1"; const PAPER_KEY = "pma_paper_accounts_v1"; +const LIVE_KEY = "pma_live_readiness_v1"; const CATEGORIES = ["All","Politics","Sports","Crypto","Economy","Pop Culture","Other"]; -const SYNC_KEYS=[AGENTS_KEY,SUG_KEY,FOCUS_KEY,VIEW_KEY,PF_SORT_KEY,CHART_RANGE_KEY,INVEST_KEY,PAPER_KEY]; +const SYNC_KEYS=[AGENTS_KEY,SUG_KEY,FOCUS_KEY,VIEW_KEY,PF_SORT_KEY,CHART_RANGE_KEY,INVEST_KEY,PAPER_KEY,LIVE_KEY]; const CAT_COLORS = {Politics:"#fb7185",Sports:"#34d399",Crypto:"#fbbf24",Economy:"#7c8cff", "Pop Culture":"#c77dff",Other:"#94a1bb",All:"#7c8cff",Copy:"#22d3ee"}; const DATA_API = "https://data-api.polymarket.com"; @@ -1420,7 +1468,7 @@ function board(){ const MEDALS=["đŸĨ‡","đŸĨˆ","đŸĨ‰"]; /* ---------- Rendering ---------- */ -function renderAll(){renderOverview();renderLeaderboard();renderSuggestions();renderPortfolioTab();renderInvestTab();renderPaperTab();renderAbout();} +function renderAll(){renderOverview();renderLeaderboard();renderSuggestions();renderPortfolioTab();renderInvestTab();renderPaperTab();renderLiveMoneyTab();renderAbout();} function renderOverview(){ const b=board(); const lead=b[0]; @@ -2158,10 +2206,68 @@ function renderAbout(){ root.innerHTML=AGENTS.map(a=>`
${a.emoji}

${a.name}

${agentBlurb(a,st)}

`).join(""); } +const LIVE_CHECKS=[ + ["eligibility","KYC / eligibility provider selected"], + ["jurisdiction","Jurisdiction rules and geoblocking defined"], + ["wallet","Wallet or deposit-wallet connection designed"], + ["payments","Deposit and withdrawal provider selected"], + ["clob","Polymarket CLOB order router backend planned"], + ["audit","Immutable audit log for signals, orders, fills, and withdrawals"], + ["risk","User risk limits and emergency pause controls"], + ["legal","Legal review and terms approved"], +]; +function defaultLiveState(){ + const checks={};LIVE_CHECKS.forEach(([k])=>checks[k]=false); + const agents={};AGENTS.forEach(a=>agents[a.id]={enabled:false,maxAllocation:0,maxPositionPct:10,autoTrade:false,manualApprove:true}); + return {checks,walletAddress:"",jurisdiction:"",depositLimit:0,withdrawReserve:0,agents,audit:[]}; +} +function loadLiveState(){ + let s;try{s=JSON.parse(localStorage.getItem(LIVE_KEY));}catch(e){s=null;} + if(!s||!s.checks)s=defaultLiveState(); + LIVE_CHECKS.forEach(([k])=>{if(!(k in s.checks))s.checks[k]=false;}); + if(!s.agents)s.agents={}; + AGENTS.forEach(a=>{if(!s.agents[a.id])s.agents[a.id]={enabled:false,maxAllocation:0,maxPositionPct:10,autoTrade:false,manualApprove:true};}); + if(!s.audit)s.audit=[]; + return s; +} +function saveLiveState(s,detail){ + if(detail)s.audit.push({at:nowIso(),detail}); + s.audit=s.audit.slice(-80); + localStorage.setItem(LIVE_KEY,JSON.stringify(s)); + pushCloudState(); +} +function renderLiveMoneyTab(){ + const root=$("liveChecklist");if(!root)return; + const s=loadLiveState(),done=LIVE_CHECKS.filter(([k])=>s.checks[k]).length; + $("liveReadyPct").textContent=`${done}/${LIVE_CHECKS.length} ready`; + root.innerHTML=LIVE_CHECKS.map(([k,label])=>``).join(""); + $("liveWalletAddress").value=s.walletAddress||""; + $("liveJurisdiction").value=s.jurisdiction||""; + $("liveDepositLimit").value=s.depositLimit||""; + $("liveWithdrawReserve").value=s.withdrawReserve||""; + $("liveAgentPermissions").innerHTML=AGENTS.map(a=>{const p=s.agents[a.id]; + return `
+
${a.emoji}
+
${esc(a.name)}
${esc(a.blurb.slice(0,120))}${a.blurb.length>120?"...":""}
+
+ + + + +
+
`; + }).join(""); + const audit=s.audit.slice(-10).reverse(); + $("liveAuditTrail").innerHTML=audit.length?audit.map(x=>`
${new Date(x.at).toLocaleString()} — ${esc(x.detail)}
`).join(""):`
No readiness changes logged yet.
`; + document.querySelectorAll("[data-live-check]").forEach(el=>el.onchange=()=>{const next=loadLiveState();next.checks[el.dataset.liveCheck]=el.checked;saveLiveState(next,`${el.checked?"Completed":"Reopened"}: ${LIVE_CHECKS.find(([k])=>k===el.dataset.liveCheck)[1]}`);renderLiveMoneyTab();}); + document.querySelectorAll("[data-live-agent]").forEach(el=>el.onchange=()=>{const next=loadLiveState(),p=next.agents[el.dataset.liveAgent],field=el.dataset.field;p[field]=el.type==="checkbox"?el.checked:Number(el.value||0);saveLiveState(next,`Updated ${agentById(el.dataset.liveAgent).name} permission: ${field}`);renderLiveMoneyTab();}); +} function esc(s){return String(s).replace(/[&<>"]/g,c=>({"&":"&","<":"<",">":">",'"':"""}[c]));} /* ---------- Tab routing ---------- */ -const TABS=["overview","leaderboard","suggestions","portfolio","invest","paper","about"]; +const TABS=["overview","leaderboard","suggestions","portfolio","invest","paper","live","about"]; function showTab(name){ if(!TABS.includes(name))name="overview"; document.querySelectorAll(".tabpanel").forEach(p=>p.classList.toggle("active",p.dataset.tab===name)); @@ -2245,6 +2351,15 @@ $("paperSignOutBtn").addEventListener("click",()=>{ sessionStorage.removeItem(unlockKey(acct.id)); renderPaperTab();toast("Signed out of paper account."); }); +$("saveLiveProfileBtn").addEventListener("click",()=>{ + const s=loadLiveState(); + s.walletAddress=$("liveWalletAddress").value.trim(); + s.jurisdiction=$("liveJurisdiction").value; + s.depositLimit=Number($("liveDepositLimit").value||0); + s.withdrawReserve=Number($("liveWithdrawReserve").value||0); + saveLiveState(s,"Updated live-money wallet/funds profile"); + renderLiveMoneyTab();toast("Live-money readiness profile saved."); +}); window.addEventListener("focus",()=>refreshFromCloudAndRender(true)); document.addEventListener("visibilitychange",()=>{ if(!document.hidden)refreshFromCloudAndRender(true);