@oracle-agent/oracle 0.28.28 → 0.28.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +10 -3
  2. package/SETUP.md +3 -0
  3. package/dist/assets/skills/bankrbot/SKILL.md +24 -0
  4. package/dist/assets/skills/oracle-agentic-crypto/SKILL.md +39 -0
  5. package/dist/assets/skills/oracle-desk-product/SKILL.md +1 -1
  6. package/dist/assets/skills/oracle-uniswap-v4-hooks/SKILL.md +31 -0
  7. package/dist/assets/skills/oracle-x402/SKILL.md +30 -0
  8. package/dist/bin/desk-server.mjs +28 -26
  9. package/dist/bin/oracle-data-mcp.mjs +26 -12
  10. package/dist/bin/oracle-gateway.mjs +39 -27
  11. package/dist/bin/oracle-mev-arb-shadow.mjs +5 -5
  12. package/dist/bin/oracle-mev-shadow.mjs +5 -5
  13. package/dist/bin/oracle-public-server.mjs +4 -4
  14. package/dist/bin/oracle-route.mjs +15 -15
  15. package/dist/bin/oracle-scan.mjs +11 -11
  16. package/dist/bin/oracle.mjs +4 -3
  17. package/dist/cli/commands/auth.mjs +6 -6
  18. package/dist/cli/commands/chat.mjs +161 -161
  19. package/dist/cli/commands/doctor.mjs +1 -1
  20. package/dist/cli/commands/eval.mjs +138 -139
  21. package/dist/cli/commands/farm.mjs +22 -22
  22. package/dist/cli/commands/follow.mjs +14 -14
  23. package/dist/cli/commands/harness.mjs +4 -4
  24. package/dist/cli/commands/model.mjs +163 -163
  25. package/dist/cli/commands/receipt.mjs +1 -1
  26. package/dist/cli/commands/resolve.mjs +6 -6
  27. package/dist/cli/commands/setup.mjs +23 -23
  28. package/dist/cli/commands/snipe.mjs +24 -0
  29. package/dist/cli/commands/strategy.mjs +3 -3
  30. package/dist/cli/commands/swap.mjs +25 -25
  31. package/dist/cli/commands/venues.mjs +1 -1
  32. package/dist/control/approval-binding.mjs +1 -0
  33. package/dist/control/finality.mjs +1 -0
  34. package/dist/control-plane/index.mjs +6 -0
  35. package/dist/data/desk-data.mjs +27 -25
  36. package/dist/data/names.mjs +2 -2
  37. package/dist/data/providers/farming.mjs +2 -2
  38. package/dist/governance-prepare.mjs +2 -0
  39. package/dist/index.mjs +44 -31
  40. package/dist/local-marketplace.mjs +3 -0
  41. package/dist/local-pack-registry.mjs +3 -0
  42. package/dist/local-signer/runtime.mjs +7 -7
  43. package/dist/local-x402.mjs +3 -0
  44. package/dist/nft/universal-mint-router.mjs +3 -3
  45. package/dist/notifications/index.mjs +3 -0
  46. package/dist/position-health.mjs +2 -0
  47. package/dist/router/index.mjs +2 -2
  48. package/dist/router/prepare-bridge.mjs +2 -2
  49. package/dist/safety-intelligence.mjs +1 -0
  50. package/dist/scanner/index.mjs +3 -3
  51. package/dist/strategy/index.mjs +3 -3
  52. package/dist/task.d.mts +130 -0
  53. package/dist/task.mjs +2 -0
  54. package/dist/tax-lots.mjs +5 -0
  55. package/dist/tenant-rbac.mjs +1 -0
  56. package/dist/workflow-telemetry.mjs +1 -0
  57. package/package.json +17 -2
  58. package/public/agent-connect/index.html +2 -2
  59. package/public/install.sh +2 -2
  60. package/public/oracle-splash/index.html +2 -2
  61. package/public/oracle-splash/install.sh +2 -2
@@ -1,4 +1,4 @@
1
- var B=Object.freeze(["blockNumber","nativeBalance","tokenBalance","resolveToken","resolvePools","scanBlocks","scoreRisk","quote","sellSimulation","prepareUnsignedTx"]),b=Object.freeze({LIVE:"LIVE",CACHED:"CACHED",STALE:"STALE",UNKNOWN:"UNKNOWN",UNAVAILABLE:"UNAVAILABLE"}),m=Object.freeze({PASS:"PASS",CAUTION:"CAUTION",FAIL:"FAIL",UNKNOWN:"UNKNOWN"}),ke=/^0x[0-9a-fA-F]{40}$/;function Ue(t={}){let e=[],r=[];if(!t||typeof t!="object")return{ok:!1,errors:["definition must be an object"],warnings:r};if((!Number.isInteger(t.chainId)||t.chainId<=0)&&e.push("chainId must be a positive integer"),(typeof t.key!="string"||!/^[a-z][a-z0-9-]*$/.test(t.key||""))&&e.push('key must be a lowercase slug (e.g. "base")'),(typeof t.name!="string"||!t.name.trim())&&e.push("name is required"),!Array.isArray(t.rpcEnv)||t.rpcEnv.length===0)e.push("rpcEnv must list at least one environment variable name");else for(let o of t.rpcEnv)(typeof o!="string"||!/^[A-Z][A-Z0-9_]*$/.test(o))&&e.push(`rpcEnv entry "${o}" should be an UPPER_SNAKE env var name`);if(t.nativeCurrency){let o=t.nativeCurrency;(typeof o.symbol!="string"||!o.symbol)&&e.push("nativeCurrency.symbol is required when nativeCurrency is set"),Number.isInteger(o.decimals)||e.push("nativeCurrency.decimals must be an integer")}for(let[o,n]of(t.venues||[]).entries()){let s=`venues[${o}]`;if(!n||typeof n!="object"){e.push(`${s} must be an object`);continue}ke.test(n.address||"")||e.push(`${s}.address is not a valid 20-byte address`),/^0x0{40}$/.test(n.address||"")&&e.push(`${s}.address is the zero address -- placeholder left in place?`),n.kind||e.push(`${s}.kind is required (router|quoter|factory|...)`),n.verified?(n.verified.method||e.push(`${s}.verified.method is required`),n.verified.source||e.push(`${s}.verified.source is required`),n.verified.date||r.push(`${s}.verified.date missing -- add one so staleness is visible`)):e.push(`${s} must record verification: { verified: { method, source, date } }. An unverified venue stays blocked.`)}let a=t.capabilities||{};for(let o of Object.keys(a))B.includes(o)?typeof a[o]!="function"&&e.push(`capability "${o}" must be a function`):e.push(`unknown capability "${o}"`);return Object.keys(a).length===0&&r.push("scanner implements no capabilities -- it can only be registered, not used"),a.prepareUnsignedTx&&!a.quote&&r.push("prepareUnsignedTx without quote: no priced expectation to validate the built tx against"),a.prepareUnsignedTx&&!a.sellSimulation&&r.push("prepareUnsignedTx without sellSimulation: cannot prove an asset is exitable before buying"),{ok:e.length===0,errors:e,warnings:r}}function Te(t){let{ok:e,errors:r,warnings:a}=Ue(t);if(!e)throw new Error(`invalid scanner for ${t?.key??"<unknown>"}:
1
+ var O=Object.freeze(["blockNumber","nativeBalance","tokenBalance","resolveToken","resolvePools","scanBlocks","scoreRisk","quote","sellSimulation","prepareUnsignedTx"]),y=Object.freeze({LIVE:"LIVE",CACHED:"CACHED",STALE:"STALE",UNKNOWN:"UNKNOWN",UNAVAILABLE:"UNAVAILABLE"}),m=Object.freeze({PASS:"PASS",CAUTION:"CAUTION",FAIL:"FAIL",UNKNOWN:"UNKNOWN"}),Re=/^0x[0-9a-fA-F]{40}$/;function Be(t={}){let e=[],r=[];if(!t||typeof t!="object")return{ok:!1,errors:["definition must be an object"],warnings:r};if((!Number.isInteger(t.chainId)||t.chainId<=0)&&e.push("chainId must be a positive integer"),(typeof t.key!="string"||!/^[a-z][a-z0-9-]*$/.test(t.key||""))&&e.push('key must be a lowercase slug (e.g. "base")'),(typeof t.name!="string"||!t.name.trim())&&e.push("name is required"),!Array.isArray(t.rpcEnv)||t.rpcEnv.length===0)e.push("rpcEnv must list at least one environment variable name");else for(let a of t.rpcEnv)(typeof a!="string"||!/^[A-Z][A-Z0-9_]*$/.test(a))&&e.push(`rpcEnv entry "${a}" should be an UPPER_SNAKE env var name`);if(t.nativeCurrency){let a=t.nativeCurrency;(typeof a.symbol!="string"||!a.symbol)&&e.push("nativeCurrency.symbol is required when nativeCurrency is set"),Number.isInteger(a.decimals)||e.push("nativeCurrency.decimals must be an integer")}for(let[a,n]of(t.venues||[]).entries()){let s=`venues[${a}]`;if(!n||typeof n!="object"){e.push(`${s} must be an object`);continue}Re.test(n.address||"")||e.push(`${s}.address is not a valid 20-byte address`),/^0x0{40}$/.test(n.address||"")&&e.push(`${s}.address is the zero address -- placeholder left in place?`),n.kind||e.push(`${s}.kind is required (router|quoter|factory|...)`),n.verified?(n.verified.method||e.push(`${s}.verified.method is required`),n.verified.source||e.push(`${s}.verified.source is required`),n.verified.date||r.push(`${s}.verified.date missing -- add one so staleness is visible`)):e.push(`${s} must record verification: { verified: { method, source, date } }. An unverified venue stays blocked.`)}let o=t.capabilities||{};for(let a of Object.keys(o))O.includes(a)?typeof o[a]!="function"&&e.push(`capability "${a}" must be a function`):e.push(`unknown capability "${a}"`);return Object.keys(o).length===0&&r.push("scanner implements no capabilities -- it can only be registered, not used"),o.prepareUnsignedTx&&!o.quote&&r.push("prepareUnsignedTx without quote: no priced expectation to validate the built tx against"),o.prepareUnsignedTx&&!o.sellSimulation&&r.push("prepareUnsignedTx without sellSimulation: cannot prove an asset is exitable before buying"),{ok:e.length===0,errors:e,warnings:r}}function Pe(t){let{ok:e,errors:r,warnings:o}=Be(t);if(!e)throw new Error(`invalid scanner for ${t?.key??"<unknown>"}:
2
2
  - ${r.join(`
3
- - `)}`);let o=t.capabilities||{},n=B.filter(c=>typeof o[c]=="function"),s={key:t.key,chainId:t.chainId,name:t.name,rpcEnv:[...t.rpcEnv],nativeCurrency:t.nativeCurrency?{...t.nativeCurrency}:null,wrappedNative:t.wrappedNative||null,explorer:t.explorer||null,venues:(t.venues||[]).map(c=>({...c})),warnings:a,capabilities(){return{chainId:t.chainId,key:t.key,supported:[...n],unsupported:B.filter(c=>!n.includes(c))}},supports(c){return n.includes(c)}};for(let c of B)n.includes(c)?s[c]=async(...d)=>o[c](...d,{scanner:s}):s[c]=async()=>{throw new Error(`${t.key} (chain ${t.chainId}) does not implement "${c}". Supported: ${n.join(", ")||"none"}. An unimplemented capability is absent, not assumed -- implement it or treat this chain as fail-closed for that operation.`)};return Object.freeze(s)}var q=new Map;function j(t){let e=Te(t);return q.set(e.chainId,e),e}function pt(t){return q.get(Number(t))||null}function ht(){return[...q.values()]}function ft(){q.clear()}function mt(){let t={};for(let e of q.values())t[e.chainId]={key:e.key,name:e.name,...e.capabilities(),venueCount:e.venues.length,failClosed:e.venues.length===0};return{generatedAt:new Date().toISOString(),chainCount:q.size,capabilities:[...B],chains:t}}import{createHash as Be}from"node:crypto";import _ from"node:net";import _e from"node:dns";var Re=new Set(["localhost","metadata.google.internal","metadata.goog"]);function V(t){let e=String(t).toLowerCase().split("%")[0];if((e.match(/::/g)||[]).length>1)return null;let r=u=>{if(!u)return[];let i=u.split(":"),p=i.at(-1);if(p?.includes(".")){let h=p.split(".").map(Number);if(h.length!==4||h.some(f=>!Number.isInteger(f)||f<0||f>255))return null;i.splice(i.length-1,1,(h[0]<<8|h[1]).toString(16),(h[2]<<8|h[3]).toString(16))}return i.some(h=>!/^[0-9a-f]{1,4}$/.test(h))?null:i.map(h=>Number.parseInt(h,16))},[a,o]=e.split("::"),n=r(a),s=r(o);if(!n||!s)return null;let c=e.includes("::"),d=8-n.length-s.length;if(!c&&d!==0||c&&d<1)return null;let l=[...n,...Array(Math.max(0,d)).fill(0),...s];return l.length!==8?null:Uint8Array.from(l.flatMap(u=>[u>>8,u&255]))}function W(t,e,r){let a=Math.floor(r/8),o=r%8;for(let s=0;s<a;s+=1)if(t[s]!==e[s])return!1;if(!o)return!0;let n=255<<8-o;return(t[a]&n)===(e[a]&n)}function K(t){if(_.isIPv4(t)){let e=t.split(".").map(Number);return!(e[0]===0||e[0]===10||e[0]===127||e[0]>=224||e[0]===100&&e[1]>=64&&e[1]<=127||e[0]===169&&e[1]===254||e[0]===172&&e[1]>=16&&e[1]<=31||e[0]===192&&(e[1]===0||e[1]===2||e[1]===168)||e[0]===192&&e[1]===88&&e[2]===99||e[0]===198&&(e[1]===18||e[1]===19||e[1]===51)||e[0]===203&&e[1]===0&&e[2]===113)}if(_.isIPv6(t)){let e=V(t);if(!e)return!1;let r=V("::ffff:0:0");return W(e,r,96)?K([...e.slice(12)].join(".")):W(e,V("2000::"),3)?![["2001::",23],["2001:db8::",32],["2001:10::",28],["2001:2::",48],["2002::",16],["3fff::",20]].some(([o,n])=>W(e,V(o),n)):!1}return!1}function Le(t){let e;try{e=new URL(String(t))}catch{return{ok:!1,error:`not a valid URL: ${String(t).slice(0,120)}`}}if(e.protocol!=="http:"&&e.protocol!=="https:")return{ok:!1,error:`refused protocol ${e.protocol} (only http/https)`};let r=e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,"");if(Re.has(r)||r.endsWith(".localhost")||r.endsWith(".internal"))return{ok:!1,error:`refused internal host ${r}`};let a=_.isIP(r);return a!==0&&!K(r)?{ok:!1,error:`refused private address ${r}`}:{ok:!0,url:e,host:r,isLiteralIp:a!==0}}async function z(t,{lookupFn:e=_e.promises.lookup}={}){let r=Le(t);if(!r.ok)return r;if(r.isLiteralIp)return{ok:!0,url:r.url,addresses:[{address:r.host,family:_.isIPv6(r.host)?6:4}]};let a;try{a=await e(r.host,{all:!0,verbatim:!0})}catch{return{ok:!1,error:`refused: ${r.host} did not resolve`}}return!Array.isArray(a)||a.length===0||a.some(o=>!K(o.address))?{ok:!1,error:`refused: ${r.host} resolves to a non-public address`}:{ok:!0,url:r.url,addresses:a}}async function G({requireUndici:t=!1,importUndici:e=()=>import("undici")}={}){let r,a;try{let i=await e();r=i.Agent,a=i.fetch}catch(i){if(t)throw new Error(`egress-guard: untrustedUrl pinning requires the undici package, which failed to load: ${i?.message||i}`);return null}if(typeof r!="function"||typeof a!="function"){if(t)throw new Error("egress-guard: untrustedUrl pinning requires undici's Agent and fetch exports, which were not found on the imported module");return null}let o=i=>String(i).toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,""),n=new Map,s=i=>(Array.isArray(i)?i:[i]).map(p=>typeof p=="string"?{address:p}:p).filter(p=>p&&p.address).map(p=>({address:p.address,family:p.family||(_.isIPv6(p.address)?6:4)})),c=(i,p,h)=>{n.set(o(i),s(typeof p=="string"?[{address:p,family:h}]:p))},d=i=>{let p=o(i);if(_.isIP(p))return[{address:p,family:_.isIPv6(p)?6:4}];let h=n.get(p);if(!h||!h.length)throw new Error(`refused: unpinned host ${i} during pinned fetch`);return h},l=new r({connect:{lookup(i,p,h){let f;try{f=d(i)}catch(v){return h(v)}return p?.all?h(null,f):h(null,f[0].address,f[0].family)}}}),u=qe((i,p={})=>a(i,{...p,dispatcher:l}),c);return{dispatcher:l,fetch:u,pin:c,resolve:d,async close(){try{await l.destroy()}catch{}}}}var Y=Symbol.for("oracle.egressGuard.pinCapableFetch");function qe(t,e){if(typeof t!="function")throw new Error("markPinCapableFetch: fetchImpl must be a function");if(typeof e!="function")throw new Error("markPinCapableFetch: pin must be a function");return t[Y]=Object.freeze({pin:e}),t}function Q(t){return typeof t=="function"&&typeof t[Y]?.pin=="function"}function oe(t,e,r){if(!Q(t))throw new Error("pinFetchToAddresses: fetchImpl is not pin-capable");t[Y].pin(e,r)}var Pe=new Set([408,425,429,500,502,503,504]),ie=new Set(["GET","HEAD","OPTIONS","PUT","DELETE"]),$e=2,se=4e3,de=["authorization","x-api-key","x-tensor-api-key","0x-api-key","api-key","cookie","proxy-authorization"],Oe=new Set([301,302,303,307,308]),ce=3,Fe=64*1024;function De(t){let e=String(t||"").toLowerCase();return de.includes(e)||/(^|-)(api[-_]?key|key|token|secret|auth|authorization|session|cookie|signature|access)(-|$)/.test(e)}function Ve(t){let e={};for(let[r,a]of Object.entries(t||{}))De(r)||(e[r]=a);return e}function He(t,e){if(!t)throw new Error(`HTTP redirect from ${e} missing Location`);let r=new URL(String(t),String(e));if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error(`HTTP redirect from ${e} used unsupported protocol ${r.protocol}`);return r.toString()}function Me(t,e){return new URL(String(t)).origin===new URL(String(e)).origin}var X=new Map;function je(t,e,r,a={}){let o={};for(let[u,i]of Object.entries(r||{}))o[u.toLowerCase()]=i;let n=Object.keys(o).filter(u=>/(^|-)(api[-_]?key|key|token|secret|auth|authorization|session|cookie|signature|access)(-|$)/.test(u)),c=[...new Set([...de,...n])].sort().map(u=>`${u}=${o[u]??""}`).join(`
4
- `),d=Be("sha256").update(c).digest("hex").slice(0,32),l=`${a.untrustedUrl?"untrusted":"trusted"}:${a.maxResponseBytes??"unbounded"}`;return`${t} ${e} ${l} ${d}`}function We(t,e){let r=Number(e);return Number.isFinite(r)&&r>0?Math.min(r*1e3,se):Math.min(250*2**t,se)+Math.floor(Math.random()*100)}var Ke=t=>new Promise(e=>setTimeout(e,t));function P(t,e={}){let r=new Error(t);return r.retryable=!1,Object.assign(r,e),r}function J(t,e,r){return P(`HTTP response from ${t} exceeded maxResponseBytes ${r} (${e})`,{oversize:!0})}function $(t){try{let e=t?.body?.cancel?.();e&&typeof e.then=="function"&&e.catch(()=>{})}catch{}}function ze(t){return t?t.byteLength??t.length??0:0}async function ue(t,e,{url:r,truncate:a=!1,onOversize:o}={}){if(e==null)return await t.text();let n=Number(t.headers?.get?.("content-length"));if(Number.isFinite(n)&&n>e&&($(t),!a))throw J(r,`content-length ${n}`,e);let s=t.body?.getReader?.();if(!s){let i=await t.text(),p=Buffer.byteLength(i,"utf8");if(p>e){if(!a)throw J(r,`body ${p} bytes`,e);return Buffer.from(i,"utf8").subarray(0,e).toString("utf8")}return i}let c=[],d=0,l=!1;try{for(;;){let{value:i,done:p}=await s.read();if(p)break;if(i&&(c.push(Buffer.from(i)),d+=ze(i),d>e)){l=!0;break}}}finally{if(l)try{await s.cancel()}catch{}try{s.releaseLock?.()}catch{}}if(l&&(typeof o=="function"&&o(),!a))throw J(r,`streamed ${d} bytes`,e);let u=Buffer.concat(c);return(l?u.subarray(0,e):u).toString("utf8")}function le(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function Ge(t,{fetchImpl:e,method:r,headers:a,body:o,timeoutMs:n,lookupFn:s,realFetch:c,untrustedUrl:d=!1,maxResponseBytes:l=null,importUndici:u,validateResponse:i}){let p=new AbortController,h=setTimeout(()=>p.abort(),n),f=null,v=e,w=s?{lookupFn:s}:{};if(d&&!c&&!Q(v))throw P(`HTTP refused ${t}: untrustedUrl requires a pin-capable fetchImpl (see markPinCapableFetch in egress-guard.mjs) or no fetchImpl override so Oracle can pin the connection itself`);let C=async(y,{status:E=null}={})=>{let I=await z(y,w);if(!I.ok)throw P(E==null?`HTTP refused ${y}: ${I.error}`:`HTTP redirect to ${y} ${I.error}`,E==null?{}:{status:E});let g=new URL(y).hostname;if(c){if(f&&(await f.close(),f=null),!f)try{f=await G({requireUndici:!0,...u?{importUndici:u}:{}})}catch(S){throw P(E==null?`HTTP refused ${y}: ${S?.message||S}`:`HTTP redirect to ${y} refused: ${S?.message||S}`,E==null?{}:{status:E})}f.pin(g,I.addresses),v=f.fetch}else oe(v,g,I.addresses);return I};try{let y=String(t),E={...a||{}};d&&await C(y);for(let I=0;I<=ce;I+=1){let g=await v(y,{method:r,headers:E,body:o,signal:p.signal,redirect:"manual"});if(Oe.has(g.status)){if(r!=="GET"&&r!=="HEAD"){let k=await ue(g,l??Fe,{url:y,truncate:!0}),T=new Error(`HTTP ${g.status} ${r} ${y} redirected non-idempotent request`);throw T.status=g.status,T.body=le(k)??k.slice(0,300),T}if(I===ce)throw $(g),new Error(`HTTP redirect loop for ${t}`);let A=g.headers?.get?.("location"),U;try{U=He(A,y)}catch(k){throw $(g),k}let D=!Me(U,y);if($(g),D&&(E=Ve(E)),d)await C(U,{status:g.status});else if(D){let k=await z(U,w);if(!k.ok){let T=new Error(`HTTP redirect from ${y} ${k.error}`);throw T.status=g.status,T.retryable=!1,T}c&&k.addresses?.length&&(f||(f=await G(u?{importUndici:u}:{})),f&&(f.pin(new URL(U).hostname,k.addresses),v=f.fetch))}y=U;continue}if(typeof i=="function")try{await i(g,{url:y})}catch(A){throw $(g),P(A?.message||String(A))}let S=await ue(g,l,{url:y,onOversize:()=>p.abort()}),L=le(S);if(!g.ok){let A=new Error(`HTTP ${g.status} ${r} ${y}`);throw A.status=g.status,A.retryAfter=g.headers?.get?.("retry-after")??null,A.body=L??S.slice(0,300),A}return L??S}throw new Error(`HTTP redirect loop for ${t}`)}finally{clearTimeout(h),f&&await f.close()}}async function H(t,e={}){let r=e.fetchImpl||globalThis.fetch;if(typeof r!="function")throw new Error("fetch unavailable \u2014 pass opts.fetchImpl");let a=e.timeoutMs??12e3,o=(e.method||"GET").toUpperCase(),n={Accept:"application/json",...e.headers||{}},s=e.body;s!=null&&typeof s!="string"&&(n["Content-Type"]=n["Content-Type"]||"application/json",s=JSON.stringify(s));let c=Number.isInteger(e.retries)?Math.max(e.retries,0):$e,d=e.lookupFn,l=!e.fetchImpl,u=e.untrustedUrl===!0,i=e.importUndici,p=e.validateResponse,h=Number(e.maxResponseBytes),f=Number.isFinite(h)&&h>0?Math.floor(h):null,v=async()=>{let I;for(let g=0;g<=c;g++)try{return await Ge(t,{fetchImpl:r,method:o,headers:n,body:s,timeoutMs:a,lookupFn:d,realFetch:l,untrustedUrl:u,maxResponseBytes:f,importUndici:i,validateResponse:p})}catch(S){I=S;let L=S?.status,A=S?.name==="AbortError",U=new Set([408,425,429]),D=S?.retryable===!1?!1:L!=null?U.has(L)||Pe.has(L)&&ie.has(o):!A&&ie.has(o);if(g===c||!D)throw S;await Ke(We(g,S?.retryAfter))}throw I};if(!(e.dedupe!==!1&&o==="GET"&&s==null))return v();let C=je(o,t,n,{untrustedUrl:u,maxResponseBytes:f}),y=X.get(C);if(y)return y;let E=v().finally(()=>X.delete(C));return X.set(C,E),E}var pe={robinhood:{chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC"],evm:!0},ethereum:{chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],evm:!0},polygon:{chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],evm:!0},arbitrum:{chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],evm:!0},base:{chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],evm:!0},hyperevm:{chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],evm:!0},bsc:{chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],evm:!0},avalanche:{chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],evm:!0},optimism:{chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],evm:!0},abstract:{chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],evm:!0},stable:{chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],evm:!0}},Ye=new Map(Object.values(pe).map(t=>[t.chainId,t]));function he(t){return Ye.get(Number(t))||null}function fe(t,e=process.env){let r=he(t);if(!r)return null;for(let a of r.rpcEnv){let o=(e[a]||"").trim();if(o)return o}return null}import{Interface as Qe,getAddress as Xe}from"ethers";var me=new Qe(["function allowance(address owner,address spender) view returns (uint256)","function balanceOf(address account) view returns (uint256)"]);function be(t,e){try{return Xe(t).toLowerCase()}catch{throw new Error(`${e} must be a valid EVM address`)}}var Je={1:"https://ethereum.publicnode.com",137:"https://polygon-bor-rpc.publicnode.com",42161:"https://arbitrum-one-rpc.publicnode.com",8453:"https://base-rpc.publicnode.com",10:"https://optimism-rpc.publicnode.com",988:"https://rpc.stable.xyz",56:"https://bsc-rpc.publicnode.com",43114:"https://avalanche-c-chain-rpc.publicnode.com",999:"https://rpc.hyperliquid.xyz/evm",2741:"https://api.mainnet.abs.xyz",4663:"https://rpc.mainnet.chain.robinhood.com"};function Ze(t,{rpcUrl:e,env:r=process.env}={}){if(e)return e;let a=fe(t,r);return a||Je[Number(t)]||null}var et=/^(?:eth_(?:call|blocknumber|chainid|get[a-z0-9]+|feehistory|gasprice|maxpriorityfeepergas|syncing|protocolversion|estimategas|createaccesslist)|net_(?:version|listening|peercount)|web3_(?:clientversion|sha3))$/;function tt(t){let e=String(t||""),r=e.toLowerCase();if(e!==e.trim()||!/^[a-zA-Z0-9_]+$/.test(e)||!et.test(r))throw new Error(`evm-rpc: ${e} refused \u2014 @oracle-agent/oracle is prepare-only (read RPC only; no broadcast/sign)`);return r}async function N(t,e,r=[],a={}){let o=String(e||"");tt(o);let n=Ze(t,a);if(!n)throw new Error(`No RPC URL for chainId ${t} (set env from chain registry rpcEnv or pass rpcUrl)`);let c=await H(n,{method:"POST",body:{jsonrpc:"2.0",id:1,method:e,params:r},fetchImpl:a.fetchImpl,timeoutMs:a.timeoutMs??12e3});if(c?.error){let d=new Error(c.error.message||JSON.stringify(c.error));throw d.code=c.error.code,d}return c.result}async function ve(t,e={}){let r=await N(t,"eth_blockNumber",[],e);return parseInt(r,16)}async function ye(t,e,r={}){if(!e)throw new Error("rpcGetBalance requires address");let a=await N(t,"eth_getBalance",[e,"latest"],r);return{chainId:Number(t),address:e,balanceWei:BigInt(a).toString(),balanceHex:a}}async function ge(t={},e={}){let r=Number(t.chainId??e.chainId??1),a=be(t.token||t.tokenAddress,"token"),o=be(t.account||t.owner||t.address,"account"),n=me.encodeFunctionData("balanceOf",[o]),s=await N(r,"eth_call",[{to:a,data:n},t.blockTag||"latest"],e),c=me.decodeFunctionResult("balanceOf",s),d=BigInt(c[0]);return{chainId:r,token:a,account:o,balance:d.toString(),balanceHex:`0x${d.toString(16)}`,blockTag:t.blockTag||"latest"}}var rt="https://api.dexscreener.com",Tt=Object.freeze({1:"ethereum",10:"optimism",56:"bsc",137:"polygon",8453:"base",42161:"arbitrum",43114:"avalanche",999:"hyperevm",4663:"robinhood"});function nt(t={}){return(t.baseUrl||process.env.DEXSCREENER_API_URL||rt).replace(/\/$/,"")}async function we(t,e={}){if(!t)throw new Error("tokenAddress required");return H(`${nt(e)}/latest/dex/tokens/${t}`,{fetchImpl:e.fetchImpl,timeoutMs:e.timeoutMs??12e3})}var ee={getAmountsOut:"d06ca61f",swapExactTokensForTokens:"38ed1739",swapExactETHForTokens:"7ff36ab5"},x=t=>BigInt(t).toString(16).padStart(64,"0"),O=t=>t.slice(2).toLowerCase().padStart(64,"0");function at(t,e){return`0x${ee.getAmountsOut}`+x(t)+x(64)+x(e.length)+e.map(O).join("")}function ot(t){if(!t||t==="0x")return null;let e=t.slice(2);if(e.length<128)return null;let r=Number(BigInt(`0x${e.slice(64,128)}`));if(!Number.isFinite(r)||r<1||r>16)return null;let a=[];for(let o=0;o<r;o++){let n=128+o*64;if(e.length<n+64)return null;a.push(BigInt(`0x${e.slice(n,n+64)}`))}return a}function Z(t,e="router"){return(t?.venues||[]).find(a=>a.kind===e)?.address??null}var te=100;function it(t,e){let r=Number(e);if(!Number.isFinite(r)||r<0)throw new Error("slippageBps must be a non-negative number");if(r>te)throw new Error(`slippageBps ${r} exceeds the ${te} bps ceiling. Block and requote or split the order -- do not widen the guard to force a fill.`);return BigInt(t)*BigInt(1e4-Math.floor(r))/10000n}function Ee(t){let{chainId:e,wrappedNative:r}=t;async function a(o,n,s,c){let d=await N(e,"eth_call",[{to:o,data:at(n,s)},"latest"],c);return ot(d?.result??d)}return{async quote({tokenIn:o,tokenOut:n,amountIn:s,path:c},d={}){let l=Z(d.scanner);if(!l)return{chainId:e,evidence:b.UNAVAILABLE,reason:"no verified router configured for this chain; quoting stays fail-closed rather than guessing a venue address"};let u=c||[o,n];if(u.some(p=>!/^0x[0-9a-fA-F]{40}$/.test(p||"")))throw new Error("quote requires valid 20-byte addresses");let i=await a(l,s,u,d);return i?{chainId:e,router:l,path:u,amountIn:String(s),amountOut:i[i.length-1].toString(),hops:u.length-1,evidence:b.LIVE,note:"exact-input quote at current reserves; not a guaranteed fill"}:{chainId:e,router:l,path:u,evidence:b.UNKNOWN,reason:"router returned no amounts -- no pool for this path, or the call reverted"}},async sellSimulation({token:o,amountIn:n,base:s},c={}){let d=Z(c.scanner),l=s||r;if(l&&String(o).toLowerCase()===String(l).toLowerCase())return{chainId:e,token:o,verdict:m.UNKNOWN,evidence:b.UNAVAILABLE,reason:"token is the base asset for this chain, so there is nothing to round-trip against. Sellability must be judged against a different quote asset."};if(!d||!l)return{chainId:e,token:o,verdict:m.UNKNOWN,evidence:b.UNAVAILABLE,reason:d?"no wrappedNative configured for this chain, so no base asset to round-trip against":"no verified router configured for this chain"};let u=await a(d,n,[l,o],c);if(!u)return{chainId:e,token:o,verdict:m.FAIL,evidence:b.LIVE,leg:"buy",reason:"buy leg returned no amounts -- no route in"};let i=u[u.length-1];if(i===0n)return{chainId:e,token:o,verdict:m.FAIL,evidence:b.LIVE,leg:"buy",reason:"buy leg quotes zero output"};let p=await a(d,i,[o,l],c);if(!p)return{chainId:e,token:o,verdict:m.FAIL,evidence:b.LIVE,leg:"sell",bought:i.toString(),reason:"SELL LEG FAILED while the buy leg quoted fine. This is the honeypot signature: do not trade."};let h=p[p.length-1],f=Number(h*10000n/BigInt(n)),v=m.PASS,w="round trip completes with expected fee/impact loss";return f<5e3?(v=m.FAIL,w=`round trip returns only ${(f/100).toFixed(2)}% -- punitive tax or no real liquidity`):f<9e3&&(v=m.CAUTION,w=`round trip returns ${(f/100).toFixed(2)}% -- transfer tax or thin liquidity at this size`),{chainId:e,token:o,base:l,router:d,verdict:v,reason:w,amountIn:String(n),bought:i.toString(),returned:h.toString(),retentionBps:f,evidence:b.LIVE,note:"Quote-level round trip. It does not prove transfer hooks absent at execution time."}},async prepareUnsignedTx({tokenIn:o,tokenOut:n,amountIn:s,recipient:c,slippageBps:d=50,deadlineSeconds:l=900,path:u},i={}){let p=i.scanner,h=Z(p);if(!h)throw new Error(`chain ${e} has no verified router; preparing a swap stays fail-closed. Add a venue with recorded provenance first (see docs/adding-a-chain.md).`);if(!/^0x[0-9a-fA-F]{40}$/.test(c||""))throw new Error("prepareUnsignedTx requires a valid recipient address");let f=u||[o,n],v=await this.quote({tokenIn:o,tokenOut:n,amountIn:s,path:f},i);if(v.evidence!==b.LIVE)throw new Error(`cannot prepare without a live quote (${v.evidence}: ${v.reason??"no reason given"})`);let w=it(v.amountOut,d);if(w<=0n)throw new Error("computed minOut is zero -- refusing to prepare");let C=BigInt(Math.floor(Date.now()/1e3)+Number(l)),y=r&&f[0].toLowerCase()===r.toLowerCase()&&i.useNative,E=y?`0x${ee.swapExactETHForTokens}`+x(w)+x(128)+O(c)+x(C)+x(f.length)+f.map(O).join(""):`0x${ee.swapExactTokensForTokens}`+x(s)+x(w)+x(160)+O(c)+x(C)+x(f.length)+f.map(O).join("");return{unsigned:!0,signedBy:"user-wallet",chainId:e,tx:{to:h,data:E,value:y?`0x${BigInt(s).toString(16)}`:"0x0"},guard:{quotedOut:v.amountOut,minOut:w.toString(),slippageBps:d,maxSlippageBps:te,deadline:C.toString()},requires:y?[]:[{step:"approve",token:f[0],spender:h,amount:String(s)}],note:"UNSIGNED. Re-verify the guard against a fresh quote immediately before signing -- a quote-time minimum is not a minimum at broadcast time."}}}}var st=[100,500,3e3,1e4],Se={quoteExactInputSingle:"c6a5026a",exactInputSingle:"04e45aaf"},R=t=>BigInt(t).toString(16).padStart(64,"0"),F=t=>t.slice(2).toLowerCase().padStart(64,"0"),Ie=/^0x[0-9a-fA-F]{40}$/,ne=100;function ct(t,e){let r=Number(e);if(!Number.isFinite(r)||r<0)throw new Error("slippageBps must be a non-negative number");if(r>ne)throw new Error(`slippageBps ${r} exceeds the ${ne} bps ceiling. Block and requote or split the order -- do not widen the guard to force a fill.`);return BigInt(t)*BigInt(1e4-Math.floor(r))/10000n}function re(t,e){return(t?.venues||[]).find(r=>r.kind===e)?.address??null}function Ce(t){let{chainId:e,wrappedNative:r}=t;async function a({quoter:n,tokenIn:s,tokenOut:c,amountIn:d,fee:l},u){let i=`0x${Se.quoteExactInputSingle}`+F(s)+F(c)+R(d)+R(l)+R(0),p=await N(e,"eth_call",[{to:n,data:i},"latest"],u).catch(()=>null),h=p?.result??p;if(!h||h==="0x"||h.length<66)return null;let f=BigInt(`0x${h.slice(2,66)}`);return f>0n?f:null}async function o({quoter:n,tokenIn:s,tokenOut:c,amountIn:d},l){let u=[],i=null;for(let p of st){let h=await a({quoter:n,tokenIn:s,tokenOut:c,amountIn:d,fee:p},l);u.push({fee:p,amountOut:h?h.toString():null}),h&&(!i||h>i.amountOut)&&(i={fee:p,amountOut:h})}return{best:i,tried:u}}return{async quote({tokenIn:n,tokenOut:s,amountIn:c},d={}){let l=re(d.scanner,"quoter");if(!l)return{chainId:e,evidence:b.UNAVAILABLE,reason:"no verified quoter configured for this chain; quoting stays fail-closed rather than guessing a venue address"};for(let p of[n,s])if(!Ie.test(p||""))throw new Error("quote requires valid 20-byte addresses");let{best:u,tried:i}=await o({quoter:l,tokenIn:n,tokenOut:s,amountIn:c},d);return u?{chainId:e,venue:"uniswap-v3",quoter:l,tokenIn:n,tokenOut:s,amountIn:String(c),amountOut:u.amountOut.toString(),fee:u.fee,useNative:!!r&&String(n).toLowerCase()===String(r).toLowerCase(),triedFeeTiers:i,evidence:b.LIVE,note:"exact-input single-hop quote at current tick; not a guaranteed fill"}:{chainId:e,quoter:l,tokenIn:n,tokenOut:s,triedFeeTiers:i,evidence:b.UNKNOWN,reason:"no fee tier returned a quote -- no V3 pool for this pair, or no liquidity"}},async sellSimulation({token:n,amountIn:s,base:c},d={}){let l=re(d.scanner,"quoter"),u=c||r;if(u&&String(n).toLowerCase()===String(u).toLowerCase())return{chainId:e,token:n,verdict:m.UNKNOWN,evidence:b.UNAVAILABLE,reason:"token is the base asset for this chain, so there is nothing to round-trip against. Sellability must be judged against a different quote asset."};if(!l||!u)return{chainId:e,token:n,verdict:m.UNKNOWN,evidence:b.UNAVAILABLE,reason:l?"no wrappedNative configured, so there is no base asset to round-trip against":"no verified quoter configured for this chain"};let i=await o({quoter:l,tokenIn:u,tokenOut:n,amountIn:s},d);if(!i.best)return{chainId:e,token:n,verdict:m.FAIL,evidence:b.LIVE,leg:"buy",reason:"no V3 pool priced the buy leg on any fee tier"};let p=await o({quoter:l,tokenIn:n,tokenOut:u,amountIn:i.best.amountOut},d);if(!p.best)return{chainId:e,token:n,verdict:m.FAIL,evidence:b.LIVE,leg:"sell",bought:i.best.amountOut.toString(),reason:"SELL LEG FAILED while the buy leg quoted fine. This is the honeypot signature: do not trade."};let h=p.best.amountOut,f=Number(h*10000n/BigInt(s)),v=m.PASS,w="round trip completes with expected fee/impact loss";return f<5e3?(v=m.FAIL,w=`round trip returns only ${(f/100).toFixed(2)}% -- punitive tax or no real liquidity`):f<9e3&&(v=m.CAUTION,w=`round trip returns ${(f/100).toFixed(2)}% -- transfer tax or thin liquidity at this size`),{chainId:e,venue:"uniswap-v3",token:n,base:u,verdict:v,reason:w,amountIn:String(s),bought:i.best.amountOut.toString(),returned:h.toString(),retentionBps:f,buyFee:i.best.fee,sellFee:p.best.fee,evidence:b.LIVE,note:"Quote-level round trip. It does not prove transfer hooks absent at execution time."}},async prepareUnsignedTx({tokenIn:n,tokenOut:s,amountIn:c,recipient:d,slippageBps:l=50,fee:u},i={}){let p=re(i.scanner,"router");if(!p)throw new Error(`chain ${e} has no verified V3 router; preparing a swap stays fail-closed. Add a venue with recorded provenance first (see docs/adding-a-chain.md).`);if(!Ie.test(d||""))throw new Error("prepareUnsignedTx requires a valid recipient address");let h=await this.quote({tokenIn:n,tokenOut:s,amountIn:c},i);if(h.evidence!==b.LIVE)throw new Error(`cannot prepare without a live quote (${h.evidence}: ${h.reason??"no reason given"})`);let f=u??h.fee,v=ct(h.amountOut,l);if(v<=0n)throw new Error("computed minOut is zero -- refusing to prepare");let w=!!(i.useNative||h.useNative)&&r&&String(n).toLowerCase()===String(r).toLowerCase(),C=`0x${Se.exactInputSingle}`+F(n)+F(s)+R(f)+F(d)+R(c)+R(v)+R(0);return{unsigned:!0,signedBy:"user-wallet",chainId:e,venue:"uniswap-v3",tx:{to:p,data:C,value:w?String(c):"0x0"},guard:{quotedOut:h.amountOut,minOut:v.toString(),slippageBps:l,maxSlippageBps:ne,fee:f},requires:w?[]:[{step:"approve",token:n,spender:p,amount:String(c)}],note:"UNSIGNED. Re-verify the guard against a fresh quote immediately before signing -- a quote-time minimum is not a minimum at broadcast time."}}}}var M={decimals:"0x313ce567",symbol:"0x95d89b41",name:"0x06fdde03",totalSupply:"0x18160ddd",owner:"0x8da5cb5b"};function xe(t){if(!t||t==="0x")return null;try{return BigInt(t)}catch{return null}}function Ae(t){if(!t||t==="0x")return null;let e=t.slice(2);if(e.length>=128){let a=Number(BigInt(`0x${e.slice(64,128)}`));if(a>0&&a<=256&&e.length>=128+a*2){let o=e.slice(128,128+a*2),n=Buffer.from(o,"hex").toString("utf8").replace(/\0+$/,"");if(n)return n}}return Buffer.from(e.slice(0,64),"hex").toString("utf8").replace(/\0+$/,"")||null}function ut(t){let{chainId:e}=t;async function r(a,o,n){return N(e,"eth_call",[{to:a,data:o},"latest"],n)}return{async blockNumber(a={}){let o=await ve(e,a);return{chainId:e,blockNumber:o?.blockNumber??o,evidence:b.LIVE}},async nativeBalance(a,o={}){let n=await ye(e,a,o);return{chainId:e,address:a,wei:n?.wei??n?.balance??null,symbol:t.nativeCurrency?.symbol??null,decimals:t.nativeCurrency?.decimals??18,evidence:b.LIVE}},async tokenBalance({token:a,owner:o},n={}){let s=await ge({chainId:e,token:a,owner:o},n);return{chainId:e,token:a,owner:o,raw:s?.balance??s,evidence:b.LIVE}},async resolveToken(a,o={}){if(!/^0x[0-9a-fA-F]{40}$/.test(a||""))return{chainId:e,token:a,evidence:b.UNKNOWN,error:"resolveToken needs a 20-byte address; symbol lookup is a market-data concern"};let[n,s,c,d]=await Promise.all([r(a,M.decimals,o).catch(()=>null),r(a,M.symbol,o).catch(()=>null),r(a,M.name,o).catch(()=>null),r(a,M.totalSupply,o).catch(()=>null)]),l=xe(n?.result??n),u=l!==null||s?.result||c?.result;return{chainId:e,address:a,decimals:l===null?null:Number(l),symbol:Ae(s?.result??s),name:Ae(c?.result??c),totalSupply:(xe(d?.result??d)??null)?.toString()??null,evidence:u?b.LIVE:b.UNKNOWN,warning:u?void 0:"no ERC-20 metadata returned -- may not be a token contract"}},async resolvePools(a,o={}){let n=t.dexscreenerSlug;if(!n)return{chainId:e,token:a,pools:[],evidence:b.UNAVAILABLE,reason:"no dexscreenerSlug configured for this chain; pool discovery is unavailable rather than guessed"};let s=await we(a,o).catch(()=>null),d=(s?.pairs||s?.data?.pairs||[]).filter(l=>String(l.chainId).toLowerCase()===String(n).toLowerCase()).map(l=>({pair:l.pairAddress,dex:l.dexId,base:l.baseToken?.address,quote:l.quoteToken?.address,liquidityUsd:l.liquidity?.usd??null,priceUsd:l.priceUsd??null,volume24hUsd:l.volume?.h24??null,createdAt:l.pairCreatedAt??null})).sort((l,u)=>(u.liquidityUsd??0)-(l.liquidityUsd??0));return{chainId:e,token:a,pools:d,evidence:d.length?b.LIVE:b.UNKNOWN}},async scanBlocks({fromBlock:a,toBlock:o,address:n,topics:s,chunkSize:c=2e3}={},d={}){if(!Number.isInteger(a)||!Number.isInteger(o))throw new Error("scanBlocks requires integer fromBlock and toBlock");if(o<a)throw new Error("toBlock must be >= fromBlock");let l=[],u=[];for(let i=a;i<=o;i+=c){let p=Math.min(i+c-1,o);u.push([i,p])}for(let[i,p]of u){let h={fromBlock:`0x${i.toString(16)}`,toBlock:`0x${p.toString(16)}`};n&&(h.address=n),s&&(h.topics=s);let f=await N(e,"eth_getLogs",[h],d).catch(v=>({error:String(v?.message||v)}));if(f?.error)return{chainId:e,fromBlock:a,toBlock:o,logs:l,complete:!1,failedAt:[i,p],error:f.error,evidence:b.UNKNOWN};for(let v of f?.result??f??[])l.push(v)}return{chainId:e,fromBlock:a,toBlock:o,logs:l,complete:!0,chunks:u.length,evidence:b.LIVE}},async scoreRisk(a,o={}){let n=[],s=m.PASS,c=u=>{let i={[m.PASS]:0,[m.CAUTION]:1,[m.UNKNOWN]:2,[m.FAIL]:3};i[u]>i[s]&&(s=u)},d=await this.resolveToken(a,o);d.evidence!==b.LIVE?(n.push({check:"erc20-metadata",result:m.UNKNOWN,detail:d.warning}),c(m.UNKNOWN)):n.push({check:"erc20-metadata",result:m.PASS,detail:`${d.symbol} / ${d.decimals}d`});let l=await this.resolvePools(a,o);if(l.evidence===b.UNAVAILABLE)n.push({check:"liquidity",result:m.UNKNOWN,detail:l.reason}),c(m.UNKNOWN);else if(!l.pools.length)n.push({check:"liquidity",result:m.FAIL,detail:"no pool with liquidity found"}),c(m.FAIL);else{let u=l.pools[0],i=u.liquidityUsd??0;i<5e3?(n.push({check:"liquidity",result:m.CAUTION,detail:`top pool only $${i}`}),c(m.CAUTION)):n.push({check:"liquidity",result:m.PASS,detail:`$${i} on ${u.dex}`}),u.createdAt&&Date.now()-u.createdAt<24*3600*1e3&&(n.push({check:"age",result:m.CAUTION,detail:"pool under 24h old"}),c(m.CAUTION))}if(typeof this.sellSimulation=="function"){let u=await this.sellSimulation({token:a,amountIn:(10n**16n).toString()},o).catch(i=>({verdict:m.UNKNOWN,reason:String(i?.message||i)}));n.push({check:"sellability",result:u.verdict,detail:u.retentionBps!=null?`round trip returns ${(u.retentionBps/100).toFixed(2)}% -- ${u.reason}`:u.reason}),c(u.verdict)}else n.push({check:"sellability",result:m.UNKNOWN,detail:"no verified router on this chain, so a round-trip sell simulation cannot run. Treat as unproven -- a buy path is not an exit path."}),c(m.UNKNOWN);return{chainId:e,token:a,verdict:s,checks:n,note:"Structural checks only. UNKNOWN is not PASS. A token is not tradeable until a sell simulation succeeds."}}}}function ae(t){let r={...ut(t)},a=new Set((t.venues||[]).map(n=>n.kind));t.venueKind==="uniswap-v3"&&a.has("quoter")&&a.has("router")?Object.assign(r,Ce({chainId:t.chainId,wrappedNative:t.wrappedNative})):t.venueKind==="uniswap-v2"&&a.has("router")&&Object.assign(r,Ee({chainId:t.chainId,wrappedNative:t.wrappedNative}));let o={};for(let[n,s]of Object.entries(r))o[n]=s.bind(r);return{key:t.key,chainId:t.chainId,name:t.name,rpcEnv:t.rpcEnv,nativeCurrency:t.nativeCurrency,explorer:t.explorer,venues:t.venues||[],capabilities:o}}var Ne=Object.freeze([{key:"ethereum",chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://etherscan.io",dexscreenerSlug:"ethereum",venueKind:"uniswap-v3",wrappedNative:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.71 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}}]},{key:"optimism",chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://optimistic.etherscan.io",dexscreenerSlug:"optimism",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1905.23 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}}]},{key:"bsc",chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],nativeCurrency:{symbol:"BNB",decimals:18},explorer:"https://bscscan.com",dexscreenerSlug:"bsc",venueKind:"uniswap-v3",wrappedNative:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",venues:[{kind:"quoter",address:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WBNB->USDC fee 500 quoted 413.86 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}},{kind:"router",address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}}]},{key:"polygon",chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],nativeCurrency:{symbol:"POL",decimals:18},explorer:"https://polygonscan.com",dexscreenerSlug:"polygon",venueKind:"uniswap-v3",wrappedNative:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WMATIC->USDC fee 500 quoted 0.0720 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}}]},{key:"stable",chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],nativeCurrency:{symbol:"USDT0",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x5d442b349590a6048Eb2dC0eC346cAA5F47A9ab5",venues:[{kind:"quoter",address:"0xb070179E7032CdA868b53e6C1742F80c9e940d1A",label:"Uniswap V3 QuoterV2 (canonical)",verified:{method:"Stable is on the OFFICIAL Uniswap v3 Deployments List (governance-recognised 2026-05-12, UAC process completed 2026-04, deployed by Protofire), so this is a canonical deployment rather than a fork. eth_getCode returned 8273 bytes, the same size as the canonical quoter on the seven already-verified chains. Functional probe on a live pool (TOAST -> USDT0, fee 10000): 100 in -> 0.000003, 1000 -> 0.000031, 10000 -> 0.000319 USDT0. Output scales monotonically with input, which is a working quoter answering, not a revert. Two of three sampled pools carry non-zero liquidity. NOTE: the pools discovered so far are thin, so real routing size is limited -- the venue is proved, deep liquidity is not.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:988}},{kind:"router",address:"0x32eaf9B5d5F2CD7361c5012890C943D7de84C22a",label:"Uniswap SwapRouter02 (canonical)",verified:{method:"eth_getCode returned 24497 bytes. Cross-checked on-chain rather than trusted from docs: router.factory() returns 0x88f0a512ef09175d456bc9547f914f48c013e4aa, the same v3 core factory that created the pools quoted above, and router.WETH9() returns the wrappedNative recorded on this chain entry. Address published in the Stable docs DEX reference and the Uniswap deployments list.",source:"docs.stable.xyz/en/reference/dexes + on-chain factory()/WETH9() round-trip",date:"2026-08-05",chainId:988}}]},{key:"hyperevm",chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],nativeCurrency:{symbol:"HYPE",decimals:18},dexscreenerSlug:"hyperevm",venueKind:"uniswap-v3",wrappedNative:"0x5555555555555555555555555555555555555555",venues:[{kind:"quoter",address:"0x03A918028f22D9E1473B7959C927AD7425A45C7C",label:"HyperSwap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle(1 WHYPE -> USDT0) returned live output on all four fee tiers (100: 57.3385, 500: 57.4187, 3000: 57.3237, 10000: 56.1963 USDT0). Decimals read on-chain: WHYPE 18, USDT0 6. Best tier checked against an INDEPENDENT control the same minute -- Hyperliquid allMids put HYPE at 57.3205, so the pool is 0.171% from the perp mid, which is the right shape for fee plus impact rather than a wrong contract or a decimals bug.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}},{kind:"router",address:"0x4E2960a8cd19B467b82d26D83fAcb0fAE26b094D",label:"HyperSwap V3 SwapRouter",verified:{method:"eth_getCode returned 12070 bytes, and it is the router paired with the quoter proved above -- the same pair already shipped in UNI_V3_VENUES[999].hyperswap, which is the map the quote/prepare path actually routes through.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}}]},{key:"abstract",chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x3439153EB7AF838Ad19d56E1571FBD09333C2809",venues:[{kind:"quoter",address:"0x728BD3eC25D5EDBafebB84F3d67367Cd9EBC7693",label:"Uniswap V3 QuoterV2 (Abstract deployment)",verified:{method:"Abstract is a ZK-stack chain, so CREATE2 addresses differ and the canonical Uniswap addresses are NOT valid here -- probing them returns codesize 0, which is what previously made this chain look like it had no V3 at all. Found the real deployment from live traffic instead: scanned recent Swap(...) logs, took the busiest pool, read pool.factory() = 0xa1160e73b63f322ae88cc2d8e700833e71d0b2a1, then enumerated that factory's deployer (0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e) and probed each of its 56 contracts with a real quoteExactInputSingle call. Exactly one answered: 1 WETH -> 1846.475731 USDC.e at fee 500. Independent sanity check: the pool's own slot0() spot price is 1873.11 USDC.e per WETH, so the quoter sits ~1.4% below spot, the right shape for fee plus price impact on this size.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:2741}},{kind:"router",address:"0x7712FA47387542819d4E35A23f8116C90C18767C",label:"Uniswap SwapRouter02 (Abstract deployment)",verified:{method:"eth_getCode returned 167392 bytes and the runtime contains the exactInputSingle selector. router.factory() matches the factory proved above and router.WETH9() matches the wrappedNative on this entry. Chosen over its byte-identical twin (0xfD6257F4...) because this is the address real users actually route through: it appeared as tx.to on live swaps against the WETH/USDC.e pool.",source:"on-chain factory()/WETH9() round-trip + live swap tx.to sampling",date:"2026-08-05",chainId:2741}}]},{key:"robinhood",chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC","ROBINHOOD_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},dexscreenerSlug:"robinhood",venueKind:"uniswap-v3",wrappedNative:"0x0bd7d308f8e1639fab988df18a8011f41eacad73",venues:[{kind:"quoter",address:"0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDG fee 100 quoted 1866.58 USDG, and USDG->CASHCAT fee 10000 quoted a live amount). A contract that correctly prices known pairs IS a working V3 quoter",source:"live eth_call against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"router",address:"0xcaf681a66d020601342297493863e78c959e5cb2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode (24497 bytes) on this chain and the paired quoter at the same deployment passed a live functional quote",source:"live eth_getCode against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"factory",address:"0x1f7d7550b1b028f7571e69a784071f0205fd2efa",label:"Uniswap V3 Factory",verified:{method:"eth_getCode returned real bytecode (24535 bytes) and a PoolCreated log scan over this factory returned 76 pools in ~9000 recent blocks",source:"live eth_getLogs against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}}]},{key:"base",chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://basescan.org",dexscreenerSlug:"base",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",venues:[{kind:"quoter",address:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",label:"Uniswap V3 QuoterV2 (Base)",verified:{method:"functional probe: quoteExactInputSingle returned WETH->USDC at fee 500 = 1908.44 USDC, a live sane price. The canonical mainnet quoter address also has bytecode on Base but does NOT price this pair, which is exactly the false positive a codesize-only check accepts",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router",address:"0x2626664c2603336E57B271c5C0b26F421741e481",label:"Uniswap V3 SwapRouter02 (Base)",verified:{method:"eth_getCode returned real bytecode and the paired Base quoter passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router-v2",address:"0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",label:"Uniswap V2 Router02 (Base)",verified:{method:"eth_getCode returned 17891 bytes; live getAmountsOut on WETH->USDC round-tripped to 98.75% (2x0.30% fee + impact)",source:"https://docs.uniswap.org/contracts/v2/reference/smart-contracts/v2-deployments",date:"2026-07-30",chainId:8453}}]},{key:"arbitrum",chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://arbiscan.io",dexscreenerSlug:"arbitrum",venueKind:"uniswap-v3",wrappedNative:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.72 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}}]},{key:"avalanche",chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],nativeCurrency:{symbol:"AVAX",decimals:18},explorer:"https://snowtrace.io",dexscreenerSlug:"avalanche",venueKind:"uniswap-v3",wrappedNative:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",venues:[{kind:"quoter",address:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WAVAX->USDC fee 500 quoted 6.48 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}},{kind:"router",address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}}]}]);function lt(){return Ne.map(t=>j(ae(t)))}function dt(t){return j(ae(t))}export{Ne as CHAIN_CONFIGS,b as EVIDENCE,m as RISK,B as SCANNER_CAPABILITIES,ft as __clearScanners,Te as createScanner,pt as getScanner,ht as listScanners,lt as registerBuiltinScanners,dt as registerCustomChain,j as registerScanner,mt as scannerCoverage,Ue as validateScanner};
3
+ - `)}`);let a=t.capabilities||{},n=O.filter(u=>typeof a[u]=="function"),s={key:t.key,chainId:t.chainId,name:t.name,rpcEnv:[...t.rpcEnv],nativeCurrency:t.nativeCurrency?{...t.nativeCurrency}:null,wrappedNative:t.wrappedNative||null,explorer:t.explorer||null,venues:(t.venues||[]).map(u=>({...u})),warnings:o,capabilities(){return{chainId:t.chainId,key:t.key,supported:[...n],unsupported:O.filter(u=>!n.includes(u))}},supports(u){return n.includes(u)}};for(let u of O)n.includes(u)?s[u]=async(...l)=>a[u](...l,{scanner:s}):s[u]=async()=>{throw new Error(`${t.key} (chain ${t.chainId}) does not implement "${u}". Supported: ${n.join(", ")||"none"}. An unimplemented capability is absent, not assumed -- implement it or treat this chain as fail-closed for that operation.`)};return Object.freeze(s)}var P=new Map;function z(t){let e=Pe(t);return P.set(e.chainId,e),e}function wt(t){return P.get(Number(t))||null}function gt(){return[...P.values()]}function Et(){P.clear()}function St(){let t={};for(let e of P.values())t[e.chainId]={key:e.key,name:e.name,...e.capabilities(),venueCount:e.venues.length,failClosed:e.venues.length===0};return{generatedAt:new Date().toISOString(),chainCount:P.size,capabilities:[...O],chains:t}}import{createHash as Ve}from"node:crypto";import R from"node:net";import Fe from"node:dns";var Oe=new Set(["localhost","metadata.google.internal","metadata.goog"]);function M(t){let e=String(t).toLowerCase().split("%")[0];if((e.match(/::/g)||[]).length>1)return null;let r=c=>{if(!c)return[];let i=c.split(":"),p=i.at(-1);if(p?.includes(".")){let h=p.split(".").map(Number);if(h.length!==4||h.some(f=>!Number.isInteger(f)||f<0||f>255))return null;i.splice(i.length-1,1,(h[0]<<8|h[1]).toString(16),(h[2]<<8|h[3]).toString(16))}return i.some(h=>!/^[0-9a-f]{1,4}$/.test(h))?null:i.map(h=>Number.parseInt(h,16))},[o,a]=e.split("::"),n=r(o),s=r(a);if(!n||!s)return null;let u=e.includes("::"),l=8-n.length-s.length;if(!u&&l!==0||u&&l<1)return null;let d=[...n,...Array(Math.max(0,l)).fill(0),...s];return d.length!==8?null:Uint8Array.from(d.flatMap(c=>[c>>8,c&255]))}function K(t,e,r){let o=Math.floor(r/8),a=r%8;for(let s=0;s<o;s+=1)if(t[s]!==e[s])return!1;if(!a)return!0;let n=255<<8-a;return(t[o]&n)===(e[o]&n)}function Q(t){if(R.isIPv4(t)){let e=t.split(".").map(Number);return!(e[0]===0||e[0]===10||e[0]===127||e[0]>=224||e[0]===100&&e[1]>=64&&e[1]<=127||e[0]===169&&e[1]===254||e[0]===172&&e[1]>=16&&e[1]<=31||e[0]===192&&(e[1]===0||e[1]===2||e[1]===168)||e[0]===192&&e[1]===88&&e[2]===99||e[0]===198&&(e[1]===18||e[1]===19||e[1]===51)||e[0]===203&&e[1]===0&&e[2]===113)}if(R.isIPv6(t)){let e=M(t);if(!e)return!1;let r=M("::ffff:0:0");return K(e,r,96)?Q([...e.slice(12)].join(".")):K(e,M("2000::"),3)?![["2001::",23],["2001:db8::",32],["2001:10::",28],["2001:2::",48],["2002::",16],["3fff::",20]].some(([a,n])=>K(e,M(a),n)):!1}return!1}function $e(t){let e;try{e=new URL(String(t))}catch{return{ok:!1,error:`not a valid URL: ${String(t).slice(0,120)}`}}if(e.protocol!=="http:"&&e.protocol!=="https:")return{ok:!1,error:`refused protocol ${e.protocol} (only http/https)`};let r=e.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,"");if(Oe.has(r)||r.endsWith(".localhost")||r.endsWith(".internal"))return{ok:!1,error:`refused internal host ${r}`};let o=R.isIP(r);return o!==0&&!Q(r)?{ok:!1,error:`refused private address ${r}`}:{ok:!0,url:e,host:r,isLiteralIp:o!==0}}async function G(t,{lookupFn:e=Fe.promises.lookup}={}){let r=$e(t);if(!r.ok)return r;if(r.isLiteralIp)return{ok:!0,url:r.url,addresses:[{address:r.host,family:R.isIPv6(r.host)?6:4}]};let o;try{o=await e(r.host,{all:!0,verbatim:!0})}catch{return{ok:!1,error:`refused: ${r.host} did not resolve`}}return!Array.isArray(o)||o.length===0||o.some(a=>!Q(a.address))?{ok:!1,error:`refused: ${r.host} resolves to a non-public address`}:{ok:!0,url:r.url,addresses:o}}async function Y({requireUndici:t=!1,importUndici:e=()=>import("undici")}={}){let r,o;try{let i=await e();r=i.Agent,o=i.fetch}catch(i){if(t)throw new Error(`egress-guard: untrustedUrl pinning requires the undici package, which failed to load: ${i?.message||i}`);return null}if(typeof r!="function"||typeof o!="function"){if(t)throw new Error("egress-guard: untrustedUrl pinning requires undici's Agent and fetch exports, which were not found on the imported module");return null}let a=i=>String(i).toLowerCase().replace(/^\[|\]$/g,"").replace(/\.+$/,""),n=new Map,s=i=>(Array.isArray(i)?i:[i]).map(p=>typeof p=="string"?{address:p}:p).filter(p=>p&&p.address).map(p=>({address:p.address,family:p.family||(R.isIPv6(p.address)?6:4)})),u=(i,p,h)=>{n.set(a(i),s(typeof p=="string"?[{address:p,family:h}]:p))},l=i=>{let p=a(i);if(R.isIP(p))return[{address:p,family:R.isIPv6(p)?6:4}];let h=n.get(p);if(!h||!h.length)throw new Error(`refused: unpinned host ${i} during pinned fetch`);return h},d=new r({connect:{lookup(i,p,h){let f;try{f=l(i)}catch(v){return h(v)}return p?.all?h(null,f):h(null,f[0].address,f[0].family)}}}),c=De((i,p={})=>o(i,{...p,dispatcher:d}),u);return{dispatcher:d,fetch:c,pin:u,resolve:l,async close(){try{await d.destroy()}catch{}}}}var X=Symbol.for("oracle.egressGuard.pinCapableFetch");function De(t,e){if(typeof t!="function")throw new Error("markPinCapableFetch: fetchImpl must be a function");if(typeof e!="function")throw new Error("markPinCapableFetch: pin must be a function");return t[X]=Object.freeze({pin:e}),t}function J(t){return typeof t=="function"&&typeof t[X]?.pin=="function"}function ce(t,e,r){if(!J(t))throw new Error("pinFetchToAddresses: fetchImpl is not pin-capable");t[X].pin(e,r)}var He=new Set([408,425,429,500,502,503,504]),ue=new Set(["GET","HEAD","OPTIONS","PUT","DELETE"]),Me=2,le=4e3,fe=["authorization","x-api-key","x-tensor-api-key","0x-api-key","api-key","cookie","proxy-authorization"],je=new Set([301,302,303,307,308]),de=3,We=64*1024;function ze(t){let e=String(t||"").toLowerCase();return fe.includes(e)||/(^|-)(api[-_]?key|key|token|secret|auth|authorization|session|cookie|signature|access)(-|$)/.test(e)}function Ke(t){let e={};for(let[r,o]of Object.entries(t||{}))ze(r)||(e[r]=o);return e}function Qe(t,e){if(!t)throw new Error(`HTTP redirect from ${e} missing Location`);let r=new URL(String(t),String(e));if(r.protocol!=="http:"&&r.protocol!=="https:")throw new Error(`HTTP redirect from ${e} used unsupported protocol ${r.protocol}`);return r.toString()}function Ge(t,e){return new URL(String(t)).origin===new URL(String(e)).origin}var Z=new Map;function Ye(t,e,r,o={}){let a={};for(let[c,i]of Object.entries(r||{}))a[c.toLowerCase()]=i;let n=Object.keys(a).filter(c=>/(^|-)(api[-_]?key|key|token|secret|auth|authorization|session|cookie|signature|access)(-|$)/.test(c)),u=[...new Set([...fe,...n])].sort().map(c=>`${c}=${a[c]??""}`).join(`
4
+ `),l=Ve("sha256").update(u).digest("hex").slice(0,32),d=`${o.untrustedUrl?"untrusted":"trusted"}:${o.maxResponseBytes??"unbounded"}`;return`${t} ${e} ${d} ${l}`}function Xe(t,e){let r=Number(e);return Number.isFinite(r)&&r>0?Math.min(r*1e3,le):Math.min(250*2**t,le)+Math.floor(Math.random()*100)}var Je=t=>new Promise(e=>setTimeout(e,t));function $(t,e={}){let r=new Error(t);return r.retryable=!1,Object.assign(r,e),r}function ee(t,e,r){return $(`HTTP response from ${t} exceeded maxResponseBytes ${r} (${e})`,{oversize:!0})}function D(t){try{let e=t?.body?.cancel?.();e&&typeof e.then=="function"&&e.catch(()=>{})}catch{}}function Ze(t){return t?t.byteLength??t.length??0:0}async function pe(t,e,{url:r,truncate:o=!1,onOversize:a}={}){if(e==null)return await t.text();let n=Number(t.headers?.get?.("content-length"));if(Number.isFinite(n)&&n>e&&(D(t),!o))throw ee(r,`content-length ${n}`,e);let s=t.body?.getReader?.();if(!s){let i=await t.text(),p=Buffer.byteLength(i,"utf8");if(p>e){if(!o)throw ee(r,`body ${p} bytes`,e);return Buffer.from(i,"utf8").subarray(0,e).toString("utf8")}return i}let u=[],l=0,d=!1;try{for(;;){let{value:i,done:p}=await s.read();if(p)break;if(i&&(u.push(Buffer.from(i)),l+=Ze(i),l>e)){d=!0;break}}}finally{if(d)try{await s.cancel()}catch{}try{s.releaseLock?.()}catch{}}if(d&&(typeof a=="function"&&a(),!o))throw ee(r,`streamed ${l} bytes`,e);let c=Buffer.concat(u);return(d?c.subarray(0,e):c).toString("utf8")}function he(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function et(t,{fetchImpl:e,method:r,headers:o,body:a,timeoutMs:n,lookupFn:s,realFetch:u,untrustedUrl:l=!1,maxResponseBytes:d=null,importUndici:c,validateResponse:i,signal:p}){let h=new AbortController,f=setTimeout(()=>h.abort(),n),v=p?typeof AbortSignal.any=="function"?AbortSignal.any([p,h.signal]):p:h.signal,b=null,k=e,x=s?{lookupFn:s}:{};if(l&&!u&&!J(k))throw $(`HTTP refused ${t}: untrustedUrl requires a pin-capable fetchImpl (see markPinCapableFetch in egress-guard.mjs) or no fetchImpl override so Oracle can pin the connection itself`);let L=async(S,{status:E=null}={})=>{let g=await G(S,x);if(!g.ok)throw $(E==null?`HTTP refused ${S}: ${g.error}`:`HTTP redirect to ${S} ${g.error}`,E==null?{}:{status:E});let w=new URL(S).hostname;if(u){if(b&&(await b.close(),b=null),!b)try{b=await Y({requireUndici:!0,...c?{importUndici:c}:{}})}catch(A){throw $(E==null?`HTTP refused ${S}: ${A?.message||A}`:`HTTP redirect to ${S} refused: ${A?.message||A}`,E==null?{}:{status:E})}b.pin(w,g.addresses),k=b.fetch}else ce(k,w,g.addresses);return g};try{let S=String(t),E={...o||{}};l&&await L(S);for(let g=0;g<=de;g+=1){let w=await k(S,{method:r,headers:E,body:a,signal:v,redirect:"manual"});if(je.has(w.status)){if(r!=="GET"&&r!=="HEAD"){let U=await pe(w,d??We,{url:S,truncate:!0}),_=new Error(`HTTP ${w.status} ${r} ${S} redirected non-idempotent request`);throw _.status=w.status,_.body=he(U)??U.slice(0,300),_}if(g===de)throw D(w),new Error(`HTTP redirect loop for ${t}`);let C=w.headers?.get?.("location"),N;try{N=Qe(C,S)}catch(U){throw D(w),U}let F=!Ge(N,S);if(D(w),F&&(E=Ke(E)),l)await L(N,{status:w.status});else if(F){let U=await G(N,x);if(!U.ok){let _=new Error(`HTTP redirect from ${S} ${U.error}`);throw _.status=w.status,_.retryable=!1,_}u&&U.addresses?.length&&(b||(b=await Y(c?{importUndici:c}:{})),b&&(b.pin(new URL(N).hostname,U.addresses),k=b.fetch))}S=N;continue}if(typeof i=="function")try{await i(w,{url:S})}catch(C){throw D(w),$(C?.message||String(C))}let A=await pe(w,d,{url:S,onOversize:()=>h.abort()}),I=he(A);if(!w.ok){let C=new Error(`HTTP ${w.status} ${r} ${S}`);throw C.status=w.status,C.retryAfter=w.headers?.get?.("retry-after")??null,C.body=I??A.slice(0,300),C}return I??A}throw new Error(`HTTP redirect loop for ${t}`)}finally{clearTimeout(f),b&&await b.close()}}async function j(t,e={}){let r=e.fetchImpl||globalThis.fetch;if(typeof r!="function")throw new Error("fetch unavailable \u2014 pass opts.fetchImpl");let o=e.timeoutMs??12e3,a=(e.method||"GET").toUpperCase(),n={Accept:"application/json",...e.headers||{}},s=e.body;s!=null&&typeof s!="string"&&(n["Content-Type"]=n["Content-Type"]||"application/json",s=JSON.stringify(s));let u=Number.isInteger(e.retries)?Math.max(e.retries,0):Me,l=e.lookupFn,d=!e.fetchImpl,c=e.untrustedUrl===!0,i=e.importUndici,p=e.validateResponse,h=e.signal,f=Number(e.maxResponseBytes),v=Number.isFinite(f)&&f>0?Math.floor(f):null,b=async()=>{let E;for(let g=0;g<=u;g++){h?.throwIfAborted?.();try{return await et(t,{fetchImpl:r,method:a,headers:n,body:s,timeoutMs:o,lookupFn:l,realFetch:d,untrustedUrl:c,maxResponseBytes:v,importUndici:i,validateResponse:p,signal:h})}catch(w){E=w;let A=w?.status,I=w?.name==="AbortError"||w?.name==="TimeoutError"||h?.aborted,C=new Set([408,425,429]),N=w?.retryable===!1?!1:A!=null?C.has(A)||He.has(A)&&ue.has(a):!I&&ue.has(a);if(g===u||!N)throw w;let F=Xe(g,w?.retryAfter);h?await new Promise((U,_)=>{let _e=setTimeout(U,F);h.addEventListener("abort",()=>{clearTimeout(_e),_(h.reason||new DOMException("Aborted","AbortError"))},{once:!0})}):await Je(F)}}throw E};if(!(e.dedupe!==!1&&!h&&a==="GET"&&s==null))return b();let x=Ye(a,t,n,{untrustedUrl:c,maxResponseBytes:v}),L=Z.get(x);if(L)return L;let S=b().finally(()=>Z.delete(x));return Z.set(x,S),S}var me={robinhood:{chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC"],evm:!0},ethereum:{chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],evm:!0},polygon:{chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],evm:!0},arbitrum:{chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],evm:!0},base:{chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],evm:!0},hyperevm:{chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],evm:!0},bsc:{chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],evm:!0},avalanche:{chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],evm:!0},optimism:{chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],evm:!0},abstract:{chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],evm:!0},stable:{chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],evm:!0}},tt=new Map(Object.values(me).map(t=>[t.chainId,t]));function be(t){return tt.get(Number(t))||null}function ve(t,e=process.env){let r=be(t);if(!r)return null;for(let o of r.rpcEnv){let a=(e[o]||"").trim();if(a)return a}return null}import{Interface as rt,getAddress as nt}from"ethers";var ye=new rt(["function allowance(address owner,address spender) view returns (uint256)","function balanceOf(address account) view returns (uint256)"]);function we(t,e){try{return nt(t).toLowerCase()}catch{throw new Error(`${e} must be a valid EVM address`)}}var ot={1:"https://ethereum.publicnode.com",137:"https://polygon-bor-rpc.publicnode.com",42161:"https://arbitrum-one-rpc.publicnode.com",8453:"https://base-rpc.publicnode.com",10:"https://optimism-rpc.publicnode.com",988:"https://rpc.stable.xyz",56:"https://bsc-rpc.publicnode.com",43114:"https://avalanche-c-chain-rpc.publicnode.com",999:"https://rpc.hyperliquid.xyz/evm",2741:"https://api.mainnet.abs.xyz",4663:"https://rpc.mainnet.chain.robinhood.com"};function at(t,{rpcUrl:e,env:r=process.env}={}){if(e)return e;let o=ve(t,r);return o||ot[Number(t)]||null}var st=/^(?:eth_(?:call|blocknumber|chainid|get[a-z0-9]+|feehistory|gasprice|maxpriorityfeepergas|syncing|protocolversion|estimategas|createaccesslist)|net_(?:version|listening|peercount)|web3_(?:clientversion|sha3))$/;function it(t){let e=String(t||""),r=e.toLowerCase();if(e!==e.trim()||!/^[a-zA-Z0-9_]+$/.test(e)||!st.test(r))throw new Error(`evm-rpc: ${e} refused \u2014 @oracle-agent/oracle is prepare-only (read RPC only; no broadcast/sign)`);return r}async function q(t,e,r=[],o={}){let a=String(e||"");it(a);let n=at(t,o);if(!n)throw new Error(`No RPC URL for chainId ${t} (set env from chain registry rpcEnv or pass rpcUrl)`);let u=await j(n,{method:"POST",body:{jsonrpc:"2.0",id:1,method:e,params:r},fetchImpl:o.fetchImpl,timeoutMs:o.timeoutMs??12e3,signal:o.signal});if(u?.error){let l=new Error(u.error.message||JSON.stringify(u.error));throw l.code=u.error.code,l}return u.result}async function ge(t,e={}){let r=await q(t,"eth_blockNumber",[],e);return parseInt(r,16)}async function Ee(t,e,r={}){if(!e)throw new Error("rpcGetBalance requires address");let o=await q(t,"eth_getBalance",[e,"latest"],r);return{chainId:Number(t),address:e,balanceWei:BigInt(o).toString(),balanceHex:o}}async function Se(t={},e={}){let r=Number(t.chainId??e.chainId??1),o=we(t.token||t.tokenAddress,"token"),a=we(t.account||t.owner||t.address,"account"),n=ye.encodeFunctionData("balanceOf",[a]),s=await q(r,"eth_call",[{to:o,data:n},t.blockTag||"latest"],e),u=ye.decodeFunctionResult("balanceOf",s),l=BigInt(u[0]);return{chainId:r,token:o,account:a,balance:l.toString(),balanceHex:`0x${l.toString(16)}`,blockTag:t.blockTag||"latest"}}var ct=new Set(["usdc","usdt","usdg","dai","usd1","usde","pyusd"]);function Ce(t,e){let r=String(t||"").toLowerCase(),o=String(e?.quote||e?.quoteToken?.address||"").toLowerCase(),a=String(e?.base||e?.baseToken?.address||"").toLowerCase();return o===r?{address:e.base||e.baseToken?.address,symbol:e.baseToken?.symbol}:a===r?{address:e.quote||e.quoteToken?.address,symbol:e.quoteToken?.symbol}:{address:e.quote||e.quoteToken?.address,symbol:e.quoteToken?.symbol}}function te(t,e=[],{stables:r=[],wrappedNative:o=null}={}){let a=String(t||"").toLowerCase(),n=new Set((r||[]).map(l=>String(l).toLowerCase())),s=String(o||"").toLowerCase(),u=(e||[]).map((l,d)=>{let c=Ce(a,l),i=String(c.address||"").toLowerCase(),p=String(c.symbol||"").toLowerCase(),h=Number(l.liquidityUsd??l.liquidity?.usd),f=Number.isFinite(h)?h:0,v=String(l.dex||l.dexId||"").toLowerCase(),b=0;return n.has(i)||ct.has(p)?b=300:s&&i===s&&(b=100),v.includes("v4")?b+=20:v.includes("v3")?b+=10:(v.includes("v2")||v.includes("raydium")||v.includes("orca")||v.includes("meteora"))&&(b+=8),{pool:l,score:b*1e12+f,index:d,otherAddr:i,liquidityUsd:f}});return u.sort((l,d)=>d.score-l.score||l.index-d.index),u.map(l=>l.pool)}function Ae(t,e=[]){let r=Array.isArray(e)?e:[];return r.length&&Ce(t,r[0]).address||null}var ut="https://api.dexscreener.com",$t=Object.freeze({1:"ethereum",10:"optimism",56:"bsc",137:"polygon",8453:"base",42161:"arbitrum",43114:"avalanche",999:"hyperevm",4663:"robinhood"});function lt(t={}){return(t.baseUrl||process.env.DEXSCREENER_API_URL||ut).replace(/\/$/,"")}async function xe(t,e={}){if(!t)throw new Error("tokenAddress required");return j(`${lt(e)}/latest/dex/tokens/${t}`,{fetchImpl:e.fetchImpl,timeoutMs:e.timeoutMs??12e3})}var ne={getAmountsOut:"d06ca61f",swapExactTokensForTokens:"38ed1739",swapExactETHForTokens:"7ff36ab5"},T=t=>BigInt(t).toString(16).padStart(64,"0"),V=t=>t.slice(2).toLowerCase().padStart(64,"0");function dt(t,e){return`0x${ne.getAmountsOut}`+T(t)+T(64)+T(e.length)+e.map(V).join("")}function pt(t){if(!t||t==="0x")return null;let e=t.slice(2);if(e.length<128)return null;let r=Number(BigInt(`0x${e.slice(64,128)}`));if(!Number.isFinite(r)||r<1||r>16)return null;let o=[];for(let a=0;a<r;a++){let n=128+a*64;if(e.length<n+64)return null;o.push(BigInt(`0x${e.slice(n,n+64)}`))}return o}function re(t,e="router"){return(t?.venues||[]).find(o=>o.kind===e)?.address??null}var oe=100;function ht(t,e){let r=Number(e);if(!Number.isFinite(r)||r<0)throw new Error("slippageBps must be a non-negative number");if(r>oe)throw new Error(`slippageBps ${r} exceeds the ${oe} bps ceiling. Block and requote or split the order -- do not widen the guard to force a fill.`);return BigInt(t)*BigInt(1e4-Math.floor(r))/10000n}function Ie(t){let{chainId:e,wrappedNative:r}=t;async function o(a,n,s,u){let l=await q(e,"eth_call",[{to:a,data:dt(n,s)},"latest"],u);return pt(l?.result??l)}return{async quote({tokenIn:a,tokenOut:n,amountIn:s,path:u},l={}){let d=re(l.scanner);if(!d)return{chainId:e,evidence:y.UNAVAILABLE,reason:"no verified router configured for this chain; quoting stays fail-closed rather than guessing a venue address"};let c=u||[a,n];if(c.some(p=>!/^0x[0-9a-fA-F]{40}$/.test(p||"")))throw new Error("quote requires valid 20-byte addresses");let i=await o(d,s,c,l);return i?{chainId:e,router:d,path:c,amountIn:String(s),amountOut:i[i.length-1].toString(),hops:c.length-1,evidence:y.LIVE,note:"exact-input quote at current reserves; not a guaranteed fill"}:{chainId:e,router:d,path:c,evidence:y.UNKNOWN,reason:"router returned no amounts -- no pool for this path, or the call reverted"}},async sellSimulation({token:a,amountIn:n,base:s},u={}){let l=re(u.scanner),d=s||r;if(d&&String(a).toLowerCase()===String(d).toLowerCase())return{chainId:e,token:a,verdict:m.UNKNOWN,evidence:y.UNAVAILABLE,reason:"token is the base asset for this chain, so there is nothing to round-trip against. Sellability must be judged against a different quote asset."};if(!l||!d)return{chainId:e,token:a,verdict:m.UNKNOWN,evidence:y.UNAVAILABLE,reason:l?"no wrappedNative configured for this chain, so no base asset to round-trip against":"no verified router configured for this chain"};let c=await o(l,n,[d,a],u);if(!c)return{chainId:e,token:a,verdict:m.FAIL,evidence:y.LIVE,leg:"buy",reason:"buy leg returned no amounts -- no route in"};let i=c[c.length-1];if(i===0n)return{chainId:e,token:a,verdict:m.FAIL,evidence:y.LIVE,leg:"buy",reason:"buy leg quotes zero output"};let p=await o(l,i,[a,d],u);if(!p)return{chainId:e,token:a,verdict:m.FAIL,evidence:y.LIVE,leg:"sell",bought:i.toString(),reason:"SELL LEG FAILED while the buy leg quoted fine. This is the honeypot signature: do not trade."};let h=p[p.length-1],f=Number(h*10000n/BigInt(n)),v=m.PASS,b="round trip completes with expected fee/impact loss";return f<5e3?(v=m.FAIL,b=`round trip returns only ${(f/100).toFixed(2)}% -- punitive tax or no real liquidity`):f<9e3&&(v=m.CAUTION,b=`round trip returns ${(f/100).toFixed(2)}% -- transfer tax or thin liquidity at this size`),{chainId:e,token:a,base:d,router:l,verdict:v,reason:b,amountIn:String(n),bought:i.toString(),returned:h.toString(),retentionBps:f,evidence:y.LIVE,note:"Quote-level round trip. It does not prove transfer hooks absent at execution time."}},async prepareUnsignedTx({tokenIn:a,tokenOut:n,amountIn:s,recipient:u,slippageBps:l=50,deadlineSeconds:d=900,path:c},i={}){let p=i.scanner,h=re(p);if(!h)throw new Error(`chain ${e} has no verified router; preparing a swap stays fail-closed. Add a venue with recorded provenance first (see docs/adding-a-chain.md).`);if(!/^0x[0-9a-fA-F]{40}$/.test(u||""))throw new Error("prepareUnsignedTx requires a valid recipient address");let f=c||[a,n],v=await this.quote({tokenIn:a,tokenOut:n,amountIn:s,path:f},i);if(v.evidence!==y.LIVE)throw new Error(`cannot prepare without a live quote (${v.evidence}: ${v.reason??"no reason given"})`);let b=ht(v.amountOut,l);if(b<=0n)throw new Error("computed minOut is zero -- refusing to prepare");let k=BigInt(Math.floor(Date.now()/1e3)+Number(d)),x=r&&f[0].toLowerCase()===r.toLowerCase()&&i.useNative,L=x?`0x${ne.swapExactETHForTokens}`+T(b)+T(128)+V(u)+T(k)+T(f.length)+f.map(V).join(""):`0x${ne.swapExactTokensForTokens}`+T(s)+T(b)+T(160)+V(u)+T(k)+T(f.length)+f.map(V).join("");return{unsigned:!0,signedBy:"user-wallet",chainId:e,tx:{to:h,data:L,value:x?`0x${BigInt(s).toString(16)}`:"0x0"},guard:{quotedOut:v.amountOut,minOut:b.toString(),slippageBps:l,maxSlippageBps:oe,deadline:k.toString()},requires:x?[]:[{step:"approve",token:f[0],spender:h,amount:String(s)}],note:"UNSIGNED. Re-verify the guard against a fresh quote immediately before signing -- a quote-time minimum is not a minimum at broadcast time."}}}}var ft=[100,500,3e3,1e4],Ne={quoteExactInputSingle:"c6a5026a",exactInputSingle:"04e45aaf"},B=t=>BigInt(t).toString(16).padStart(64,"0"),H=t=>t.slice(2).toLowerCase().padStart(64,"0"),ke=/^0x[0-9a-fA-F]{40}$/,se=100;function mt(t,e){let r=Number(e);if(!Number.isFinite(r)||r<0)throw new Error("slippageBps must be a non-negative number");if(r>se)throw new Error(`slippageBps ${r} exceeds the ${se} bps ceiling. Block and requote or split the order -- do not widen the guard to force a fill.`);return BigInt(t)*BigInt(1e4-Math.floor(r))/10000n}function ae(t,e){return(t?.venues||[]).find(r=>r.kind===e)?.address??null}function Te(t){let{chainId:e,wrappedNative:r}=t;async function o({quoter:n,tokenIn:s,tokenOut:u,amountIn:l,fee:d},c){let i=`0x${Ne.quoteExactInputSingle}`+H(s)+H(u)+B(l)+B(d)+B(0),p=await q(e,"eth_call",[{to:n,data:i},"latest"],c).catch(()=>null),h=p?.result??p;if(!h||h==="0x"||h.length<66)return null;let f=BigInt(`0x${h.slice(2,66)}`);return f>0n?f:null}async function a({quoter:n,tokenIn:s,tokenOut:u,amountIn:l},d){let c=[],i=null;for(let p of ft){let h=await o({quoter:n,tokenIn:s,tokenOut:u,amountIn:l,fee:p},d);c.push({fee:p,amountOut:h?h.toString():null}),h&&(!i||h>i.amountOut)&&(i={fee:p,amountOut:h})}return{best:i,tried:c}}return{async quote({tokenIn:n,tokenOut:s,amountIn:u},l={}){let d=ae(l.scanner,"quoter");if(!d)return{chainId:e,evidence:y.UNAVAILABLE,reason:"no verified quoter configured for this chain; quoting stays fail-closed rather than guessing a venue address"};for(let p of[n,s])if(!ke.test(p||""))throw new Error("quote requires valid 20-byte addresses");let{best:c,tried:i}=await a({quoter:d,tokenIn:n,tokenOut:s,amountIn:u},l);return c?{chainId:e,venue:"uniswap-v3",quoter:d,tokenIn:n,tokenOut:s,amountIn:String(u),amountOut:c.amountOut.toString(),fee:c.fee,useNative:!!r&&String(n).toLowerCase()===String(r).toLowerCase(),triedFeeTiers:i,evidence:y.LIVE,note:"exact-input single-hop quote at current tick; not a guaranteed fill"}:{chainId:e,quoter:d,tokenIn:n,tokenOut:s,triedFeeTiers:i,evidence:y.UNKNOWN,reason:"no fee tier returned a quote -- no V3 pool for this pair, or no liquidity"}},async sellSimulation({token:n,amountIn:s,base:u},l={}){let d=ae(l.scanner,"quoter"),c=(t.stableQuoteAssets||[]).map(E=>String(E).toLowerCase()),i=null;!u&&typeof t.resolveQuoteAsset=="function"&&(i=await t.resolveQuoteAsset(n,l).catch(()=>null));let p=String(n).toLowerCase(),h=String(r||"").toLowerCase();if(h&&p===h)return{chainId:e,token:n,verdict:m.UNKNOWN,evidence:y.UNAVAILABLE,reason:"token is the base asset for this chain, so there is nothing to round-trip against. Sellability must be judged against a different quote asset."};let f=u||i||(c[0]&&p!==c[0]?c[0]:null)||r;if(f&&p===String(f).toLowerCase())return{chainId:e,token:n,verdict:m.UNKNOWN,evidence:y.UNAVAILABLE,reason:"token is the base asset for this chain, so there is nothing to round-trip against. Sellability must be judged against a different quote asset."};if(!d||!f)return{chainId:e,token:n,verdict:m.UNKNOWN,evidence:y.UNAVAILABLE,reason:d?"no wrappedNative configured, so there is no base asset to round-trip against":"no verified quoter configured for this chain"};let v=await a({quoter:d,tokenIn:f,tokenOut:n,amountIn:s},l);if(!v.best){let E=c.find(g=>g&&g!==String(f).toLowerCase()&&g!==String(n).toLowerCase());if(E){let g=await a({quoter:d,tokenIn:E,tokenOut:n,amountIn:s},l);if(g.best){let w=await a({quoter:d,tokenIn:n,tokenOut:E,amountIn:g.best.amountOut},l);if(w.best){let A=w.best.amountOut,I=Number(A*10000n/BigInt(s)),C=m.PASS,N="round trip vs dollar book completes with expected fee/impact loss";return I<5e3?(C=m.FAIL,N=`round trip vs dollar book returns only ${(I/100).toFixed(2)}% -- punitive tax or no real liquidity`):I<9e3&&(C=m.CAUTION,N=`round trip vs dollar book returns ${(I/100).toFixed(2)}% -- transfer tax or thin liquidity at this size`),{chainId:e,venue:"uniswap-v3",token:n,base:E,quoteAsset:E,verdict:C,reason:N,amountIn:String(s),bought:g.best.amountOut.toString(),returned:A.toString(),retentionBps:I,buyFee:g.best.fee,sellFee:w.best.fee,evidence:y.LIVE,note:"Quoted against the dollar book, not wrapped native. A missing WETH pool is not a honeypot."}}}}return{chainId:e,token:n,verdict:m.FAIL,evidence:y.LIVE,leg:"buy",reason:"no V3 pool priced the buy leg on any fee tier against wrapped native or the dollar book"}}let b=await a({quoter:d,tokenIn:n,tokenOut:f,amountIn:v.best.amountOut},l);if(!b.best){let E=c.find(g=>g&&g!==String(f).toLowerCase()&&g!==String(n).toLowerCase());if(E){let g=await a({quoter:d,tokenIn:E,tokenOut:n,amountIn:s},l),w=g.best?await a({quoter:d,tokenIn:n,tokenOut:E,amountIn:g.best.amountOut},l):{best:null};if(g.best&&w.best){let A=w.best.amountOut,I=Number(A*10000n/BigInt(s)),C=m.PASS,N="round trip vs dollar book completes; missing WETH sell pool is not a honeypot";return I<5e3?(C=m.FAIL,N=`dollar-book round trip returns only ${(I/100).toFixed(2)}%`):I<9e3&&(C=m.CAUTION,N=`dollar-book round trip returns ${(I/100).toFixed(2)}%`),{chainId:e,venue:"uniswap-v3",token:n,base:E,quoteAsset:E,verdict:C,reason:N,amountIn:String(s),bought:g.best.amountOut.toString(),returned:A.toString(),retentionBps:I,buyFee:g.best.fee,sellFee:w.best.fee,evidence:y.LIVE,note:"Sell vs wrapped native failed; dollar book succeeded. Not labelled honeypot."}}}return{chainId:e,token:n,verdict:m.FAIL,evidence:y.LIVE,leg:"sell",bought:v.best.amountOut.toString(),reason:"SELL LEG FAILED against wrapped native and the dollar book. This is the honeypot signature: do not trade."}}let k=b.best.amountOut,x=Number(k*10000n/BigInt(s)),L=m.PASS,S="round trip completes with expected fee/impact loss";return x<5e3?(L=m.FAIL,S=`round trip returns only ${(x/100).toFixed(2)}% -- punitive tax or no real liquidity`):x<9e3&&(L=m.CAUTION,S=`round trip returns ${(x/100).toFixed(2)}% -- transfer tax or thin liquidity at this size`),{chainId:e,venue:"uniswap-v3",token:n,base:f,verdict:L,reason:S,amountIn:String(s),bought:v.best.amountOut.toString(),returned:k.toString(),retentionBps:x,buyFee:v.best.fee,sellFee:b.best.fee,evidence:y.LIVE,note:"Quote-level round trip. It does not prove transfer hooks absent at execution time."}},async prepareUnsignedTx({tokenIn:n,tokenOut:s,amountIn:u,recipient:l,slippageBps:d=50,fee:c},i={}){let p=ae(i.scanner,"router");if(!p)throw new Error(`chain ${e} has no verified V3 router; preparing a swap stays fail-closed. Add a venue with recorded provenance first (see docs/adding-a-chain.md).`);if(!ke.test(l||""))throw new Error("prepareUnsignedTx requires a valid recipient address");let h=await this.quote({tokenIn:n,tokenOut:s,amountIn:u},i);if(h.evidence!==y.LIVE)throw new Error(`cannot prepare without a live quote (${h.evidence}: ${h.reason??"no reason given"})`);let f=c??h.fee,v=mt(h.amountOut,d);if(v<=0n)throw new Error("computed minOut is zero -- refusing to prepare");let b=!!(i.useNative||h.useNative)&&r&&String(n).toLowerCase()===String(r).toLowerCase(),k=`0x${Ne.exactInputSingle}`+H(n)+H(s)+B(f)+H(l)+B(u)+B(v)+B(0);return{unsigned:!0,signedBy:"user-wallet",chainId:e,venue:"uniswap-v3",tx:{to:p,data:k,value:b?String(u):"0x0"},guard:{quotedOut:h.amountOut,minOut:v.toString(),slippageBps:d,maxSlippageBps:se,fee:f},requires:b?[]:[{step:"approve",token:n,spender:p,amount:String(u)}],note:"UNSIGNED. Re-verify the guard against a fresh quote immediately before signing -- a quote-time minimum is not a minimum at broadcast time."}}}}var W={decimals:"0x313ce567",symbol:"0x95d89b41",name:"0x06fdde03",totalSupply:"0x18160ddd",owner:"0x8da5cb5b"};function Le(t){if(!t||t==="0x")return null;try{return BigInt(t)}catch{return null}}function Ue(t){if(!t||t==="0x")return null;let e=t.slice(2);if(e.length>=128){let o=Number(BigInt(`0x${e.slice(64,128)}`));if(o>0&&o<=256&&e.length>=128+o*2){let a=e.slice(128,128+o*2),n=Buffer.from(a,"hex").toString("utf8").replace(/\0+$/,"");if(n)return n}}return Buffer.from(e.slice(0,64),"hex").toString("utf8").replace(/\0+$/,"")||null}function bt(t){let{chainId:e}=t;async function r(o,a,n){return q(e,"eth_call",[{to:o,data:a},"latest"],n)}return{async blockNumber(o={}){let a=await ge(e,o);return{chainId:e,blockNumber:a?.blockNumber??a,evidence:y.LIVE}},async nativeBalance(o,a={}){let n=await Ee(e,o,a);return{chainId:e,address:o,wei:n?.wei??n?.balance??null,symbol:t.nativeCurrency?.symbol??null,decimals:t.nativeCurrency?.decimals??18,evidence:y.LIVE}},async tokenBalance({token:o,owner:a},n={}){let s=await Se({chainId:e,token:o,owner:a},n);return{chainId:e,token:o,owner:a,raw:s?.balance??s,evidence:y.LIVE}},async resolveToken(o,a={}){if(!/^0x[0-9a-fA-F]{40}$/.test(o||""))return{chainId:e,token:o,evidence:y.UNKNOWN,error:"resolveToken needs a 20-byte address; symbol lookup is a market-data concern"};let[n,s,u,l]=await Promise.all([r(o,W.decimals,a).catch(()=>null),r(o,W.symbol,a).catch(()=>null),r(o,W.name,a).catch(()=>null),r(o,W.totalSupply,a).catch(()=>null)]),d=Le(n?.result??n),c=d!==null||s?.result||u?.result;return{chainId:e,address:o,decimals:d===null?null:Number(d),symbol:Ue(s?.result??s),name:Ue(u?.result??u),totalSupply:(Le(l?.result??l)??null)?.toString()??null,evidence:c?y.LIVE:y.UNKNOWN,warning:c?void 0:"no ERC-20 metadata returned -- may not be a token contract"}},async resolvePools(o,a={}){let n=t.dexscreenerSlug;if(!n)return{chainId:e,token:o,pools:[],evidence:y.UNAVAILABLE,reason:"no dexscreenerSlug configured for this chain; pool discovery is unavailable rather than guessed"};let s=await xe(o,a).catch(()=>null),l=(s?.pairs||s?.data?.pairs||[]).filter(c=>String(c.chainId).toLowerCase()===String(n).toLowerCase()).map(c=>({pair:c.pairAddress,dex:c.dexId,base:c.baseToken?.address,quote:c.quoteToken?.address,liquidityUsd:c.liquidity?.usd??null,priceUsd:c.priceUsd??null,volume24hUsd:c.volume?.h24??null,createdAt:c.pairCreatedAt??null})).sort((c,i)=>(i.liquidityUsd??0)-(c.liquidityUsd??0)),d=te(o,l,{stables:t.stableQuoteAssets||[],wrappedNative:t.wrappedNative});return{chainId:e,token:o,pools:d,topPool:d[0]||null,quoteAsset:Ae(o,d),evidence:d.length?y.LIVE:y.UNKNOWN}},async scanBlocks({fromBlock:o,toBlock:a,address:n,topics:s,chunkSize:u=2e3}={},l={}){if(!Number.isInteger(o)||!Number.isInteger(a))throw new Error("scanBlocks requires integer fromBlock and toBlock");if(a<o)throw new Error("toBlock must be >= fromBlock");let d=[],c=[];for(let i=o;i<=a;i+=u){let p=Math.min(i+u-1,a);c.push([i,p])}for(let[i,p]of c){let h={fromBlock:`0x${i.toString(16)}`,toBlock:`0x${p.toString(16)}`};n&&(h.address=n),s&&(h.topics=s);let f=await q(e,"eth_getLogs",[h],l).catch(v=>({error:String(v?.message||v)}));if(f?.error)return{chainId:e,fromBlock:o,toBlock:a,logs:d,complete:!1,failedAt:[i,p],error:f.error,evidence:y.UNKNOWN};for(let v of f?.result??f??[])d.push(v)}return{chainId:e,fromBlock:o,toBlock:a,logs:d,complete:!0,chunks:c.length,evidence:y.LIVE}},async scoreRisk(o,a={}){let n=[],s=m.PASS,u=c=>{let i={[m.PASS]:0,[m.CAUTION]:1,[m.UNKNOWN]:2,[m.FAIL]:3};i[c]>i[s]&&(s=c)},l=await this.resolveToken(o,a);l.evidence!==y.LIVE?(n.push({check:"erc20-metadata",result:m.UNKNOWN,detail:l.warning}),u(m.UNKNOWN)):n.push({check:"erc20-metadata",result:m.PASS,detail:`${l.symbol} / ${l.decimals}d`});let d=await this.resolvePools(o,a);if(d.evidence===y.UNAVAILABLE)n.push({check:"liquidity",result:m.UNKNOWN,detail:d.reason}),u(m.UNKNOWN);else if(!d.pools.length)n.push({check:"liquidity",result:m.FAIL,detail:"no pool with liquidity found"}),u(m.FAIL);else{let c=d.pools[0],i=c.liquidityUsd??0;i<5e3?(n.push({check:"liquidity",result:m.CAUTION,detail:`top pool only $${i}`}),u(m.CAUTION)):n.push({check:"liquidity",result:m.PASS,detail:`$${i} on ${c.dex}`}),c.createdAt&&Date.now()-c.createdAt<24*3600*1e3&&(n.push({check:"age",result:m.CAUTION,detail:"pool under 24h old"}),u(m.CAUTION))}if(typeof this.sellSimulation=="function"){let c=await this.sellSimulation({token:o,amountIn:(10n**16n).toString()},a).catch(i=>({verdict:m.UNKNOWN,reason:String(i?.message||i)}));n.push({check:"sellability",result:c.verdict,detail:c.retentionBps!=null?`round trip returns ${(c.retentionBps/100).toFixed(2)}% -- ${c.reason}`:c.reason}),u(c.verdict)}else n.push({check:"sellability",result:m.UNKNOWN,detail:"no verified router on this chain, so a round-trip sell simulation cannot run. Treat as unproven -- a buy path is not an exit path."}),u(m.UNKNOWN);return{chainId:e,token:o,verdict:s,checks:n,note:"Structural checks only. UNKNOWN is not PASS. A token is not tradeable until a sell simulation succeeds."}}}}function ie(t){let r={...bt(t)},o=new Set((t.venues||[]).map(n=>n.kind));t.venueKind==="uniswap-v3"&&o.has("quoter")&&o.has("router")?Object.assign(r,Te({chainId:t.chainId,wrappedNative:t.wrappedNative,stableQuoteAssets:t.stableQuoteAssets||[],resolveQuoteAsset:async(n,s)=>(await r.resolvePools(n,s)).quoteAsset||null})):t.venueKind==="uniswap-v2"&&o.has("router")&&Object.assign(r,Ie({chainId:t.chainId,wrappedNative:t.wrappedNative}));let a={};for(let[n,s]of Object.entries(r))a[n]=s.bind(r);return{key:t.key,chainId:t.chainId,name:t.name,rpcEnv:t.rpcEnv,nativeCurrency:t.nativeCurrency,explorer:t.explorer,venues:t.venues||[],capabilities:a}}var qe=Object.freeze([{key:"ethereum",chainId:1,name:"Ethereum",rpcEnv:["ETH_RPC_URL","ETHEREUM_RPC_URL","MAINNET_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://etherscan.io",dexscreenerSlug:"ethereum",venueKind:"uniswap-v3",wrappedNative:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",stableQuoteAssets:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"],venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.71 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:1}}]},{key:"optimism",chainId:10,name:"OP Mainnet",rpcEnv:["OPTIMISM_RPC_URL","OP_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://optimistic.etherscan.io",dexscreenerSlug:"optimism",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",stableQuoteAssets:["0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85","0x94b008aA00579c1307B0EF2c499aD98a8ce58e58"],venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1905.23 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:10}}]},{key:"bsc",chainId:56,name:"BNB Smart Chain",rpcEnv:["BSC_RPC_URL","BNB_RPC_URL"],nativeCurrency:{symbol:"BNB",decimals:18},explorer:"https://bscscan.com",dexscreenerSlug:"bsc",venueKind:"uniswap-v3",wrappedNative:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",stableQuoteAssets:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"],venues:[{kind:"quoter",address:"0x78D78E420Da98ad378D7799bE8f4AF69033EB077",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WBNB->USDC fee 500 quoted 413.86 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}},{kind:"router",address:"0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:56}}]},{key:"polygon",chainId:137,name:"Polygon",rpcEnv:["POLYGON_RPC_URL","POLYGON_RPC"],nativeCurrency:{symbol:"POL",decimals:18},explorer:"https://polygonscan.com",dexscreenerSlug:"polygon",venueKind:"uniswap-v3",wrappedNative:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",stableQuoteAssets:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"],venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WMATIC->USDC fee 500 quoted 0.0720 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:137}}]},{key:"stable",chainId:988,name:"Stable Mainnet",rpcEnv:["STABLE_RPC_URL","STABLE_RPC"],nativeCurrency:{symbol:"USDT0",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x5d442b349590a6048Eb2dC0eC346cAA5F47A9ab5",venues:[{kind:"quoter",address:"0xb070179E7032CdA868b53e6C1742F80c9e940d1A",label:"Uniswap V3 QuoterV2 (canonical)",verified:{method:"Stable is on the OFFICIAL Uniswap v3 Deployments List (governance-recognised 2026-05-12, UAC process completed 2026-04, deployed by Protofire), so this is a canonical deployment rather than a fork. eth_getCode returned 8273 bytes, the same size as the canonical quoter on the seven already-verified chains. Functional probe on a live pool (TOAST -> USDT0, fee 10000): 100 in -> 0.000003, 1000 -> 0.000031, 10000 -> 0.000319 USDT0. Output scales monotonically with input, which is a working quoter answering, not a revert. Two of three sampled pools carry non-zero liquidity. NOTE: the pools discovered so far are thin, so real routing size is limited -- the venue is proved, deep liquidity is not.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:988}},{kind:"router",address:"0x32eaf9B5d5F2CD7361c5012890C943D7de84C22a",label:"Uniswap SwapRouter02 (canonical)",verified:{method:"eth_getCode returned 24497 bytes. Cross-checked on-chain rather than trusted from docs: router.factory() returns 0x88f0a512ef09175d456bc9547f914f48c013e4aa, the same v3 core factory that created the pools quoted above, and router.WETH9() returns the wrappedNative recorded on this chain entry. Address published in the Stable docs DEX reference and the Uniswap deployments list.",source:"docs.stable.xyz/en/reference/dexes + on-chain factory()/WETH9() round-trip",date:"2026-08-05",chainId:988}}]},{key:"hyperevm",chainId:999,name:"HyperEVM",rpcEnv:["HYPEREVM_RPC_URL","HYPER_EVM_RPC"],nativeCurrency:{symbol:"HYPE",decimals:18},dexscreenerSlug:"hyperevm",venueKind:"uniswap-v3",wrappedNative:"0x5555555555555555555555555555555555555555",venues:[{kind:"quoter",address:"0x03A918028f22D9E1473B7959C927AD7425A45C7C",label:"HyperSwap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle(1 WHYPE -> USDT0) returned live output on all four fee tiers (100: 57.3385, 500: 57.4187, 3000: 57.3237, 10000: 56.1963 USDT0). Decimals read on-chain: WHYPE 18, USDT0 6. Best tier checked against an INDEPENDENT control the same minute -- Hyperliquid allMids put HYPE at 57.3205, so the pool is 0.171% from the perp mid, which is the right shape for fee plus impact rather than a wrong contract or a decimals bug.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}},{kind:"router",address:"0x4E2960a8cd19B467b82d26D83fAcb0fAE26b094D",label:"HyperSwap V3 SwapRouter",verified:{method:"eth_getCode returned 12070 bytes, and it is the router paired with the quoter proved above -- the same pair already shipped in UNI_V3_VENUES[999].hyperswap, which is the map the quote/prepare path actually routes through.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:999}}]},{key:"abstract",chainId:2741,name:"Abstract",rpcEnv:["ABSTRACT_RPC_URL","ABS_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},venueKind:"uniswap-v3",wrappedNative:"0x3439153EB7AF838Ad19d56E1571FBD09333C2809",venues:[{kind:"quoter",address:"0x728BD3eC25D5EDBafebB84F3d67367Cd9EBC7693",label:"Uniswap V3 QuoterV2 (Abstract deployment)",verified:{method:"Abstract is a ZK-stack chain, so CREATE2 addresses differ and the canonical Uniswap addresses are NOT valid here -- probing them returns codesize 0, which is what previously made this chain look like it had no V3 at all. Found the real deployment from live traffic instead: scanned recent Swap(...) logs, took the busiest pool, read pool.factory() = 0xa1160e73b63f322ae88cc2d8e700833e71d0b2a1, then enumerated that factory's deployer (0xf3d63166F0Ca56C3c1A3508FcE03Ff0Cf3Fb691e) and probed each of its 56 contracts with a real quoteExactInputSingle call. Exactly one answered: 1 WETH -> 1846.475731 USDC.e at fee 500. Independent sanity check: the pool's own slot0() spot price is 1873.11 USDC.e per WETH, so the quoter sits ~1.4% below spot, the right shape for fee plus price impact on this size.",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-08-05",chainId:2741}},{kind:"router",address:"0x7712FA47387542819d4E35A23f8116C90C18767C",label:"Uniswap SwapRouter02 (Abstract deployment)",verified:{method:"eth_getCode returned 167392 bytes and the runtime contains the exactInputSingle selector. router.factory() matches the factory proved above and router.WETH9() matches the wrappedNative on this entry. Chosen over its byte-identical twin (0xfD6257F4...) because this is the address real users actually route through: it appeared as tx.to on live swaps against the WETH/USDC.e pool.",source:"on-chain factory()/WETH9() round-trip + live swap tx.to sampling",date:"2026-08-05",chainId:2741}}]},{key:"robinhood",chainId:4663,name:"Robinhood Chain",rpcEnv:["RH_CHAIN_RPC","ROBINHOOD_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},dexscreenerSlug:"robinhood",venueKind:"uniswap-v3",wrappedNative:"0x0bd7d308f8e1639fab988df18a8011f41eacad73",stableQuoteAssets:["0x5fc5360d0400a0fd4f2af552add042d716f1d168"],venues:[{kind:"quoter",address:"0x33e885ed0ec9bf04ecfb19341582aadcb4c8a9e7",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDG fee 100 quoted 1866.58 USDG, and USDG->CASHCAT fee 10000 quoted a live amount). A contract that correctly prices known pairs IS a working V3 quoter",source:"live eth_call against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"router",address:"0xcaf681a66d020601342297493863e78c959e5cb2",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode (24497 bytes) on this chain and the paired quoter at the same deployment passed a live functional quote",source:"live eth_getCode against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}},{kind:"factory",address:"0x1f7d7550b1b028f7571e69a784071f0205fd2efa",label:"Uniswap V3 Factory",verified:{method:"eth_getCode returned real bytecode (24535 bytes) and a PoolCreated log scan over this factory returned 76 pools in ~9000 recent blocks",source:"live eth_getLogs against rpc.mainnet.chain.robinhood.com",date:"2026-07-31",chainId:4663}}]},{key:"base",chainId:8453,name:"Base",rpcEnv:["BASE_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://basescan.org",dexscreenerSlug:"base",venueKind:"uniswap-v3",wrappedNative:"0x4200000000000000000000000000000000000006",stableQuoteAssets:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"],venues:[{kind:"quoter",address:"0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a",label:"Uniswap V3 QuoterV2 (Base)",verified:{method:"functional probe: quoteExactInputSingle returned WETH->USDC at fee 500 = 1908.44 USDC, a live sane price. The canonical mainnet quoter address also has bytecode on Base but does NOT price this pair, which is exactly the false positive a codesize-only check accepts",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router",address:"0x2626664c2603336E57B271c5C0b26F421741e481",label:"Uniswap V3 SwapRouter02 (Base)",verified:{method:"eth_getCode returned real bytecode and the paired Base quoter passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:8453}},{kind:"router-v2",address:"0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24",label:"Uniswap V2 Router02 (Base)",verified:{method:"eth_getCode returned 17891 bytes; live getAmountsOut on WETH->USDC round-tripped to 98.75% (2x0.30% fee + impact)",source:"https://docs.uniswap.org/contracts/v2/reference/smart-contracts/v2-deployments",date:"2026-07-30",chainId:8453}}]},{key:"arbitrum",chainId:42161,name:"Arbitrum One",rpcEnv:["ARBITRUM_RPC_URL","ARB_RPC_URL"],nativeCurrency:{symbol:"ETH",decimals:18},explorer:"https://arbiscan.io",dexscreenerSlug:"arbitrum",venueKind:"uniswap-v3",wrappedNative:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",stableQuoteAssets:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"],venues:[{kind:"quoter",address:"0x61fFE014bA17989E743c5F6cB21bF9697530B21e",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WETH->USDC fee 500 quoted 1908.72 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}},{kind:"router",address:"0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:42161}}]},{key:"avalanche",chainId:43114,name:"Avalanche C-Chain",rpcEnv:["AVALANCHE_RPC_URL","AVAX_RPC_URL"],nativeCurrency:{symbol:"AVAX",decimals:18},explorer:"https://snowtrace.io",dexscreenerSlug:"avalanche",venueKind:"uniswap-v3",wrappedNative:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",stableQuoteAssets:["0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"],venues:[{kind:"quoter",address:"0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F",label:"Uniswap V3 QuoterV2",verified:{method:"functional probe, not a codesize check: quoteExactInputSingle returned a live sane price (WAVAX->USDC fee 500 quoted 6.48 USDC). A contract that correctly prices a known pair IS a working V3 quoter",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}},{kind:"router",address:"0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE",label:"Uniswap V3 SwapRouter02",verified:{method:"eth_getCode returned real bytecode on this chain and the paired quoter at the same deployment passed a live functional quote",source:"scripts/verify-v3-venues.mjs (re-runnable)",date:"2026-07-30",chainId:43114}}]}]);function vt(){return qe.map(t=>z(ie(t)))}function yt(t){return z(ie(t))}export{qe as CHAIN_CONFIGS,y as EVIDENCE,m as RISK,O as SCANNER_CAPABILITIES,Et as __clearScanners,Pe as createScanner,wt as getScanner,gt as listScanners,vt as registerBuiltinScanners,yt as registerCustomChain,z as registerScanner,St as scannerCoverage,Be as validateScanner};