Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Add unit tests for Journal, KillSwitch, and RiskEngine; implement MCP server for AI integration
fudjia55369125ec03
diff --git a/pages/markets-robinhood.html b/pages/markets-robinhood.htmlnew file mode 100644index 000000000..9cc1457a6--- /dev/null+++ b/pages/markets-robinhood.html@@ -0,0 +1,104 @@+<!doctype html>+<html lang="en" class="cv-page" data-shell>+ <head>+ <script>+ /* three.ws theme boot — no-flash; runtime in /theme-switcher.js */ (function () {+ try {+ var m = localStorage.getItem('twx_theme');+ var l =+ m === 'auto'+ ? window.matchMedia &&+ window.matchMedia('(prefers-color-scheme: light)').matches+ : m === 'light';+ document.documentElement.setAttribute('data-theme', l ? 'light' : 'dark');+ } catch (e) {+ document.documentElement.setAttribute('data-theme', 'dark');+ }+ })();+ </script>+ <meta charset="utf-8" />+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />+ <title>Robinhood Chain — Stock Tokens, memecoins & chain stats · three.ws</title>+ <meta+ name="description"+ content="Live Robinhood Chain (4663) market data: the 24/7 tokenized-equity board with Chainlink NAV vs DEX premium for every Stock Token, a memecoin screener (NOXA / The Odyssey), recent launches, and chain TVL — real on-chain and DeFiLlama data, no API key."+ />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="three.ws" />+ <meta property="og:url" content="https://three.ws/markets/robinhood" />+ <meta property="og:title" content="Robinhood Chain — Stock Tokens, memecoins & chain stats · three.ws" />+ <meta+ property="og:description"+ content="Live Robinhood Chain market data — Stock Token board with Chainlink NAV vs DEX premium, a memecoin screener, recent launches, and chain TVL."+ />+ <meta+ property="og:image"+ content="https://three.ws/api/page-og?s=crypto&t=Robinhood+Chain&d=Live+Stock+Token+board%2C+memecoin+screener%2C+and+chain+TVL+for+Robinhood+Chain&p=%2Fmarkets%2Frobinhood"+ />+ <meta property="og:image:width" content="1200" />+ <meta property="og:image:height" content="630" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:site" content="@trythreews" />+ <meta name="twitter:title" content="Robinhood Chain · three.ws" />+ <meta+ name="twitter:description"+ content="Live Stock Token board, memecoin screener, and chain TVL for Robinhood Chain."+ />+ <meta+ name="twitter:image"+ content="https://three.ws/api/page-og?s=crypto&t=Robinhood+Chain&d=Live+Stock+Token+board%2C+memecoin+screener%2C+and+chain+TVL+for+Robinhood+Chain&p=%2Fmarkets%2Frobinhood"+ />+ <meta name="theme-color" content="#09090b" />+ <link rel="icon" href="/favicon.ico" sizes="any" />+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />+ <link rel="manifest" href="/manifest.webmanifest" />+ <link rel="stylesheet" href="/fonts/fonts.css" />+ <link rel="stylesheet" href="/nav.css" />+ <link rel="stylesheet" href="/src/coin-pages.css" />+ <link rel="stylesheet" href="/src/chain-page.css" />+ <link rel="stylesheet" href="/src/robinhood.css" />+ <link rel="stylesheet" href="/footer.css" />+ <link rel="canonical" href="https://three.ws/markets/robinhood" />+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />+ <meta property="og:locale" content="en_US" />+ <meta property="og:image:alt" content="Robinhood Chain markets — three.ws" />+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Robinhood Chain","description":"Live Robinhood Chain market data — Stock Token board, memecoin screener, recent launches, and chain TVL.","url":"https://three.ws/markets/robinhood","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"}}]}</script>+ </head>+ <body>+ <header><div id="nav-container"></div></header>+ <script src="/nav.js"></script>++ <main class="cv-container" id="rh-main">+ <nav class="cv-crumbs" aria-label="Breadcrumb">+ <a href="/markets">Markets</a>+ <span class="sep" aria-hidden="true">/</span>+ <span class="here">Robinhood Chain</span>+ </nav>++ <h1 class="cv-h1">Robinhood Chain</h1>+ <p class="cv-sub">+ A permissionless Arbitrum Orbit L2 tokenizing ~95 US equities 24/7, alongside a live memecoin+ ecosystem. Chainlink NAV vs DEX premium for every Stock Token, a memecoin screener, recent+ launches, and chain stats — real on-chain and DeFiLlama data.+ </p>++ <div class="rh-tabs" role="tablist" aria-label="Robinhood Chain views">+ <button type="button" class="rh-tab is-active" data-tab="stocks" role="tab" aria-selected="true" id="rh-tab-stocks">Stocks</button>+ <button type="button" class="rh-tab" data-tab="coins" role="tab" aria-selected="false" id="rh-tab-coins">Coins</button>+ <button type="button" class="rh-tab" data-tab="chain" role="tab" aria-selected="false" id="rh-tab-chain">Chain</button>+ </div>++ <section id="rh-panel-stocks" class="rh-panel" role="tabpanel" aria-labelledby="rh-tab-stocks"></section>+ <section id="rh-panel-coins" class="rh-panel" role="tabpanel" aria-labelledby="rh-tab-coins" hidden></section>+ <section id="rh-panel-chain" class="rh-panel" role="tabpanel" aria-labelledby="rh-tab-chain" hidden></section>++ <p class="cv-updated" id="rh-updated" hidden></p>+ </main>++ <script type="module" src="/src/markets-robinhood.js"></script>+ <script src="/brand.js" defer></script>+ <div id="footer-container"></div>+ <script src="/footer.js"></script>+ </body>+</html>diff --git a/robinhood/hood-api/src/app.ts b/robinhood/hood-api/src/app.tsnew file mode 100644index 000000000..eb0d3b2e9--- /dev/null+++ b/robinhood/hood-api/src/app.ts@@ -0,0 +1,67 @@+import { OpenAPIHono } from '@hono/zod-openapi'+import { cors } from 'hono/cors'+import { ApiError } from './lib/errors.js'+import { env, paymentsEnabled } from './lib/env.js'+import { buildX402Middleware } from './lib/x402.js'+import { freeRoutes } from './routes/free.js'+import { paidRoutes } from './routes/paid.js'+import pkg from '../package.json' with { type: 'json' }++export function createApp() {+ const app = new OpenAPIHono()++ app.use('*', cors({ origin: '*', allowMethods: ['GET', 'OPTIONS'] }))++ // x402 payment gate mounts BEFORE the paid routes so unpaid requests never+ // reach a handler. Only registered when X402_PAY_TO is configured — without+ // it, paid routes fall straight through to their own 503 "not configured".+ const x402 = buildX402Middleware()+ if (x402) app.use('*', x402)++ app.route('/', freeRoutes)+ app.route('/', paidRoutes)++ app.notFound((c) =>+ c.json(+ {+ error: 'not_found',+ hint: `No route for ${c.req.method} ${c.req.path}. See /v1/openapi.json for the full endpoint list.`,+ docs: 'https://nirholas.github.io/hood-api/',+ },+ 404,+ ),+ )++ app.onError((err, c) => {+ if (err instanceof ApiError) return c.json(err.toBody(), err.status as 400 | 404 | 502 | 503)+ console.error('[hood-api] unhandled error:', err)+ return c.json(+ { error: 'internal_error', hint: 'Unexpected server error. Please retry; if it persists, file an issue.', docs: 'https://github.com/nirholas/hood-api/issues' },+ 500,+ )+ })++ app.doc31('/v1/openapi.json', {+ openapi: '3.1.0',+ info: {+ title: 'hood-api',+ version: pkg.version,+ description:+ 'Hosted market-data API for Robinhood Chain (chain ID 4663): Stock Tokens with Chainlink + DEX ' ++ 'premium/discount, memecoin launchpads, multiplier-correct portfolios, cross-venue tokenized-equity ' ++ 'spreads, and a real-time firehose. Free tier is IP-rate-limited; paid endpoints are metered via x402.',+ license: { name: 'MIT' },+ contact: { name: 'nirholas', url: 'https://x.com/nichxbt' },+ },+ servers: [{ url: env.publicBaseUrl, description: paymentsEnabled() ? 'This deployment' : 'This deployment (payments disabled)' }],+ tags: [+ { name: 'Health', description: 'Liveness and status' },+ { name: 'Chain', description: 'Chain-wide stats' },+ { name: 'Stocks', description: 'Stock Token market data (free)' },+ { name: 'Coins', description: 'Memecoin launchpad data (free)' },+ { name: 'Paid', description: 'x402-metered endpoints' },+ ],+ })++ return app+}diff --git a/robinhood/hood-api/src/index.ts b/robinhood/hood-api/src/index.tsnew file mode 100644index 000000000..f143e224c--- /dev/null+++ b/robinhood/hood-api/src/index.ts@@ -0,0 +1,72 @@+import { serve } from '@hono/node-server'+import { createNodeWebSocket } from '@hono/node-ws'+import { createApp } from './app.js'+import { env } from './lib/env.js'+import { verifySession } from './lib/firehose-session.js'+import { subscribe, ALL_CHANNELS, type ChannelName } from './services/firehose-hub.js'++const app = createApp()+const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app })++app.get(+ '/v1/ws',+ upgradeWebSocket((c) => {+ const token = c.req.query('token')+ const check = verifySession(token)+ const channelsParam = c.req.query('channels')+ const wanted = new Set<ChannelName>(+ channelsParam+ ? (channelsParam.split(',').filter((ch): ch is ChannelName => (ALL_CHANNELS as string[]).includes(ch)) as ChannelName[])+ : ALL_CHANNELS,+ )++ let unsubscribe: (() => void) | null = null++ return {+ onOpen(_evt, ws) {+ if (!check.ok) {+ ws.send(JSON.stringify({ error: 'session_invalid', hint: check.reason }))+ ws.close(4401, 'invalid session')+ return+ }+ ws.send(+ JSON.stringify({+ type: 'connected',+ channels: [...wanted],+ note: 'One message per event; filter client-side on `channel` or use ?channels=firehose,ticks to subscribe narrower.',+ }),+ )+ unsubscribe = subscribe((event) => {+ if (!wanted.has(event.channel)) return+ try {+ ws.send(JSON.stringify(event))+ } catch {+ // socket closing mid-emit; onClose will clean up+ }+ })+ },+ onClose() {+ unsubscribe?.()+ unsubscribe = null+ },+ onError() {+ unsubscribe?.()+ unsubscribe = null+ },+ }+ }),+)++const server = serve({ fetch: app.fetch, port: env.port }, (info) => {+ console.log(`[hood-api] listening on :${info.port} — ${env.publicBaseUrl}`)+ console.log(`[hood-api] docs: /v1/openapi.json — health: /v1/health`)+})+injectWebSocket(server)++function shutdown(signal: string) {+ console.log(`[hood-api] ${signal} received, shutting down`)+ server.close(() => process.exit(0))+ setTimeout(() => process.exit(1), 5000).unref()+}+process.on('SIGINT', () => shutdown('SIGINT'))+process.on('SIGTERM', () => shutdown('SIGTERM'))diff --git a/robinhood/hood-api/src/lib/errors.ts b/robinhood/hood-api/src/lib/errors.tsindex 7dad82325..f19586a23 100644--- a/robinhood/hood-api/src/lib/errors.ts+++ b/robinhood/hood-api/src/lib/errors.ts@@ -14,13 +14,16 @@ export interface ApiErrorBody {const DOCS_BASE = 'https://nirholas.github.io/hood-api'+/** Every HTTP status an ApiError can carry — a closed literal union so route handlers typecheck against `default`. */+export type ApiErrorStatus = 400 | 401 | 404 | 451 | 500 | 502 | 503+export class ApiError extends Error {- readonly status: number+ readonly status: ApiErrorStatusreadonly code: stringreadonly hint: stringreadonly docsPath: string- constructor(status: number, code: string, hint: string, docsPath = '/#errors') {+ constructor(status: ApiErrorStatus, code: string, hint: string, docsPath = '/#errors') {super(`${code}: ${hint}`)this.name = 'ApiError'this.status = statusdiff --git a/robinhood/hood-api/src/routes/free.ts b/robinhood/hood-api/src/routes/free.tsindex 35354724a..e07dadcfe 100644--- a/robinhood/hood-api/src/routes/free.ts+++ b/robinhood/hood-api/src/routes/free.ts@@ -1,14 +1,7 @@import { createRoute, OpenAPIHono, z } from '@hono/zod-openapi'import { ApiError, toApiError } from '../lib/errors.js'import { nowIso } from '../lib/response.js'-import {- SymbolParam,- AddressParam,- LaunchesQuery,- CoinsQuery,- ErrorSchema,- LOOKBACK_BLOCKS,-} from '../schemas.js'+import { SymbolParam, AddressParam, LaunchesQuery, CoinsQuery, ErrorSchema, LOOKBACK_BLOCKS } from '../schemas.js'import { getChain } from '../services/chain.js'import { listStocks, getStockDetail } from '../services/stocks.js'import { listCoins, getCoinDetail } from '../services/coins.js'@@ -20,11 +13,7 @@ import pkg from '../../package.json' with { type: 'json' }export const freeRoutes = new OpenAPIHono()const JsonBody = z.record(z.string(), z.unknown())--function fail(err: unknown) {- const apiErr = toApiError(err)- return { status: apiErr.status, body: apiErr.toBody() } as const-}+const errorResponse = { content: { 'application/json': { schema: ErrorSchema } }, description: 'Error' } as const// ---- /v1/health ----freeRoutes.openapi(@@ -64,15 +53,15 @@ freeRoutes.openapi(summary: 'Chain stats: block height, gas, TVL, ETH price',responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Chain stats' },- 502: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Upstream unavailable' },+ default: errorResponse,},}),async (c) => {try {- return c.json(await getChain())+ return c.json(await getChain(), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -86,15 +75,15 @@ freeRoutes.openapi(summary: 'All Stock Tokens: Chainlink price, DEX price, premium/discount, liquidity',responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Stock Token list' },- 502: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Upstream unavailable' },+ default: errorResponse,},}),async (c) => {try {- return c.json(await listStocks())+ return c.json(await listStocks(), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -112,17 +101,17 @@ freeRoutes.openapi(},responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Stock Token detail' },- 404: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Unknown symbol' },+ default: errorResponse,},}),async (c) => {const { symbol } = c.req.valid('param')const { interval } = c.req.valid('query')try {- return c.json(await getStockDetail(symbol, interval ?? '1h'))+ return c.json(await getStockDetail(symbol, interval ?? '1h'), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -137,15 +126,16 @@ freeRoutes.openapi(request: { query: CoinsQuery },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Coin list' },+ default: errorResponse,},}),async (c) => {const { limit } = c.req.valid('query')try {- return c.json(await listCoins({ limit }))+ return c.json(await listCoins({ limit }), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -160,16 +150,16 @@ freeRoutes.openapi(request: { params: AddressParam },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Coin detail' },- 400: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Invalid address' },+ default: errorResponse,},}),async (c) => {const { address } = c.req.valid('param')try {- return c.json(await getCoinDetail(address))+ return c.json(await getCoinDetail(address), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -184,16 +174,17 @@ freeRoutes.openapi(request: { query: LaunchesQuery },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Launch list' },+ default: errorResponse,},}),async (c) => {const { launchpad, lookback, limit } = c.req.valid('query')const lookbackBlocks = lookback ? LOOKBACK_BLOCKS[lookback] : undefinedtry {- return c.json(await getLaunches({ launchpad, lookbackBlocks, limit }))+ return c.json(await getLaunches({ launchpad, lookbackBlocks, limit }), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)diff --git a/robinhood/hood-api/src/routes/paid.ts b/robinhood/hood-api/src/routes/paid.tsindex eae732d0c..d4712fcf3 100644--- a/robinhood/hood-api/src/routes/paid.ts+++ b/robinhood/hood-api/src/routes/paid.ts@@ -12,11 +12,7 @@ import { withMeta } from '../lib/response.js'export const paidRoutes = new OpenAPIHono()const JsonBody = z.record(z.string(), z.unknown())--function fail(err: unknown) {- const apiErr = toApiError(err)- return { status: apiErr.status, body: apiErr.toBody() } as const-}+const errorResponse = { content: { 'application/json': { schema: ErrorSchema } }, description: 'Error' } as const// ---- /v1/portfolio/:address ----paidRoutes.openapi(@@ -28,21 +24,20 @@ paidRoutes.openapi(request: { params: AddressParam },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Portfolio' },- 400: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Invalid address' },- 503: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Payments not configured' },+ default: errorResponse,},}),async (c) => {if (!paymentsEnabled()) {const apiErr = ApiError.paymentsDisabled()- return c.json(apiErr.toBody(), 503)+ return c.json(apiErr.toBody(), apiErr.status)}const { address } = c.req.valid('param')try {- return c.json(await getPortfolioValuation(address))+ return c.json(await getPortfolioValuation(address), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -57,23 +52,22 @@ paidRoutes.openapi(request: { params: SymbolParam, query: HistoryQuery },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'History' },- 404: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Unknown symbol / no history' },- 503: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Payments not configured' },+ default: errorResponse,},}),async (c) => {if (!paymentsEnabled()) {const apiErr = ApiError.paymentsDisabled()- return c.json(apiErr.toBody(), 503)+ return c.json(apiErr.toBody(), apiErr.status)}const { symbol } = c.req.valid('param')const { interval, lookback } = c.req.valid('query')const lookbackBlocks = LOOKBACK_BLOCKS[lookback ?? '7d'] ?? LOOKBACK_BLOCKS['7d']!try {- return c.json(await getStockHistory(symbol, interval ?? '1h', lookbackBlocks))+ return c.json(await getStockHistory(symbol, interval ?? '1h', lookbackBlocks), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -88,20 +82,20 @@ paidRoutes.openapi(request: { query: EquitiesListQuery },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Cross-venue list' },- 503: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Payments not configured' },+ default: errorResponse,},}),async (c) => {if (!paymentsEnabled()) {const apiErr = ApiError.paymentsDisabled()- return c.json(apiErr.toBody(), 503)+ return c.json(apiErr.toBody(), apiErr.status)}const { limit } = c.req.valid('query')try {- return c.json(await listEquities(limit ?? 10))+ return c.json(await listEquities(limit ?? 10), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -116,21 +110,20 @@ paidRoutes.openapi(request: { params: SymbolParam },responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Cross-venue row' },- 404: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Unknown symbol' },- 503: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Payments not configured' },+ default: errorResponse,},}),async (c) => {if (!paymentsEnabled()) {const apiErr = ApiError.paymentsDisabled()- return c.json(apiErr.toBody(), 503)+ return c.json(apiErr.toBody(), apiErr.status)}const { symbol } = c.req.valid('param')try {- return c.json(await getEquity(symbol))+ return c.json(await getEquity(symbol), 200)} catch (err) {- const { status, body } = fail(err)- return c.json(body, status)+ const apiErr = toApiError(err)+ return c.json(apiErr.toBody(), apiErr.status)}},)@@ -144,13 +137,13 @@ paidRoutes.openapi(summary: `Mint a metered session token for the real-time /v1/ws firehose (x402, ${PRICES.firehoseToken})`,responses: {200: { content: { 'application/json': { schema: JsonBody } }, description: 'Session token' },- 503: { content: { 'application/json': { schema: ErrorSchema } }, description: 'Payments not configured' },+ default: errorResponse,},}),async (c) => {if (!paymentsEnabled()) {const apiErr = ApiError.paymentsDisabled()- return c.json(apiErr.toBody(), 503)+ return c.json(apiErr.toBody(), apiErr.status)}const session = mintSession()return c.json(@@ -164,6 +157,7 @@ paidRoutes.openapi(},['robinhood-chain-sequencer'],),+ 200,)},)diff --git a/robinhood/hood-js/docs/index.html b/robinhood/hood-js/docs/index.htmlnew file mode 100644index 000000000..9ed288ebc--- /dev/null+++ b/robinhood/hood-js/docs/index.html@@ -0,0 +1,327 @@+<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>hood-js — five lines to your first Robinhood Chain trade</title>+<meta name="description" content="The 'just works' wrapper for Robinhood Chain (4663): stock prices, portfolios, trending memecoins, launch streams, and swaps in one import.">+<link rel="stylesheet" href="./site.css">+<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='.9em' font-size='90'%3E%F0%9F%AA%B6%3C/text%3E%3C/svg%3E">+</head>+<body>++<nav class="top" aria-label="Site">+ <div class="wrap">+ <a class="brand" href="./index.html">hood<span class="tick">-js</span></a>+ <div class="links">+ <a href="#repl">Try it live</a>+ <a href="#quickstart" class="hide-sm">Quickstart</a>+ <a href="#api">API</a>+ <a href="https://github.com/nirholas/hood-js">GitHub</a>+ </div>+ </div>+</nav>++<header class="hero wrap">+ <h1>Five lines to your<br><span class="grad">first Robinhood Chain trade</span></h1>+ <p class="lede">+ One import, sensible defaults, promise-first. Stock Token prices, multiplier-correct+ portfolios, trending memecoins, live launch streams, and swaps — chain ID 4663, public+ RPC by default. No wallet needed until you actually swap.+ </p>+ <div class="cta">+ <span class="install"><span class="dollar">$</span> npm install hood-js viem</span>+ <a class="btn primary" href="#repl">Try it live</a>+ <a class="btn" href="#quickstart">Quickstart</a>+ </div>+</header>++<main class="wrap">++<section class="block" id="repl">+ <div class="repl-head">+ <h2>Type a real call. Get a real answer.</h2>+ <span class="status" id="repl-status"><span class="dot"></span><span id="repl-status-text">loading viem + registry…</span></span>+ </div>+ <p class="sub">+ This runs live in your browser — real <code>eth_call</code>s to Robinhood Chain's public+ RPC and a real fetch to GeckoTerminal, using <a href="https://esm.sh/viem">viem via esm.sh</a>+ (no bundler, no server, no fake data). Supports <code>price</code>, <code>prices</code>,+ <code>coins</code>, and single-hop <code>quote</code>. <code>portfolio</code> and+ <code>swap</code> need the full package in Node.+ </p>++ <div class="repl">+ <div class="repl-out" id="repl-out" aria-live="polite"></div>+ <form class="repl-form" id="repl-form">+ <span class="prompt">></span>+ <input id="repl-input" type="text" autocomplete="off" spellcheck="false"+ placeholder="hood.price('TSLA')" aria-label="hood-js command">+ <button type="submit" id="repl-run">Run</button>+ </form>+ </div>+ <div class="repl-chips">+ <button class="chip" data-cmd="hood.price('TSLA')">hood.price('TSLA')</button>+ <button class="chip" data-cmd="hood.prices(['AAPL','TSLA','NVDA'])">hood.prices([...])</button>+ <button class="chip" data-cmd="hood.coins({limit:5})">hood.coins({limit:5})</button>+ <button class="chip" data-cmd="hood.quote({sell:'USDG',buy:'WETH',amount:100})">hood.quote({...})</button>+ </div>+</section>++<section class="block" id="quickstart">+ <h2>Quickstart</h2>+ <p class="sub">Node ≥ 20. viem is a peer dependency.</p>+<pre><code>npm install hood-js viem</code></pre>+<pre><code>import hood from 'hood-js'++const { usd } = await hood.price('AAPL')+console.log(`AAPL: $${usd}`)++const top = await hood.coins({ limit: 5 })+for (const c of top) console.log(c.symbol, `$${c.priceUsd}`, `${c.change24h}%`)++const q = await hood.quote({ sell: 'USDG', buy: 'WETH', amount: 100 })+const { hash, url } = await hood.swap({ ...q, wallet: process.env.PK })+console.log('done:', url)</code></pre>+</section>++<section class="block" id="api">+ <h2>API reference</h2>+ <p class="sub">Every read needs nothing — no key, no wallet. Only <code>swap</code> does.</p>+ <div class="table-scroll">+ <table>+ <thead><tr><th>Call</th><th>Returns</th><th>Wallet?</th></tr></thead>+ <tbody>+ <tr><td><code>hood.price(symbol)</code></td><td>live USD price for one Stock Token</td><td>no</td></tr>+ <tr><td><code>hood.prices([symbols])</code></td><td>batched multicall, same order</td><td>no</td></tr>+ <tr><td><code>hood.portfolio(address)</code></td><td>multiplier-correct, USD-valued positions</td><td>no</td></tr>+ <tr><td><code>hood.coins({ limit?, window? })</code></td><td>trending memecoins (launchpads + Uniswap)</td><td>no</td></tr>+ <tr><td><code>hood.launches({ live? }, cb?)</code></td><td>recent or streamed NOXA / Odyssey launches</td><td>no</td></tr>+ <tr><td><code>hood.quote({ sell, buy, amount })</code></td><td>a swap quote — spread into <code>swap()</code></td><td>no</td></tr>+ <tr><td><code>hood.swap({ ...quote, wallet })</code></td><td>executed swap: hash, url, amounts</td><td><strong>yes</strong></td></tr>+ <tr><td><code>hood.config({ ... })</code></td><td><code>hood</code> (chainable)</td><td>—</td></tr>+ <tr><td><code>hood.testnet()</code> / <code>hood.mainnet()</code></td><td><code>hood</code> (chainable)</td><td>—</td></tr>+ </tbody>+ </table>+ </div>++ <div class="disclosure">+ <strong>Stock Token eligibility.</strong> Stock Tokens are tokenized debt securities+ (issuer: Robinhood Assets (Jersey) Ltd) and may not be offered, sold, or delivered to US+ persons (additional limits: Canada, UK, Switzerland). Reading data is unrestricted;+ buying one throws until you call <code>hood.config({ acknowledgeEligibility: true })</code>,+ affirming eligibility. Memecoins are never gated.+ </div>+</section>++<section class="block" id="errors">+ <h2>One error type, always friendly</h2>+ <p class="sub">Never a raw viem stack trace — a <code>HoodError</code> with a plain-language message and a stable <code>code</code>.</p>+ <div class="grid">+ <div class="card"><h3>Offline validation</h3><p>Bad arguments (empty symbol, negative amount, missing wallet) fail instantly with <code>BAD_INPUT</code> — no network round-trip.</p></div>+ <div class="card"><h3>Typed codes</h3><p><code>UNKNOWN_SYMBOL</code>, <code>NO_FEED</code>, <code>STALE_PRICE</code>, <code>NO_ROUTE</code>, <code>NEEDS_WALLET</code>, <code>NEEDS_ELIGIBILITY</code>, and more.</p></div>+ <div class="card"><h3><code>cause</code> preserved</h3><p>The original hoodchain/viem error rides along on <code>err.cause</code> for debugging — nothing is hidden, just translated.</p></div>+ </div>+</section>++</main>++<footer>+ <div class="wrap">+ <span>MIT © 2026 nirholas</span>+ <span>Built by <a href="https://x.com/nichxbt">nirholas</a> · <a href="https://three.ws">three.ws</a></span>+ </div>+</footer>++<script type="module">+import { createPublicClient, http, parseUnits, formatUnits } from 'https://esm.sh/[email protected]'+import { robinhood } from 'https://esm.sh/[email protected]/chains'++const aggregatorV3Abi = [+ { type: 'function', name: 'latestRoundData', stateMutability: 'view', inputs: [],+ outputs: [+ { name: 'roundId', type: 'uint80' }, { name: 'answer', type: 'int256' },+ { name: 'startedAt', type: 'uint256' }, { name: 'updatedAt', type: 'uint256' },+ { name: 'answeredInRound', type: 'uint80' },+ ] },+]+const quoterV2Abi = [+ { type: 'function', name: 'quoteExactInputSingle', stateMutability: 'nonpayable',+ inputs: [{ name: 'params', type: 'tuple', components: [+ { name: 'tokenIn', type: 'address' }, { name: 'tokenOut', type: 'address' },+ { name: 'amountIn', type: 'uint256' }, { name: 'fee', type: 'uint24' },+ { name: 'sqrtPriceLimitX96', type: 'uint160' } ] }],+ outputs: [+ { name: 'amountOut', type: 'uint256' }, { name: 'sqrtPriceX96After', type: 'uint160' },+ { name: 'initializedTicksCrossed', type: 'uint32' }, { name: 'gasEstimate', type: 'uint256' } ] },+]++// Verified mainnet addresses (see robinhood-chain-sdk/src/addresses.ts — same source of truth).+const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168'+const WETH = '0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73'+const QUOTER_V2 = '0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7'+const V3_FEE_TIERS = [100, 500, 3000, 10000]+const USDG_DECIMALS = 6++const statusEl = document.getElementById('repl-status')+const statusText = document.getElementById('repl-status-text')+const outEl = document.getElementById('repl-out')+const form = document.getElementById('repl-form')+const input = document.getElementById('repl-input')+const runBtn = document.getElementById('repl-run')++let client, bySymbol+let ready = false++function line(cls, text) {+ const div = document.createElement('div')+ div.className = 'repl-line ' + cls+ div.textContent = text+ outEl.appendChild(div)+ outEl.scrollTop = outEl.scrollHeight+}++function echo(cmd) {+ const div = document.createElement('div')+ div.className = 'repl-line in'+ div.innerHTML = '<span class="prompt">></span>'+ div.appendChild(document.createTextNode(cmd))+ outEl.appendChild(div)+ outEl.scrollTop = outEl.scrollHeight+}++function looseParse(argsSrc) {+ let t = argsSrc.replace(/([{,]\s*)([A-Za-z_$][\w$]*)\s*:/g, '$1"$2":')+ t = t.replace(/'([^']*)'/g, '"$1"')+ return JSON.parse('[' + t + ']')+}++async function price(symbol) {+ const token = bySymbol.get(String(symbol).toUpperCase())+ if (!token) throw new Error(`"${symbol}" is not a known Stock Token. Try AAPL, TSLA, NVDA, MSFT…`)+ if (!token.feed) throw new Error(`"${token.symbol}" has no live Chainlink feed — can't be priced.`)+ const round = await client.readContract({ address: token.feed, abi: aggregatorV3Abi, functionName: 'latestRoundData' })+ return { symbol: token.symbol, usd: Number(round[1]) / 1e8, updatedAt: new Date(Number(round[3]) * 1000).toISOString() }+}++async function prices(symbols) {+ if (!Array.isArray(symbols)) throw new Error('prices() needs an array of tickers.')+ return Promise.all(symbols.map((s) => price(s).catch(() => ({ symbol: s, usd: null, updatedAt: null }))))+}++async function coins(opts = {}) {+ const limit = opts.limit ?? 10+ const url = `https://api.geckoterminal.com/api/v2/networks/robinhood/trending_pools?include=base_token,dex&duration=24h&page=1`+ const res = await fetch(url, { headers: { accept: 'application/json' } })+ if (!res.ok) throw new Error(`GeckoTerminal HTTP ${res.status}`)+ const body = await res.json()+ const tokenById = new Map((body.included || []).filter((i) => i.type === 'token').map((i) => [i.id, i]))+ return (body.data || []).slice(0, limit).map((pool) => {+ const a = pool.attributes+ const baseId = pool.relationships?.base_token?.data?.id+ const base = baseId ? tokenById.get(baseId) : undefined+ return {+ symbol: base?.attributes?.symbol ?? a.name.split(' / ')[0],+ priceUsd: Number(a.base_token_price_usd) || 0,+ change24h: a.price_change_percentage?.h24 != null ? Number(a.price_change_percentage.h24) : null,+ dex: pool.relationships?.dex?.data?.id ?? 'unknown',+ }+ })+}++async function resolveAddr(ref) {+ const upper = String(ref).toUpperCase()+ if (upper === 'USDG') return { address: USDG, decimals: USDG_DECIMALS, label: 'USDG' }+ if (upper === 'WETH' || upper === 'ETH') return { address: WETH, decimals: 18, label: 'WETH' }+ const token = bySymbol.get(upper)+ if (!token) throw new Error(`"${ref}" isn't USDG/WETH or a known Stock Token. The in-browser demo only quotes those (memecoins need the Node package).`)+ return { address: token.address, decimals: token.decimals, label: token.symbol }+}++async function quote({ sell, buy, amount }) {+ if (sell == null || buy == null || amount == null) throw new Error('quote needs { sell, buy, amount }.')+ const tokenIn = await resolveAddr(sell)+ const tokenOut = await resolveAddr(buy)+ const amountIn = parseUnits(String(amount), tokenIn.decimals)+ let best = null+ for (const fee of V3_FEE_TIERS) {+ try {+ const { result } = await client.simulateContract({+ address: QUOTER_V2, abi: quoterV2Abi, functionName: 'quoteExactInputSingle',+ args: [{ tokenIn: tokenIn.address, tokenOut: tokenOut.address, amountIn, fee, sqrtPriceLimitX96: 0n }],+ })+ if (!best || result[0] > best.amountOut) best = { fee, amountOut: result[0] }+ } catch { /* pool at this tier may not exist or has no liquidity for this size */ }+ }+ if (!best) throw new Error(`No direct v3 pool with liquidity for ${tokenIn.label} → ${tokenOut.label} at this amount. The in-browser demo only tries single-hop routes — the Node package also tries two-hop routes via WETH/USDG.`)+ const buyAmount = formatUnits(best.amountOut, tokenOut.decimals)+ return { sell: tokenIn.label, buy: tokenOut.label, sellAmount: String(amount), buyAmount, feeTier: best.fee }+}++const METHODS = { price, prices, coins, quote }++async function run(cmd) {+ echo(cmd)+ const match = cmd.trim().match(/^hood\.(\w+)\((.*)\)$/s)+ if (!match) {+ line('err', `Couldn't parse "${cmd}". Try: hood.price('TSLA')`)+ return+ }+ const [, methodName, argsSrc] = match+ const fn = METHODS[methodName]+ if (!fn) {+ line('err', `hood.${methodName}() isn't supported in this browser demo. Supported here: ${Object.keys(METHODS).join(', ')}. portfolio()/swap() need the Node package.`)+ return+ }+ if (!ready) {+ line('err', 'Still connecting to Robinhood Chain — try again in a second.')+ return+ }+ try {+ const args = looseParse(argsSrc)+ const result = await fn(...args)+ line('out', JSON.stringify(result, null, 2))+ } catch (err) {+ line('err', err.message || String(err))+ }+}++form.addEventListener('submit', (e) => {+ e.preventDefault()+ const cmd = input.value.trim()+ if (!cmd) return+ input.value = ''+ run(cmd)+})++document.querySelectorAll('.chip').forEach((chip) => {+ chip.addEventListener('click', () => {+ input.value = chip.dataset.cmd+ run(chip.dataset.cmd)+ })+})++async function init() {+ try {+ client = createPublicClient({ chain: robinhood, transport: http() })+ const res = await fetch('./stock-tokens.json')+ const registry = await res.json()+ bySymbol = new Map(registry.tokens.map((t) => [t.symbol.toUpperCase(), t]))+ const chainId = await client.getChainId()+ ready = true+ statusEl.className = 'status live'+ statusText.textContent = `live · chain ${chainId} · ${registry.tokenCount} Stock Tokens loaded`+ line('hint', `Connected to Robinhood Chain (${chainId}). Try a command below, or click a chip.`)+ run("hood.price('TSLA')")+ } catch (err) {+ statusEl.className = 'status error'+ statusText.textContent = 'connection failed'+ line('err', 'Could not load viem or the token registry: ' + (err?.message || err))+ }+}++init()+</script>++</body>+</html>diff --git a/robinhood/hood-js/docs/site.css b/robinhood/hood-js/docs/site.cssnew file mode 100644index 000000000..013e8e5f6--- /dev/null+++ b/robinhood/hood-js/docs/site.css@@ -0,0 +1,234 @@+/* hood-js docs — dark-first, one accent gradient, system type stack */+:root {+ --bg: #0a0a0c;+ --bg-raised: #121216;+ --bg-inset: #0e0e11;+ --border: #232329;+ --border-strong: #34343c;+ --text: #ededf0;+ --text-dim: #9c9ca6;+ --text-faint: #62626c;+ --accent-a: #7ef29a;+ --accent-b: #4cc9f0;+ --accent-grad: linear-gradient(96deg, var(--accent-a), var(--accent-b));+ --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;+ --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;+ --up: #6fe08a;+ --down: #f26d7e;+}+@media (prefers-color-scheme: light) {+ :root {+ --bg: #fbfbfc;+ --bg-raised: #ffffff;+ --bg-inset: #f2f2f4;+ --border: #e3e3e8;+ --border-strong: #cccdd4;+ --text: #16161a;+ --text-dim: #55555f;+ --text-faint: #85858f;+ }+}+* { box-sizing: border-box; }+html { scroll-behavior: smooth; }+body {+ margin: 0;+ background: var(--bg);+ color: var(--text);+ font: 15px/1.6 var(--sans);+ -webkit-font-smoothing: antialiased;+}+a { color: inherit; text-decoration: none; }+a:hover { color: var(--accent-a); }+a:focus-visible, button:focus-visible, input:focus-visible {+ outline: 2px solid var(--accent-b);+ outline-offset: 2px;+ border-radius: 4px;+}+code, pre { font-family: var(--mono); font-size: 0.86em; }+pre {+ background: var(--bg-inset);+ border: 1px solid var(--border);+ border-radius: 10px;+ padding: 16px 18px;+ overflow-x: auto;+ line-height: 1.55;+}+code:not(pre code) {+ background: var(--bg-raised);+ border: 1px solid var(--border);+ border-radius: 5px;+ padding: 1px 6px;+}++.wrap { max-width: 1060px; margin: 0 auto; padding: 0 22px; }++/* nav */+nav.top {+ position: sticky; top: 0; z-index: 10;+ background: color-mix(in srgb, var(--bg) 82%, transparent);+ backdrop-filter: blur(12px);+ border-bottom: 1px solid var(--border);+}+nav.top .wrap { display: flex; align-items: center; gap: 22px; height: 56px; }+.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 16px; }+.brand .tick { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }+nav.top .links { display: flex; gap: 18px; margin-left: auto; font-size: 14px; color: var(--text-dim); }+nav.top .links a { padding: 4px 2px; transition: color 0.15s ease; }++/* hero */+.hero { padding: 84px 0 40px; }+.hero h1 {+ font-size: clamp(30px, 5.4vw, 52px);+ line-height: 1.08;+ letter-spacing: -0.035em;+ margin: 0 0 14px;+ font-weight: 750;+}+.hero h1 .grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }+.hero p.lede { color: var(--text-dim); font-size: 17px; max-width: 620px; margin: 0 0 26px; }+.cta { display: flex; gap: 12px; flex-wrap: wrap; }+.btn {+ display: inline-flex; align-items: center; gap: 8px;+ border-radius: 8px; padding: 9px 18px; font-size: 14px; font-weight: 600;+ border: 1px solid var(--border-strong);+ background: var(--bg-raised);+ color: var(--text);+ cursor: pointer;+ transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;+}+.btn:hover { border-color: var(--accent-a); color: var(--text); transform: translateY(-1px); }+.btn.primary { background: var(--accent-grad); color: #0a0f0b; border: none; }+.btn.primary:hover { filter: brightness(1.06); color: #0a0f0b; }+.install {+ font-family: var(--mono); font-size: 13.5px;+ color: var(--text-dim);+ background: var(--bg-inset);+ border: 1px solid var(--border);+ border-radius: 8px; padding: 10px 16px;+ display: inline-flex; gap: 10px; align-items: center;+}+.install .dollar { color: var(--accent-a); user-select: none; }++/* REPL */+.repl-head { display: flex; align-items: baseline; gap: 12px; margin: 46px 0 14px; flex-wrap: wrap; }+.repl-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.02em; }+.status { font-size: 12.5px; color: var(--text-faint); }+.status .dot {+ display: inline-block; width: 7px; height: 7px; border-radius: 50%;+ background: var(--text-faint); margin-right: 6px;+ vertical-align: 1px;+ transition: background 0.3s ease;+}+.status.live .dot { background: var(--up); box-shadow: 0 0 6px color-mix(in srgb, var(--up) 70%, transparent); }+.status.error .dot { background: var(--down); }++.repl {+ background: var(--bg-inset);+ border: 1px solid var(--border);+ border-radius: 12px;+ overflow: hidden;+}+.repl-out {+ padding: 16px 18px;+ min-height: 220px;+ max-height: 420px;+ overflow-y: auto;+ font-family: var(--mono);+ font-size: 13.5px;+ line-height: 1.6;+}+.repl-line { margin: 0 0 4px; white-space: pre-wrap; word-break: break-word; }+.repl-line.in { color: var(--text); }+.repl-line.in .prompt { color: var(--accent-a); margin-right: 6px; }+.repl-line.out { color: var(--accent-b); }+.repl-line.err { color: var(--down); }+.repl-line.hint { color: var(--text-faint); }+.repl-form {+ display: flex; align-items: center; gap: 10px;+ border-top: 1px solid var(--border);+ padding: 10px 14px;+}+.repl-form .prompt { color: var(--accent-a); font-family: var(--mono); font-size: 13.5px; }+.repl-form input {+ flex: 1;+ background: transparent;+ border: none;+ color: var(--text);+ font-family: var(--mono);+ font-size: 13.5px;+ outline: none;+}+.repl-form button {+ background: var(--accent-grad);+ color: #0a0f0b;+ border: none;+ border-radius: 6px;+ font-weight: 600;+ font-size: 13px;+ padding: 6px 14px;+ cursor: pointer;+ transition: filter 0.12s ease;+}+.repl-form button:hover { filter: brightness(1.08); }+.repl-form button:disabled { opacity: 0.5; cursor: default; }+.repl-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0; }+.chip {+ font-family: var(--mono); font-size: 12px;+ background: var(--bg-raised);+ border: 1px solid var(--border);+ border-radius: 999px;+ padding: 5px 12px;+ cursor: pointer;+ color: var(--text-dim);+ transition: border-color 0.15s ease, color 0.15s ease;+}+.chip:hover { border-color: var(--accent-a); color: var(--text); }++/* sections */+section.block { margin: 64px 0; }+section.block h2 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 6px; }+section.block p.sub { color: var(--text-dim); margin: 0 0 20px; max-width: 640px; }+.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }+.card {+ background: var(--bg-raised);+ border: 1px solid var(--border);+ border-radius: 12px;+ padding: 18px 20px;+ transition: border-color 0.15s ease, transform 0.12s ease;+}+.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }+.card h3 { margin: 0 0 6px; font-size: 15px; }+.card h3 code { font-size: 13px; }+.card p { margin: 0; color: var(--text-dim); font-size: 13.5px; }++.disclosure {+ border: 1px solid var(--border);+ border-left: 3px solid var(--accent-b);+ background: var(--bg-inset);+ border-radius: 10px;+ padding: 14px 18px;+ color: var(--text-dim);+ font-size: 13.5px;+ margin: 26px 0;+}++table { border-collapse: collapse; width: 100%; font-size: 13.5px; }+.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }+th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); }+th { color: var(--text-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }+tr:last-child td { border-bottom: none; }+td code { white-space: nowrap; }++footer {+ border-top: 1px solid var(--border);+ margin-top: 80px; padding: 28px 0 44px;+ color: var(--text-faint); font-size: 13.5px;+}+footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }++@media (max-width: 720px) {+ .hero { padding: 56px 0 28px; }+ nav.top .links { gap: 12px; }+ nav.top .links a.hide-sm { display: none; }+ .repl-form { flex-wrap: wrap; }+}diff --git a/robinhood/hood-js/docs/stock-tokens.json b/robinhood/hood-js/docs/stock-tokens.jsonnew file mode 100644index 000000000..80dee6c98--- /dev/null+++ b/robinhood/hood-js/docs/stock-tokens.json@@ -0,0 +1,938 @@+{+ "$schema": "./stock-tokens.schema.json",+ "chainId": 4663,+ "generatedAtBlock": 7690522,+ "sources": {+ "discovery": "https://robinhoodchain.blockscout.com/api/v2/tokens?q=Robinhood Token (canonical name pattern \"<Name> • Robinhood Token\")",+ "feeds": "https://reference-data-directory.vercel.app/feeds-robinhood-mainnet.json",+ "verification": "on-chain via public RPC: shared beacon slot, symbol/name/decimals/uiMultiplier multicall, feed latestRoundData"+ },+ "stockBeacon": "0xe10b6f6B275de231345c20D14Ab812db62151b00",+ "tokenCount": 95,+ "feedCount": 34,+ "tokens": [+ {+ "address": "0x521Cf887E6531c6F667b5BC4D896E5d9bfE8EB2E",+ "symbol": "AAOI",+ "name": "Applied Optoelectronics • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xaF3D76f1834A1d425780943C99Ea8A608f8a93f9",+ "symbol": "AAPL",+ "name": "Apple • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x6B22A786bAa607d76728168703a39Ea9C99f2cD0",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "31550000000",+ "feedUpdatedAtGeneration": 1783710274+ },+ {+ "address": "0x36046893810a7E7fCE501229d57dc3FC8c8716d0",+ "symbol": "AMAT",+ "name": "Applied Materials • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x86923f96303D656E4aa86D9d42D1e57ad2023fdC",+ "symbol": "AMD",+ "name": "AMD • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x943A29E7ae51A4798823ca9eEd2ed533B2A22C72",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "55821015000",+ "feedUpdatedAtGeneration": 1783713346+ },+ {+ "address": "0x12f190a9F9d7D37a250758b26824B97CE941bF54",+ "symbol": "AMZN",+ "name": "Amazon • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xD5a1508ceD74c084eBf3cBe853e2C968fB2a651C",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "24556770000",+ "feedUpdatedAtGeneration": 1783692103+ },+ {+ "address": "0xb8DBf92F9741c9ac1c32115E78581f23509916FD",+ "symbol": "APLD",+ "name": "Applied Digital • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x47F93d52cBeC7C6D2CfC080e154002370a60dAEA",+ "symbol": "ASML",+ "name": "ASML Holding NV • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xB4106147E8cce40b7d46124090d373A71b70f87D",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "179758755000",+ "feedUpdatedAtGeneration": 1783710661+ },+ {+ "address": "0x1AF6446f07eb1d97c546AFC8c9544cBDF3AD5137",+ "symbol": "ASTS",+ "name": "AST SpaceMobile • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x156E175DD063a8cE274C50654eF40e0032b3fbcF",+ "symbol": "AVGO",+ "name": "Broadcom • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x4D21483a44Bf67a86b77E3dA301411880797D452",+ "symbol": "BA",+ "name": "Boeing • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xad25Ac6C84D497db898fa1E8387bf6Af3532a1c4",+ "symbol": "BABA",+ "name": "Alibaba • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x62Cc8F9b5f56a33c9C8A60c8B92779f523c4E984",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "11219500000",+ "feedUpdatedAtGeneration": 1783707523+ },+ {+ "address": "0x822CC93fFD030293E9842c30BBD678F530701867",+ "symbol": "BE",+ "name": "Bloom Energy • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x5c90450Bbb4273D7b2f17CF6917AEB237A569679",+ "symbol": "CBRS",+ "name": "Cerebras Systems • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x9651342CeA770aE9a2969Ba2A52611523146aef9",+ "symbol": "CCL",+ "name": "Carnival Corporation • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x8cF07C5A878945185d327aAa6e33FAa95F95e7bF",+ "symbol": "CELH",+ "name": "Celsius • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xcBB95BBF36099d34dA091dc6Fa6F49EfA257Cee3",+ "symbol": "CLSK",+ "name": "CleanSpark • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x810c12D3a554Bc47fd39597Fe3b3AAC4941F50eF",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "1286499999",+ "feedUpdatedAtGeneration": 1783713313+ },+ {+ "address": "0x6330D8C3178a418788dF01a47479c0ce7CCF450b",+ "symbol": "COIN",+ "name": "Coinbase • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xA3a468A452940B7D6b69991207B508c609a98Ef2",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "15943135000",+ "feedUpdatedAtGeneration": 1783703473+ },+ {+ "address": "0x4EA005168D7F09a7A0Ba9D1DEf21a479950E44C2",+ "symbol": "COST",+ "name": "Costco • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xdF0992E440dD0be65BD8439b609d6D4366bf1CB5",+ "symbol": "CRCL",+ "name": "Circle Internet Group • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x6652eDf64bA3731C4F2D3ce821A0Fb1f1f6b482a",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "6634635000",+ "feedUpdatedAtGeneration": 1783717360+ },+ {+ "address": "0x5f10A1C971B69e47e059e1dC91901B59b3fB49C3",+ "symbol": "CRWV",+ "name": "CoreWeave • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xe1b3aABCAFAd1c94708dc1367dcfF8Aa4407487C",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "8883970000",+ "feedUpdatedAtGeneration": 1783711393+ },+ {+ "address": "0x27c99fBde9D0d2AA4f4Bfb4943f237843DdF6958",+ "symbol": "DDOG",+ "name": "Datadog • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x941AE714EC6D8130c7B75d67160Ca08f1e7d11Dd",+ "symbol": "DELL",+ "name": "Dell • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x39EC44Bee4F6A116c6F9B8De566848a985C53C60",+ "symbol": "ELF",+ "name": "e.l.f. Beauty • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x7f0aBeF0C07280F82c6a08ead09dEd6BAE2C13Fc",+ "symbol": "EWY",+ "name": "iShares MSCI South Korea fund • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xEFdf54610B62A7753Ec30bDc380847c12D32e1D1",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "18377499999",+ "feedUpdatedAtGeneration": 1783705547+ },+ {+ "address": "0x25C288E6D899b9BC30160965aD9644c67e73bE0C",+ "symbol": "F",+ "name": "Ford Motor • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x282e87451E10fA6679BC7D76C69BE44cD3fC777C",+ "symbol": "FLNC",+ "name": "Fluence Energy • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xeB30663bDFf0622Ef4e4E5cBb4E975F19f33f51D",+ "symbol": "FUTU",+ "name": "Futu Holdings • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x7c04E6A3368F2A1DE3874f0e80d2e0A1a9915da6",+ "symbol": "GLW",+ "name": "Corning • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x1b0E319c6A659F002271B69dB8A7df2F911c153E",+ "symbol": "GME",+ "name": "GameStop • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x27C71df6A64fB476468EdF256CF72c038baB5B67",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "2176125000",+ "feedUpdatedAtGeneration": 1783694006+ },+ {+ "address": "0x2e0847E8910a9732eB3fb1bb4b70a580ADAD4FE3",+ "symbol": "GOOGL",+ "name": "Alphabet Class A • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xF6f373a037c30F0e5010d854385cA89185AE638b",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "35672000000",+ "feedUpdatedAtGeneration": 1783711606+ },+ {+ "address": "0xf1953DAB6FaD537488d5A022361FfAa8B4c95eC6",+ "symbol": "INOD",+ "name": "Innodata • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xc72b96e0E48ecd4DC75E1e45396e26300BC39681",+ "symbol": "INTC",+ "name": "Intel • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x3f390C5C24628Ac7C489515402235FeAD71D1913",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "10965095000",+ "feedUpdatedAtGeneration": 1783712771+ },+ {+ "address": "0x56d23beE5f41A7120170b0c603Dae30128e460e9",+ "symbol": "INTU",+ "name": "Intuit • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x558378E000D634A36593E338eBacdd6207640EfE",+ "symbol": "IONQ",+ "name": "IonQ • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x22EfeC4919baf55F360E0EDee4AbEB26DE4971eb",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "4308000000",+ "feedUpdatedAtGeneration": 1783711226+ },+ {+ "address": "0xF0AB0c93bE6F41369d302e55db1A96b3c430212D",+ "symbol": "IREN",+ "name": "IREN Limited • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x8eF20885F94e3D9bc7eB3080279188Bd5ED7c08C",+ "symbol": "LITE",+ "name": "Lumentum • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x8005d266423c7ea827372c9c864491e5786600ea",+ "symbol": "LLY",+ "name": "Eli Lilly • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x4e62068525Ab11FE768e29dfD00ef909B9803016",+ "symbol": "LULU",+ "name": "Lululemon • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xa5D4968421bA94814Be3B136b15cf422101aC1a3",+ "symbol": "LUNR",+ "name": "Intuitive Machines • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xDdf2266b79abf0B48898959B0ed6E6adf512be74",+ "symbol": "MDB",+ "name": "MongoDB • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xc0D6457C16Cc70d6790Dd43521C899C87ce02f35",+ "symbol": "META",+ "name": "Meta Platforms • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x7C38C00C30BEe9378381E7B6135d7283356D71b1",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "67067485000",+ "feedUpdatedAtGeneration": 1783713401+ },+ {+ "address": "0x62fd0668e10D8B72339BE2DCF7643001688ff13B",+ "symbol": "MRVL",+ "name": "Marvell Technology • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xe93237C50D904957Cf27E7B1133b510C669c2e74",+ "symbol": "MSFT",+ "name": "Microsoft • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x45C3C877C15E6BA2EBB19eA114Ea508d14C1Af2E",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "38469000000",+ "feedUpdatedAtGeneration": 1783697881+ },+ {+ "address": "0xec262a75e413fAfD0dF80480274532C79D42da09",+ "symbol": "MSTR",+ "name": "Strategy Inc. • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x396118bdFB181e6240E74D243F266B061c0edc3D",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "9469500000",+ "feedUpdatedAtGeneration": 1783712395+ },+ {+ "address": "0xfF080c8ce2E5feadaCa0Da81314Ae59D232d4afD",+ "symbol": "MU",+ "name": "Micron Technology • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x425EEFdCf05ed6526C3cE61Af99429A228a6d596",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "97854340000",+ "feedUpdatedAtGeneration": 1783713684+ },+ {+ "address": "0x48961813349333209994750ffA89b3c5C22eC969",+ "symbol": "MXL",+ "name": "MaxLinear • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x9D9c6684F596F66a64C030B93A886D51Fd4D7931",+ "symbol": "NBIS",+ "name": "Nebius Group • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xE1D87B116Ba0fe898998f1D140339D1fA1E09705",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "21923750000",+ "feedUpdatedAtGeneration": 1783713491+ },+ {+ "address": "0xE0444EF8BF4eD74f74FD73686e2ddF4C1c5591E8",+ "symbol": "NFLX",+ "name": "Netflix • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xBEF75684C43c4ea7BD18Dd532a2244674Ee8b926",+ "symbol": "NNE",+ "name": "Nano Nuclear Energy • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x0C3260aF4B8f13a69c4c2dFb84fD667890CDFa14",+ "symbol": "NOW",+ "name": "ServiceNow • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x408c14038a04f7bD235329E26d2bf569ee20e250",+ "symbol": "NU",+ "name": "Nu • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xd0601CE157Db5bdC3162BbaC2a2C8aF5320D9EEC",+ "symbol": "NVDA",+ "name": "NVIDIA • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x379EC4f7C378F34a1B47E4F3cbeBCbAC3E8E9F15",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "21019000000",+ "feedUpdatedAtGeneration": 1783700623+ },+ {+ "address": "0xbE6702d7b70315376dC48a3293f24f0982F86386",+ "symbol": "NVTS",+ "name": "Navitas Semiconductor • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xb0992820E760d836549ba69BC7598b4af75dEE03",+ "symbol": "ORCL",+ "name": "Oracle • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x0e6a64a2B58A6693a531E6c555f3A5d042eEA844",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "14108370000",+ "feedUpdatedAtGeneration": 1783709137+ },+ {+ "address": "0x1Cdad396DB64BDa184d5182A97Dd9B3C62100b7D",+ "symbol": "P",+ "name": "Everpure • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x9b23573b156B52565012F5cE02CDF60AFBaa70Be",+ "symbol": "PENG",+ "name": "Penguin Solutions • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x894E1EC2D74FFE5AEF8Dc8A9e84686acCB964F2A",+ "symbol": "PLTR",+ "name": "Palantir Technologies • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x820ABedFF239034956B7A9d2F0a331f9F075eB4c",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "12656140000",+ "feedUpdatedAtGeneration": 1783714557+ },+ {+ "address": "0xcf6B2D875361be807EAfa57458c80f28521F9333",+ "symbol": "POET",+ "name": "POET Technologies • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x4189F0c66EBBB0bfeF1C31f763131361EF32f77C",+ "symbol": "PR",+ "name": "Permian Resources • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xC583c60aeF9Dc401Da72cEC1B404743a93cea1Cc",+ "symbol": "QBTS",+ "name": "D-Wave Quantum • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x0f17206447090e464C277571124dD2688E48AEA9",+ "symbol": "QCOM",+ "name": "Qualcomm • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xD5f3879160bc7c32ebb4dC785F8a4F505888de68",+ "symbol": "QQQ",+ "name": "Invesco QQQ • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x80901d846d5D7B030F26B480776EE3b29374C2ae",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "72545060000",+ "feedUpdatedAtGeneration": 1783702260+ },+ {+ "address": "0x59818904ab4cE163b3cE4FfB64f2D6Ca02c434B4",+ "symbol": "QUBT",+ "name": "Quantum Computing • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xF0C4BF4C582cb3836e98394b1d4e7B7281101bE8",+ "symbol": "RBLX",+ "name": "Roblox • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x05b37Fb53A299a1b874A619e1c4C404D52C36F4C",+ "symbol": "RDDT",+ "name": "Reddit • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x92Ef19E82bD8fF36661DE838D5eaE7e5CEF0EfFE",+ "symbol": "RDW",+ "name": "Redwire • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x284358abc07F9359f19f4b5b4aC91901Be2597Ba",+ "symbol": "RGTI",+ "name": "Rigetti Computing • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x2A045cF1C49c61c166C036d2f06FA2D2d984f765",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "1657150813",+ "feedUpdatedAtGeneration": 1783713654+ },+ {+ "address": "0xB1BF26c1D20ff267A4f93550d1E0d06ac40a114B",+ "symbol": "RIVN",+ "name": "Rivian Automotive • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x3b14C39E89D60D627b42a1A4CA45b5bb45Fc12e2",+ "symbol": "RKLB",+ "name": "Rocket Lab Corporation • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x045477BF65Aef6f4F2386ad0164579e48381CC74",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "8128970000",+ "feedUpdatedAtGeneration": 1783726597+ },+ {+ "address": "0x95052ddcd5DC25641657424A8Cf04834997E1730",+ "symbol": "SATS",+ "name": "EchoStar • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x92FD66527192E3e61d4DDd13322Aa222DE86F9B5",+ "symbol": "SGOV",+ "name": "iShares 0-3 Month Treasury Bond • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000957519890990718",+ "feed": "0xa0DF4ee0fFf975306345875E3548Fcc519577A11",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "10060428845",+ "feedUpdatedAtGeneration": 1783728100+ },+ {+ "address": "0xF53F66751B1Eff985311b693531E3290F600c410",+ "symbol": "SHOP",+ "name": "Shopify • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x411eFb0E7f985935DAec3D4C3ebaEa0d0AD7D89f",+ "symbol": "SLV",+ "name": "iShares Silver Trust • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x209b73908e92Ae021826eD79609845451Ecba2ce",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "5416490000",+ "feedUpdatedAtGeneration": 1783719808+ },+ {+ "address": "0xc01aA1fECeC0605b13bc84874ff7256C0f5F562a",+ "symbol": "SMCI",+ "name": "Super Micro Computer • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xB90A19fF0Af67f7779afF50A882A9CfF42446400",+ "symbol": "SNDK",+ "name": "Sandisk Corporation • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xfb133Fa4B7b385802B693a293606682Df47109A3",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "193162665000",+ "feedUpdatedAtGeneration": 1783727430+ },+ {+ "address": "0x98E75885157C80992A8D41b696D8c9C6Fb30A926",+ "symbol": "SOFI",+ "name": "SoFi Technologies • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x75742c18BC1f1C5c5f448f4C9D9C6F66dafAAa38",+ "symbol": "SOXX",+ "name": "iShares Semiconductor ETF • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x4a0E65A3EcceC6dBe60AE065F2e7bb85Fae35eEa",+ "symbol": "SPCX",+ "name": "Space Exploration Technologies Corp. Class A Common Stock • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xB265810950ba6c5C0Ff821c9963014a56fD8Bffb",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "14572500000",+ "feedUpdatedAtGeneration": 1783713430+ },+ {+ "address": "0xAd622320e520de39e72d41EF07438C3Fd3354875",+ "symbol": "SPMO",+ "name": "Invesco S&P 500 Momentum ETF • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",+ "symbol": "SPY",+ "name": "SPDR S&P 500 ETF Trust • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x319724394D3A0e3669269846abE664Cd621f9f6A",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "75361500000",+ "feedUpdatedAtGeneration": 1783700203+ },+ {+ "address": "0x89776d4Cd68193597A2fC132cfaC1fDe36CCeA8a",+ "symbol": "TSEM",+ "name": "Tower Semiconductor • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x322F0929c4625eD5bAd873c95208D54E1c003b2d",+ "symbol": "TSLA",+ "name": "Tesla • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x4A1166a659A55625345e9515b32adECea5547C38",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "40782500000",+ "feedUpdatedAtGeneration": 1783713215+ },+ {+ "address": "0x58FfE4a942d3885bAa22D7520691F611EF09e7AA",+ "symbol": "TSM",+ "name": "Taiwan Semiconductor Manufacturing • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x874cF94aa8eC88Fd9560094dD065f2fB3E41Fc2F",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "43437150000",+ "feedUpdatedAtGeneration": 1783713983+ },+ {+ "address": "0x5e81213613b6B86EaB4c6c50d718d34359459786",+ "symbol": "TTWO",+ "name": "Take-Two Interactive Software • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x0E6e67Ba88e7b5d9B67636A215c76779B948dE79",+ "symbol": "UMC",+ "name": "United Microelectronics • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xf23250dac154D05Bb671CB0d0eBEf3c635c79CE2",+ "symbol": "UPS",+ "name": "UPS • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xd917B029C761D264c6A312BBbcDA868658eF86a6",+ "symbol": "USAR",+ "name": "USA Rare Earth • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0xA994d3684e8400A6c8078226925779FdeE682DD9",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "1853505000",+ "feedUpdatedAtGeneration": 1783709442+ },+ {+ "address": "0xa30FA36Db767ad9eD3f7a60fC79526fB4d56D344",+ "symbol": "USO",+ "name": "United States Oil Fund • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": "0x75a9c76Ef439e2C7c2E5a34Ab105EcFe3766431c",+ "feedDecimals": 8,+ "feedAnswerAtGeneration": "10868500000",+ "feedUpdatedAtGeneration": 1783708312+ },+ {+ "address": "0x82DA4646242e1D962e96e932269Dc644c94a9CaA",+ "symbol": "WDAY",+ "name": "Workday • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xc93a8c440CEa26D7445dF01729f193b27965099f",+ "symbol": "WEEK",+ "name": "Roundhill Weekly T-Bill ETF • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "2006182524271844660",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x15Cd20759CE7F3285c29A319dE2D1A2e098c6f43",+ "symbol": "XLK",+ "name": "State Street Technology Select Sector SPDR ETF • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xA8eB3BCcbf2017eE7CBfb652eB51CF2E1B153289",+ "symbol": "XNDU",+ "name": "Xanadu Quantum • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0xf9B46d3D1B22199D4D1025a9cEDB540A33F1a2d5",+ "symbol": "XOM",+ "name": "ExxonMobil Holdings Corporation • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x44c4F142009036cF477eD2d09932051843137CF1",+ "symbol": "ZM",+ "name": "Zoom • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ },+ {+ "address": "0x7dc013eB55e436f30d7ED1AFE4E36d6e45e3c3f7",+ "symbol": "ZS",+ "name": "Zscaler • Robinhood Token",+ "decimals": 18,+ "uiMultiplierAtGeneration": "1000000000000000000",+ "feed": null,+ "feedDecimals": null+ }+ ]+}diff --git a/robinhood/hood-launcher/contracts/HoodLPLocker.json b/robinhood/hood-launcher/contracts/HoodLPLocker.jsonnew file mode 100644index 000000000..0ab82c30d--- /dev/null+++ b/robinhood/hood-launcher/contracts/HoodLPLocker.json@@ -0,0 +1,199 @@+{+ "contractName": "HoodLPLocker",+ "sourceFile": "HoodLPLocker.sol",+ "abi": [+ {+ "anonymous": false,+ "inputs": [+ {+ "indexed": true,+ "internalType": "address",+ "name": "nftContract",+ "type": "address"+ },+ {+ "indexed": true,+ "internalType": "uint256",+ "name": "tokenId",+ "type": "uint256"+ },+ {+ "indexed": true,+ "internalType": "address",+ "name": "owner",+ "type": "address"+ },+ {+ "indexed": false,+ "internalType": "uint256",+ "name": "unlockTimestamp",+ "type": "uint256"+ }+ ],+ "name": "Locked",+ "type": "event"+ },+ {+ "anonymous": false,+ "inputs": [+ {+ "indexed": true,+ "internalType": "address",+ "name": "nftContract",+ "type": "address"+ },+ {+ "indexed": true,+ "internalType": "uint256",+ "name": "tokenId",+ "type": "uint256"+ },+ {+ "indexed": true,+ "internalType": "address",+ "name": "owner",+ "type": "address"+ }+ ],+ "name": "Withdrawn",+ "type": "event"+ },+ {+ "inputs": [+ {+ "internalType": "address",+ "name": "nftContract",+ "type": "address"+ },+ {+ "internalType": "uint256",+ "name": "tokenId",+ "type": "uint256"+ }+ ],+ "name": "lockInfo",+ "outputs": [+ {+ "internalType": "address",+ "name": "owner",+ "type": "address"+ },+ {+ "internalType": "uint256",+ "name": "unlockTimestamp",+ "type": "uint256"+ }+ ],+ "stateMutability": "view",+ "type": "function"+ },+ {+ "inputs": [+ {+ "internalType": "address",+ "name": "",+ "type": "address"+ },+ {+ "internalType": "address",+ "name": "from",+ "type": "address"+ },+ {+ "internalType": "uint256",+ "name": "tokenId",+ "type": "uint256"+ },+ {+ "internalType": "bytes",+ "name": "data",+ "type": "bytes"+ }+ ],+ "name": "onERC721Received",+ "outputs": [+ {+ "internalType": "bytes4",+ "name": "",+ "type": "bytes4"+ }+ ],+ "stateMutability": "nonpayable",+ "type": "function"+ },+ {+ "inputs": [+ {+ "internalType": "address",+ "name": "nftContract",+ "type": "address"+ },+ {+ "internalType": "uint256",+ "name": "tokenId",+ "type": "uint256"+ }+ ],+ "name": "withdraw",+ "outputs": [],+ "stateMutability": "nonpayable",+ "type": "function"+ }+ ],+ "bytecode": "0x6080604052348015600e575f5ffd5b506105958061001c5f395ff3fe608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063150b7a0214610043578063b2520a7c14610074578063f3fef3a3146100a6575b5f5ffd5b61005661005136600461048b565b6100bb565b6040516001600160e01b031990911681526020015b60405180910390f35b610087610082366004610520565b610238565b604080516001600160a01b03909316835260208301919091520161006b565b6100b96100b4366004610520565b610288565b005b5f806100c983850185610548565b90504281116101325760405162461bcd60e51b815260206004820152602a60248201527f486f6f644c504c6f636b65723a20756e6c6f636b206d75737420626520696e206044820152697468652066757475726560b01b60648201526084015b60405180910390fd5b5f61013d338761042a565b5f818152602081905260409020549091506001600160a01b0316156101a45760405162461bcd60e51b815260206004820152601c60248201527f486f6f644c504c6f636b65723a20616c7265616479206c6f636b6564000000006044820152606401610129565b6040805180820182526001600160a01b0389811680835260208084018781525f878152808352869020945185546001600160a01b0319169416939093178455915160019093019290925591518481529091889133917f457c0f7f0a89a4d8ad65fc6ecdae4638dc9c795ba89ed05dbd335d7d0e95b99c910160405180910390a450630a85bd0160e11b979650505050505050565b5f5f5f5f5f610247878761042a565b815260208082019290925260409081015f20815180830190925280546001600160a01b03168083526001909101549190920181905290969095509350505050565b5f610293838361042a565b5f8181526020818152604091829020825180840190935280546001600160a01b0316808452600190910154918301919091529192509033146103175760405162461bcd60e51b815260206004820152601c60248201527f486f6f644c504c6f636b65723a206e6f74206c6f636b206f776e6572000000006044820152606401610129565b806020015142101561036b5760405162461bcd60e51b815260206004820152601a60248201527f486f6f644c504c6f636b65723a207374696c6c206c6f636b65640000000000006044820152606401610129565b5f8281526020819052604080822080546001600160a01b03191681556001019190915551632142170760e11b8152306004820152336024820152604481018490526001600160a01b038516906342842e0e906064015f604051808303815f87803b1580156103d7575f5ffd5b505af11580156103e9573d5f5f3e3d5ffd5b50506040513392508591506001600160a01b038716907fcbcdbdf10631a43cc99c80acace8232649421c3f4f73919f16013d47c83a687a905f90a450505050565b6040516bffffffffffffffffffffffff19606084901b166020820152603481018290525f9060540160405160208183030381529060405280519060200120905092915050565b80356001600160a01b0381168114610486575f5ffd5b919050565b5f5f5f5f5f6080868803121561049f575f5ffd5b6104a886610470565b94506104b660208701610470565b935060408601359250606086013567ffffffffffffffff8111156104d8575f5ffd5b8601601f810188136104e8575f5ffd5b803567ffffffffffffffff8111156104fe575f5ffd5b88602082840101111561050f575f5ffd5b959894975092955050506020019190565b5f5f60408385031215610531575f5ffd5b61053a83610470565b946020939093013593505050565b5f60208284031215610558575f5ffd5b503591905056fea2646970667358221220d805fa2bdf977384b57575a1590371b03d4be3324207de680ac170ae4020556864736f6c63430008240033",+ "deployedBytecode": "0x608060405234801561000f575f5ffd5b506004361061003f575f3560e01c8063150b7a0214610043578063b2520a7c14610074578063f3fef3a3146100a6575b5f5ffd5b61005661005136600461048b565b6100bb565b6040516001600160e01b031990911681526020015b60405180910390f35b610087610082366004610520565b610238565b604080516001600160a01b03909316835260208301919091520161006b565b6100b96100b4366004610520565b610288565b005b5f806100c983850185610548565b90504281116101325760405162461bcd60e51b815260206004820152602a60248201527f486f6f644c504c6f636b65723a20756e6c6f636b206d75737420626520696e206044820152697468652066757475726560b01b60648201526084015b60405180910390fd5b5f61013d338761042a565b5f818152602081905260409020549091506001600160a01b0316156101a45760405162461bcd60e51b815260206004820152601c60248201527f486f6f644c504c6f636b65723a20616c7265616479206c6f636b6564000000006044820152606401610129565b6040805180820182526001600160a01b0389811680835260208084018781525f878152808352869020945185546001600160a01b0319169416939093178455915160019093019290925591518481529091889133917f457c0f7f0a89a4d8ad65fc6ecdae4638dc9c795ba89ed05dbd335d7d0e95b99c910160405180910390a450630a85bd0160e11b979650505050505050565b5f5f5f5f5f610247878761042a565b815260208082019290925260409081015f20815180830190925280546001600160a01b03168083526001909101549190920181905290969095509350505050565b5f610293838361042a565b5f8181526020818152604091829020825180840190935280546001600160a01b0316808452600190910154918301919091529192509033146103175760405162461bcd60e51b815260206004820152601c60248201527f486f6f644c504c6f636b65723a206e6f74206c6f636b206f776e6572000000006044820152606401610129565b806020015142101561036b5760405162461bcd60e51b815260206004820152601a60248201527f486f6f644c504c6f636b65723a207374696c6c206c6f636b65640000000000006044820152606401610129565b5f8281526020819052604080822080546001600160a01b03191681556001019190915551632142170760e11b8152306004820152336024820152604481018490526001600160a01b038516906342842e0e906064015f604051808303815f87803b1580156103d7575f5ffd5b505af11580156103e9573d5f5f3e3d5ffd5b50506040513392508591506001600160a01b038716907fcbcdbdf10631a43cc99c80acace8232649421c3f4f73919f16013d47c83a687a905f90a450505050565b6040516bffffffffffffffffffffffff19606084901b166020820152603481018290525f9060540160405160208183030381529060405280519060200120905092915050565b80356001600160a01b0381168114610486575f5ffd5b919050565b5f5f5f5f5f6080868803121561049f575f5ffd5b6104a886610470565b94506104b660208701610470565b935060408601359250606086013567ffffffffffffffff8111156104d8575f5ffd5b8601601f810188136104e8575f5ffd5b803567ffffffffffffffff8111156104fe575f5ffd5b88602082840101111561050f575f5ffd5b959894975092955050506020019190565b5f5f60408385031215610531575f5ffd5b61053a83610470565b946020939093013593505050565b5f60208284031215610558575f5ffd5b503591905056fea2646970667358221220d805fa2bdf977384b57575a1590371b03d4be3324207de680ac170ae4020556864736f6c63430008240033",+ "compiler": {+ "name": "solc",+ "version": "0.8.36+commit.8a079791.Emscripten.clang"+ },+ "standardJsonInput": {+ "language": "Solidity",+ "sources": {+ "HoodToken.sol": {+ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n/**\n * @title HoodToken\n * @notice The direct-rail ERC-20 for hood-launcher's Robinhood Chain (4663)\n * memecoin launches.\n * @dev Deliberately minimal and audited-pattern:\n * - OpenZeppelin v5 `ERC20` (no custom transfer/fee/tax logic).\n * - Fixed supply, minted once in the constructor to the deployer.\n * - No `mint` function exists anywhere in the contract — supply cannot\n * grow after deployment.\n * - No owner, no `Ownable`, no privileged functions of any kind. There\n * is nothing to renounce because there is nothing to renounce from.\n * This is intentionally the entire contract: 18 lines, one inherited\n * base, zero attack surface beyond what OpenZeppelin's `ERC20` itself\n * carries.\n */\ncontract HoodToken is ERC20 {\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_,\n address recipient_\n ) ERC20(name_, symbol_) {\n _mint(recipient_, totalSupply_);\n }\n}\n"+ },+ "HoodLPLocker.sol": {+ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @title HoodLPLocker\n * @notice Permissionless timelock for Uniswap v3 LP position NFTs. Send a\n * position NFT here via `safeTransferFrom(from, locker, tokenId,\n * abi.encode(unlockTimestamp))` — the depositor becomes the lock's\n * owner and can `withdraw` only after `unlockTimestamp`. Anyone can\n * lock any NFT for any duration; the contract holds no privileged\n * role over funds it did not receive, and never touches a locked\n * position before its unlock time (no admin override, no pause).\n * @dev One shared, reusable deployment — hood-launcher deploys it once per\n * network and reuses the address for every `lpDisposition: 'lock'`\n * launch (see `HOOD_LAUNCHER_LP_LOCKER_<NETWORK>` in the direct rail).\n */\ncontract HoodLPLocker is IERC721Receiver {\n struct Lock {\n address owner;\n uint256 unlockTimestamp;\n }\n\n /// @dev keyed by keccak256(nftContract, tokenId) so one locker instance serves any NFT collection.\n mapping(bytes32 => Lock) private _locks;\n\n event Locked(address indexed nftContract, uint256 indexed tokenId, address indexed owner, uint256 unlockTimestamp);\n event Withdrawn(address indexed nftContract, uint256 indexed tokenId, address indexed owner);\n\n function _key(address nftContract, uint256 tokenId) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(nftContract, tokenId));\n }\n\n /// @notice ERC-721 receiver hook. `data` must be `abi.encode(uint256 unlockTimestamp)`.\n function onERC721Received(\n address, /* operator */\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external override returns (bytes4) {\n uint256 unlockTimestamp = abi.decode(data, (uint256));\n require(unlockTimestamp > block.timestamp, \"HoodLPLocker: unlock must be in the future\");\n bytes32 key = _key(msg.sender, tokenId);\n require(_locks[key].owner == address(0), \"HoodLPLocker: already locked\");\n _locks[key] = Lock({owner: from, unlockTimestamp: unlockTimestamp});\n emit Locked(msg.sender, tokenId, from, unlockTimestamp);\n return IERC721Receiver.onERC721Received.selector;\n }\n\n /// @notice Withdraw a locked position after its unlock time. Only the original depositor may call.\n function withdraw(address nftContract, uint256 tokenId) external {\n bytes32 key = _key(nftContract, tokenId);\n Lock memory position = _locks[key];\n require(position.owner == msg.sender, \"HoodLPLocker: not lock owner\");\n require(block.timestamp >= position.unlockTimestamp, \"HoodLPLocker: still locked\");\n delete _locks[key];\n IERC721(nftContract).safeTransferFrom(address(this), msg.sender, tokenId);\n emit Withdrawn(nftContract, tokenId, msg.sender);\n }\n\n function lockInfo(address nftContract, uint256 tokenId) external view returns (address owner, uint256 unlockTimestamp) {\n Lock memory position = _locks[_key(nftContract, tokenId)];\n return (position.owner, position.unlockTimestamp);\n }\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/ERC20.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * Both values are immutable: they can only be set once during construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /// @inheritdoc IERC20\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /// @inheritdoc IERC20\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /// @inheritdoc IERC20\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Skips emitting an {Approval} event indicating an allowance update. This is not\n * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value <= fromBalance <= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the `transferFrom` operation can force the flag to\n * true using the following override:\n *\n * ```solidity\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner`'s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance < type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n"+ },+ "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n * reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC721/IERC721.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/IERC20.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"+ },+ "@openzeppelin/contracts/utils/Context.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"+ },+ "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"+ },+ "@openzeppelin/contracts/utils/introspection/IERC165.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"+ }+ },+ "settings": {+ "optimizer": {+ "enabled": true,+ "runs": 200+ },+ "outputSelection": {+ "*": {+ "*": [+ "abi",+ "evm.bytecode.object",+ "evm.deployedBytecode.object"+ ]+ }+ }+ }+ }+}\ No newline at end of filediff --git a/robinhood/hood-launcher/contracts/HoodLPLocker.sol b/robinhood/hood-launcher/contracts/HoodLPLocker.solnew file mode 100644index 000000000..2ed73ae27--- /dev/null+++ b/robinhood/hood-launcher/contracts/HoodLPLocker.sol@@ -0,0 +1,67 @@+// SPDX-License-Identifier: MIT+pragma solidity ^0.8.28;++import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";+import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";++/**+ * @title HoodLPLocker+ * @notice Permissionless timelock for Uniswap v3 LP position NFTs. Send a+ * position NFT here via `safeTransferFrom(from, locker, tokenId,+ * abi.encode(unlockTimestamp))` — the depositor becomes the lock's+ * owner and can `withdraw` only after `unlockTimestamp`. Anyone can+ * lock any NFT for any duration; the contract holds no privileged+ * role over funds it did not receive, and never touches a locked+ * position before its unlock time (no admin override, no pause).+ * @dev One shared, reusable deployment — hood-launcher deploys it once per+ * network and reuses the address for every `lpDisposition: 'lock'`+ * launch (see `HOOD_LAUNCHER_LP_LOCKER_<NETWORK>` in the direct rail).+ */+contract HoodLPLocker is IERC721Receiver {+ struct Lock {+ address owner;+ uint256 unlockTimestamp;+ }++ /// @dev keyed by keccak256(nftContract, tokenId) so one locker instance serves any NFT collection.+ mapping(bytes32 => Lock) private _locks;++ event Locked(address indexed nftContract, uint256 indexed tokenId, address indexed owner, uint256 unlockTimestamp);+ event Withdrawn(address indexed nftContract, uint256 indexed tokenId, address indexed owner);++ function _key(address nftContract, uint256 tokenId) private pure returns (bytes32) {+ return keccak256(abi.encodePacked(nftContract, tokenId));+ }++ /// @notice ERC-721 receiver hook. `data` must be `abi.encode(uint256 unlockTimestamp)`.+ function onERC721Received(+ address, /* operator */+ address from,+ uint256 tokenId,+ bytes calldata data+ ) external override returns (bytes4) {+ uint256 unlockTimestamp = abi.decode(data, (uint256));+ require(unlockTimestamp > block.timestamp, "HoodLPLocker: unlock must be in the future");+ bytes32 key = _key(msg.sender, tokenId);+ require(_locks[key].owner == address(0), "HoodLPLocker: already locked");+ _locks[key] = Lock({owner: from, unlockTimestamp: unlockTimestamp});+ emit Locked(msg.sender, tokenId, from, unlockTimestamp);+ return IERC721Receiver.onERC721Received.selector;+ }++ /// @notice Withdraw a locked position after its unlock time. Only the original depositor may call.+ function withdraw(address nftContract, uint256 tokenId) external {+ bytes32 key = _key(nftContract, tokenId);+ Lock memory position = _locks[key];+ require(position.owner == msg.sender, "HoodLPLocker: not lock owner");+ require(block.timestamp >= position.unlockTimestamp, "HoodLPLocker: still locked");+ delete _locks[key];+ IERC721(nftContract).safeTransferFrom(address(this), msg.sender, tokenId);+ emit Withdrawn(nftContract, tokenId, msg.sender);+ }++ function lockInfo(address nftContract, uint256 tokenId) external view returns (address owner, uint256 unlockTimestamp) {+ Lock memory position = _locks[_key(nftContract, tokenId)];+ return (position.owner, position.unlockTimestamp);+ }+}diff --git a/robinhood/hood-launcher/contracts/HoodToken.json b/robinhood/hood-launcher/contracts/HoodToken.jsonindex b7ce1a042..1d7d11abf 100644--- a/robinhood/hood-launcher/contracts/HoodToken.json+++ b/robinhood/hood-launcher/contracts/HoodToken.json@@ -1,5 +1,6 @@{"contractName": "HoodToken",+ "sourceFile": "HoodToken.sol","abi": [{"inputs": [@@ -341,5 +342,55 @@"compiler": {"name": "solc","version": "0.8.36+commit.8a079791.Emscripten.clang"+ },+ "standardJsonInput": {+ "language": "Solidity",+ "sources": {+ "HoodToken.sol": {+ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {ERC20} from \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\n/**\n * @title HoodToken\n * @notice The direct-rail ERC-20 for hood-launcher's Robinhood Chain (4663)\n * memecoin launches.\n * @dev Deliberately minimal and audited-pattern:\n * - OpenZeppelin v5 `ERC20` (no custom transfer/fee/tax logic).\n * - Fixed supply, minted once in the constructor to the deployer.\n * - No `mint` function exists anywhere in the contract — supply cannot\n * grow after deployment.\n * - No owner, no `Ownable`, no privileged functions of any kind. There\n * is nothing to renounce because there is nothing to renounce from.\n * This is intentionally the entire contract: 18 lines, one inherited\n * base, zero attack surface beyond what OpenZeppelin's `ERC20` itself\n * carries.\n */\ncontract HoodToken is ERC20 {\n constructor(\n string memory name_,\n string memory symbol_,\n uint256 totalSupply_,\n address recipient_\n ) ERC20(name_, symbol_) {\n _mint(recipient_, totalSupply_);\n }\n}\n"+ },+ "HoodLPLocker.sol": {+ "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.28;\n\nimport {IERC721Receiver} from \"@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol\";\nimport {IERC721} from \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\n\n/**\n * @title HoodLPLocker\n * @notice Permissionless timelock for Uniswap v3 LP position NFTs. Send a\n * position NFT here via `safeTransferFrom(from, locker, tokenId,\n * abi.encode(unlockTimestamp))` — the depositor becomes the lock's\n * owner and can `withdraw` only after `unlockTimestamp`. Anyone can\n * lock any NFT for any duration; the contract holds no privileged\n * role over funds it did not receive, and never touches a locked\n * position before its unlock time (no admin override, no pause).\n * @dev One shared, reusable deployment — hood-launcher deploys it once per\n * network and reuses the address for every `lpDisposition: 'lock'`\n * launch (see `HOOD_LAUNCHER_LP_LOCKER_<NETWORK>` in the direct rail).\n */\ncontract HoodLPLocker is IERC721Receiver {\n struct Lock {\n address owner;\n uint256 unlockTimestamp;\n }\n\n /// @dev keyed by keccak256(nftContract, tokenId) so one locker instance serves any NFT collection.\n mapping(bytes32 => Lock) private _locks;\n\n event Locked(address indexed nftContract, uint256 indexed tokenId, address indexed owner, uint256 unlockTimestamp);\n event Withdrawn(address indexed nftContract, uint256 indexed tokenId, address indexed owner);\n\n function _key(address nftContract, uint256 tokenId) private pure returns (bytes32) {\n return keccak256(abi.encodePacked(nftContract, tokenId));\n }\n\n /// @notice ERC-721 receiver hook. `data` must be `abi.encode(uint256 unlockTimestamp)`.\n function onERC721Received(\n address, /* operator */\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external override returns (bytes4) {\n uint256 unlockTimestamp = abi.decode(data, (uint256));\n require(unlockTimestamp > block.timestamp, \"HoodLPLocker: unlock must be in the future\");\n bytes32 key = _key(msg.sender, tokenId);\n require(_locks[key].owner == address(0), \"HoodLPLocker: already locked\");\n _locks[key] = Lock({owner: from, unlockTimestamp: unlockTimestamp});\n emit Locked(msg.sender, tokenId, from, unlockTimestamp);\n return IERC721Receiver.onERC721Received.selector;\n }\n\n /// @notice Withdraw a locked position after its unlock time. Only the original depositor may call.\n function withdraw(address nftContract, uint256 tokenId) external {\n bytes32 key = _key(nftContract, tokenId);\n Lock memory position = _locks[key];\n require(position.owner == msg.sender, \"HoodLPLocker: not lock owner\");\n require(block.timestamp >= position.unlockTimestamp, \"HoodLPLocker: still locked\");\n delete _locks[key];\n IERC721(nftContract).safeTransferFrom(address(this), msg.sender, tokenId);\n emit Withdrawn(nftContract, tokenId, msg.sender);\n }\n\n function lockInfo(address nftContract, uint256 tokenId) external view returns (address owner, uint256 unlockTimestamp) {\n Lock memory position = _locks[_key(nftContract, tokenId)];\n return (position.owner, position.unlockTimestamp);\n }\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/ERC20.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC20} from \"./IERC20.sol\";\nimport {IERC20Metadata} from \"./extensions/IERC20Metadata.sol\";\nimport {Context} from \"../../utils/Context.sol\";\nimport {IERC20Errors} from \"../../interfaces/draft-IERC6093.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC-20\n * applications.\n */\nabstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {\n mapping(address account => uint256) private _balances;\n\n mapping(address account => mapping(address spender => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * Both values are immutable: they can only be set once during construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the default value returned by this function, unless\n * it's overridden.\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual returns (uint8) {\n return 18;\n }\n\n /// @inheritdoc IERC20\n function totalSupply() public view virtual returns (uint256) {\n return _totalSupply;\n }\n\n /// @inheritdoc IERC20\n function balanceOf(address account) public view virtual returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `value`.\n */\n function transfer(address to, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, value);\n return true;\n }\n\n /// @inheritdoc IERC20\n function allowance(address owner, address spender) public view virtual returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 value) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, value);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Skips emitting an {Approval} event indicating an allowance update. This is not\n * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `value`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `value`.\n */\n function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, value);\n _transfer(from, to, value);\n return true;\n }\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _transfer(address from, address to, uint256 value) internal {\n if (from == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n if (to == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(from, to, value);\n }\n\n /**\n * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`\n * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding\n * this function.\n *\n * Emits a {Transfer} event.\n */\n function _update(address from, address to, uint256 value) internal virtual {\n if (from == address(0)) {\n // Overflow check required: The rest of the code assumes that totalSupply never overflows\n _totalSupply += value;\n } else {\n uint256 fromBalance = _balances[from];\n if (fromBalance < value) {\n revert ERC20InsufficientBalance(from, fromBalance, value);\n }\n unchecked {\n // Overflow not possible: value <= fromBalance <= totalSupply.\n _balances[from] = fromBalance - value;\n }\n }\n\n if (to == address(0)) {\n unchecked {\n // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.\n _totalSupply -= value;\n }\n } else {\n unchecked {\n // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.\n _balances[to] += value;\n }\n }\n\n emit Transfer(from, to, value);\n }\n\n /**\n * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).\n * Relies on the `_update` mechanism\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead.\n */\n function _mint(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidReceiver(address(0));\n }\n _update(address(0), account, value);\n }\n\n /**\n * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.\n * Relies on the `_update` mechanism.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * NOTE: This function is not virtual, {_update} should be overridden instead\n */\n function _burn(address account, uint256 value) internal {\n if (account == address(0)) {\n revert ERC20InvalidSender(address(0));\n }\n _update(account, address(0), value);\n }\n\n /**\n * @dev Sets `value` as the allowance of `spender` over the `owner`'s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n *\n * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.\n */\n function _approve(address owner, address spender, uint256 value) internal {\n _approve(owner, spender, value, true);\n }\n\n /**\n * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.\n *\n * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by\n * `_spendAllowance` during the `transferFrom` operation sets the flag to false. This saves gas by not emitting any\n * `Approval` event during `transferFrom` operations.\n *\n * Anyone who wishes to continue emitting `Approval` events on the `transferFrom` operation can force the flag to\n * true using the following override:\n *\n * ```solidity\n * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {\n * super._approve(owner, spender, value, true);\n * }\n * ```\n *\n * Requirements are the same as {_approve}.\n */\n function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {\n if (owner == address(0)) {\n revert ERC20InvalidApprover(address(0));\n }\n if (spender == address(0)) {\n revert ERC20InvalidSpender(address(0));\n }\n _allowances[owner][spender] = value;\n if (emitEvent) {\n emit Approval(owner, spender, value);\n }\n }\n\n /**\n * @dev Updates `owner`'s allowance for `spender` based on spent `value`.\n *\n * Does not update the allowance value in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Does not emit an {Approval} event.\n */\n function _spendAllowance(address owner, address spender, uint256 value) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance < type(uint256).max) {\n if (currentAllowance < value) {\n revert ERC20InsufficientAllowance(spender, currentAllowance, value);\n }\n unchecked {\n _approve(owner, spender, currentAllowance - value, false);\n }\n }\n }\n}\n"+ },+ "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity >=0.5.0;\n\n/**\n * @title ERC-721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC-721 asset contracts.\n */\ninterface IERC721Receiver {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be\n * reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC721/IERC721.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC165} from \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC-721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC-721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or\n * {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon\n * a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 tokenId) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the address zero.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/IERC20.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-20 standard as defined in the ERC.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the value of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the value of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves a `value` amount of tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 value) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets a `value` amount of tokens as the allowance of `spender` over the\n * caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 value) external returns (bool);\n\n /**\n * @dev Moves a `value` amount of tokens from `from` to `to` using the\n * allowance mechanism. `value` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(address from, address to, uint256 value) external returns (bool);\n}\n"+ },+ "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity >=0.6.2;\n\nimport {IERC20} from \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC-20 standard.\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n"+ },+ "@openzeppelin/contracts/utils/Context.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n function _contextSuffixLength() internal view virtual returns (uint256) {\n return 0;\n }\n}\n"+ },+ "@openzeppelin/contracts/interfaces/draft-IERC6093.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.5.0) (interfaces/draft-IERC6093.sol)\n\npragma solidity >=0.8.4;\n\n/**\n * @dev Standard ERC-20 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.\n */\ninterface IERC20Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC20InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC20InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n * @param allowance Amount of tokens a `spender` is allowed to operate with.\n * @param needed Minimum amount required to perform a transfer.\n */\n error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC20InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `spender` to be approved. Used in approvals.\n * @param spender Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC20InvalidSpender(address spender);\n}\n\n/**\n * @dev Standard ERC-721 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.\n */\ninterface IERC721Errors {\n /**\n * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-721.\n * Used in balance queries.\n * @param owner Address of the current owner of a token.\n */\n error ERC721InvalidOwner(address owner);\n\n /**\n * @dev Indicates a `tokenId` whose `owner` is the zero address.\n * @param tokenId Identifier number of a token.\n */\n error ERC721NonexistentToken(uint256 tokenId);\n\n /**\n * @dev Indicates an error related to the ownership over a particular token. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param tokenId Identifier number of a token.\n * @param owner Address of the current owner of a token.\n */\n error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC721InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC721InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param tokenId Identifier number of a token.\n */\n error ERC721InsufficientApproval(address operator, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC721InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC721InvalidOperator(address operator);\n}\n\n/**\n * @dev Standard ERC-1155 Errors\n * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.\n */\ninterface IERC1155Errors {\n /**\n * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n * @param balance Current balance for the interacting account.\n * @param needed Minimum amount required to perform a transfer.\n * @param tokenId Identifier number of a token.\n */\n error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);\n\n /**\n * @dev Indicates a failure with the token `sender`. Used in transfers.\n * @param sender Address whose tokens are being transferred.\n */\n error ERC1155InvalidSender(address sender);\n\n /**\n * @dev Indicates a failure with the token `receiver`. Used in transfers.\n * @param receiver Address to which tokens are being transferred.\n */\n error ERC1155InvalidReceiver(address receiver);\n\n /**\n * @dev Indicates a failure with the `operator`’s approval. Used in transfers.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n * @param owner Address of the current owner of a token.\n */\n error ERC1155MissingApprovalForAll(address operator, address owner);\n\n /**\n * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.\n * @param approver Address initiating an approval operation.\n */\n error ERC1155InvalidApprover(address approver);\n\n /**\n * @dev Indicates a failure with the `operator` to be approved. Used in approvals.\n * @param operator Address that may be allowed to operate on tokens without being their owner.\n */\n error ERC1155InvalidOperator(address operator);\n\n /**\n * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.\n * Used in batch transfers.\n * @param idsLength Length of the array of token identifiers\n * @param valuesLength Length of the array of token amounts\n */\n error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);\n}\n"+ },+ "@openzeppelin/contracts/utils/introspection/IERC165.sol": {+ "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)\n\npragma solidity >=0.4.16;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"+ }+ },+ "settings": {+ "optimizer": {+ "enabled": true,+ "runs": 200+ },+ "outputSelection": {+ "*": {+ "*": [+ "abi",+ "evm.bytecode.object",+ "evm.deployedBytecode.object"+ ]+ }+ }+ }}}\ No newline at end of filediff --git a/robinhood/hood-launcher/scripts/compile-contract.mjs b/robinhood/hood-launcher/scripts/compile-contract.mjsindex f34c5aec6..b2e4f4c40 100644--- a/robinhood/hood-launcher/scripts/compile-contract.mjs+++ b/robinhood/hood-launcher/scripts/compile-contract.mjs@@ -1,8 +1,9 @@#!/usr/bin/env node/**- * Compiles `contracts/HoodToken.sol` with solc, resolving `@openzeppelin/*`- * imports against the locally installed package, and writes the ABI +- * bytecode to `contracts/HoodToken.json` for the direct rail to import.+ * Compiles the direct-rail contracts (`HoodToken.sol`, `HoodLPLocker.sol`)+ * with solc, resolving `@openzeppelin/*` imports against the locally+ * installed package, and writes ABI + bytecode artifacts next to each+ * source for the direct rail to import.** Run: `npm run compile:contract`*/@@ -13,8 +14,10 @@ import solc from 'solc'const __dirname = dirname(fileURLToPath(import.meta.url))const root = resolve(__dirname, '..')-const contractPath = join(root, 'contracts', 'HoodToken.sol')-const source = readFileSync(contractPath, 'utf8')+const contracts = [+ { file: 'HoodToken.sol', name: 'HoodToken' },+ { file: 'HoodLPLocker.sol', name: 'HoodLPLocker' },+]function findImport(importPath) {try {@@ -27,9 +30,13 @@ function findImport(importPath) {}}+const sources = Object.fromEntries(+ contracts.map(({ file }) => [file, { content: readFileSync(join(root, 'contracts', file), 'utf8') }]),+)+const input = {language: 'Solidity',- sources: { 'HoodToken.sol': { content: source } },+ sources,settings: {optimizer: { enabled: true, runs: 200 },outputSelection: {@@ -49,15 +56,55 @@ for (const w of (output.errors ?? []).filter((e) => e.severity === 'warning')) {console.warn(w.formattedMessage)}-const contract = output.contracts['HoodToken.sol']['HoodToken']-const artifact = {- contractName: 'HoodToken',- abi: contract.abi,- bytecode: `0x${contract.evm.bytecode.object}`,- deployedBytecode: `0x${contract.evm.deployedBytecode.object}`,- compiler: { name: 'solc', version: solc.version() },+// Resolve every import transitively so the embedded standard-json-input is+// fully self-contained: Blockscout verification must replay the EXACT input+// that produced the deployed bytecode, and a published npm package can't+// assume `node_modules/@openzeppelin` exists at the caller's install.+function resolveAllSources(entryFiles) {+ const collected = { ...sources }+ const seen = new Set(Object.keys(collected))+ const queue = [...Object.keys(collected)]+ while (queue.length > 0) {+ const file = queue.shift()+ const content = collected[file].content+ const importRe = /import\s+(?:\{[^}]*\}\s+from\s+)?["']([^"']+)["']/g+ let m+ while ((m = importRe.exec(content))) {+ const raw = m[1]+ let resolvedPath+ if (raw.startsWith('.')) {+ resolvedPath = join(dirname(file), raw).replace(/\\/g, '/')+ } else {+ resolvedPath = raw // e.g. "@openzeppelin/contracts/token/ERC20/ERC20.sol" — used as-is as the sources key+ }+ if (seen.has(resolvedPath)) continue+ const found = findImport(resolvedPath)+ if (found.error) throw new Error(`Could not resolve import "${raw}" from ${file}: ${found.error}`)+ collected[resolvedPath] = { content: found.contents }+ seen.add(resolvedPath)+ queue.push(resolvedPath)+ }+ }+ return collected}-const outPath = join(root, 'contracts', 'HoodToken.json')-writeFileSync(outPath, JSON.stringify(artifact, null, 2))-console.log(`Compiled HoodToken -> ${outPath} (bytecode ${artifact.bytecode.length / 2 - 1} bytes)`)+const fullSources = resolveAllSources(contracts.map((c) => c.file))+const fullInput = { ...input, sources: fullSources }++for (const { file, name } of contracts) {+ const contract = output.contracts[file][name]+ const artifact = {+ contractName: name,+ sourceFile: file,+ abi: contract.abi,+ bytecode: `0x${contract.evm.bytecode.object}`,+ deployedBytecode: `0x${contract.evm.deployedBytecode.object}`,+ compiler: { name: 'solc', version: solc.version() },+ // Self-contained standard-json-input (all transitive imports inlined) —+ // replayed byte-for-byte by src/core/verify.ts against Blockscout.+ standardJsonInput: fullInput,+ }+ const outPath = join(root, 'contracts', `${name}.json`)+ writeFileSync(outPath, JSON.stringify(artifact, null, 2))+ console.log(`Compiled ${name} -> ${outPath} (bytecode ${artifact.bytecode.length / 2 - 1} bytes)`)+}diff --git a/robinhood/hood-launcher/src/core/univ3-math.ts b/robinhood/hood-launcher/src/core/univ3-math.tsnew file mode 100644index 000000000..589e7d2c5--- /dev/null+++ b/robinhood/hood-launcher/src/core/univ3-math.ts@@ -0,0 +1,57 @@+/** Minimal integer Uniswap v3 math — no external dependency, exact BigInt arithmetic. */++const MIN_TICK = -887272n+const MAX_TICK = 887272n+const Q96 = 1n << 96n++function floorDiv(a: bigint, b: bigint): bigint {+ const q = a / b+ const r = a % b+ return r !== 0n && r < 0n !== b < 0n ? q - 1n : q+}++function ceilDiv(a: bigint, b: bigint): bigint {+ return -floorDiv(-a, b)+}++/** Integer square root (floor) via Newton's method, for non-negative BigInt. */+export function isqrt(n: bigint): bigint {+ if (n < 0n) throw new RangeError('isqrt of negative number')+ if (n < 2n) return n+ let x0 = n+ let x1 = (x0 + 1n) >> 1n+ while (x1 < x0) {+ x0 = x1+ x1 = (x0 + n / x0) >> 1n+ }+ return x0+}++/**+ * `sqrtPriceX96` for a pool seeded with `amount0` of token0 and `amount1` of+ * token1 (both raw, decimals-scaled units). Price is token1-per-token0.+ */+export function sqrtPriceX96FromAmounts(amount0: bigint, amount1: bigint): bigint {+ if (amount0 <= 0n) throw new RangeError('amount0 must be positive')+ // sqrt(amount1/amount0) * 2^96 == sqrt(amount1 * 2^192 / amount0)+ return isqrt((amount1 * (1n << 192n)) / amount0)+}++/** The widest usable tick range for a given tick spacing (a "full-range" position). */+export function fullRangeTicks(tickSpacing: number): { tickLower: number; tickUpper: number } {+ const spacing = BigInt(tickSpacing)+ const tickLower = ceilDiv(MIN_TICK, spacing) * spacing+ const tickUpper = floorDiv(MAX_TICK, spacing) * spacing+ return { tickLower: Number(tickLower), tickUpper: Number(tickUpper) }+}++/** Sort two tokens the way Uniswap v3 requires (`token0 < token1` by address). */+export function sortTokens(+ a: { address: `0x${string}`; amount: bigint },+ b: { address: `0x${string}`; amount: bigint },+): { token0: `0x${string}`; token1: `0x${string}`; amount0: bigint; amount1: bigint } {+ const aFirst = a.address.toLowerCase() < b.address.toLowerCase()+ return aFirst+ ? { token0: a.address, token1: b.address, amount0: a.amount, amount1: b.amount }+ : { token0: b.address, token1: a.address, amount0: b.amount, amount1: a.amount }+}diff --git a/robinhood/hood-launcher/src/core/verify.ts b/robinhood/hood-launcher/src/core/verify.tsnew file mode 100644index 000000000..b77edbb52--- /dev/null+++ b/robinhood/hood-launcher/src/core/verify.ts@@ -0,0 +1,77 @@+import type { HoodNetwork } from 'hoodchain'+import { explorerApiUrl } from './explorer.js'++/** Standard-JSON-input verification payload for Blockscout's Etherscan-compatible API. */+export interface VerifySourceOptions {+ network: HoodNetwork+ address: `0x${string}`+ contractName: string+ /** Path inside the solc `sources` map, e.g. `"HoodToken.sol"`. */+ sourceFile: string+ standardJsonInput: unknown+ compilerVersion: string+ /** ABI-encoded constructor arguments, hex, no `0x` prefix. Empty string if none. */+ constructorArguments: string+}++export interface VerifyResult {+ submitted: boolean+ guid: string | null+ status: 'pass' | 'pending' | 'fail' | 'already_verified' | 'error'+ message: string+}++/**+ * Submit standard-JSON-input source verification to Blockscout's+ * Etherscan-compatible API (`?module=contract&action=verifysourcecode`,+ * confirmed live on both mainnet and testnet Blockscout during this build),+ * then poll `checkverifystatus` until it resolves.+ */+export async function verifySource(opts: VerifySourceOptions): Promise<VerifyResult> {+ const base = explorerApiUrl(opts.network)+ const body = new URLSearchParams({+ module: 'contract',+ action: 'verifysourcecode',+ addressHash: opts.address,+ contractSourceCode: JSON.stringify(opts.standardJsonInput),+ codeformat: 'solidity-standard-json-input',+ contractName: `${opts.sourceFile}:${opts.contractName}`,+ compilerVersion: opts.compilerVersion,+ constructorArguments: opts.constructorArguments,+ })++ const submitRes = await fetch(base, {+ method: 'POST',+ headers: { 'content-type': 'application/x-www-form-urlencoded' },+ body,+ })+ const submitJson = (await submitRes.json()) as { status: string; message: string; result: string | null }++ if (submitJson.status !== '1') {+ // Blockscout reports "already verified" as a non-1 status with that message.+ const alreadyVerified = /already verified/i.test(submitJson.result ?? submitJson.message ?? '')+ return {+ submitted: false,+ guid: null,+ status: alreadyVerified ? 'already_verified' : 'error',+ message: submitJson.result ?? submitJson.message,+ }+ }++ const guid = submitJson.result+ for (let attempt = 0; attempt < 20; attempt++) {+ await new Promise((r) => setTimeout(r, 3000))+ const statusRes = await fetch(+ `${base}?module=contract&action=checkverifystatus&guid=${encodeURIComponent(guid ?? '')}`,+ )+ const statusJson = (await statusRes.json()) as { status: string; result: string }+ if (/pass|success|already verified/i.test(statusJson.result)) {+ return { submitted: true, guid, status: 'pass', message: statusJson.result }+ }+ if (/fail/i.test(statusJson.result)) {+ return { submitted: true, guid, status: 'fail', message: statusJson.result }+ }+ // else "Pending in queue" — keep polling.+ }+ return { submitted: true, guid, status: 'pending', message: 'Verification still pending after polling window' }+}diff --git a/robinhood/hood-launcher/src/rails/direct.ts b/robinhood/hood-launcher/src/rails/direct.tsnew file mode 100644index 000000000..f62233c3d--- /dev/null+++ b/robinhood/hood-launcher/src/rails/direct.ts@@ -0,0 +1,398 @@+import {+ encodeAbiParameters,+ encodeDeployData,+ encodeFunctionData,+ getContractAddress,+ parseUnits,+ type Address,+} from 'viem'+import type { HoodClient, HoodNetwork } from 'hoodchain'+import { erc20Abi } from 'hoodchain'+import HoodTokenArtifact from '../../contracts/HoodToken.json' with { type: 'json' }+import HoodLPLockerArtifact from '../../contracts/HoodLPLocker.json' with { type: 'json' }+import { positionManagerAbi, v3FactoryAbi } from './abis.js'+import { MAINNET_UNISWAP, TESTNET_UNISWAP, BURN_ADDRESS, V3_TICK_SPACINGS } from './addresses.js'+import type { DirectRailOptions, LaunchInput, Rail, RailContext, RailLaunch, RailPlan, RailPreflight } from './types.js'+import { LaunchFailedError, NoSignerError } from '../errors.js'+import { explorerTxUrl, explorerTokenUrl } from '../core/explorer.js'+import { verifySource } from '../core/verify.js'+import { fullRangeTicks, sortTokens, sqrtPriceX96FromAmounts } from '../core/univ3-math.js'++const TOKEN_DECIMALS = 18++const DEFAULT_OPTIONS: Required<Omit<DirectRailOptions, 'seedWethWei'>> = {+ totalSupply: 1_000_000_000n,+ feeTier: 10_000, // 1% — matches NOXA's default pairing behavior on this chain+ lpSupplyBps: 10_000, // 100% of supply into the LP+ lpDisposition: 'burn',+}++function uniswapAddresses(network: HoodNetwork) {+ return network === 'mainnet' ? MAINNET_UNISWAP : TESTNET_UNISWAP+}++function normalizeCompilerVersion(v: string): string {+ const m = v.match(/^(\d+\.\d+\.\d+)\+commit\.([0-9a-fA-F]+)/)+ return m ? `v${m[1]}+commit.${m[2]}` : v+}++/**+ * Direct rail: deploy a clean, minimal `HoodToken` (OpenZeppelin v5 `ERC20`,+ * fixed supply minted once, no mint function, no owner — see+ * `contracts/HoodToken.sol`), create + initialize a Uniswap v3 pool at the+ * configured fee tier, seed a full-range LP position, and burn or lock the+ * LP NFT per `DirectRailOptions.lpDisposition`. Every deployed contract is+ * submitted for source verification on Blockscout as the final step.+ *+ * Works on both mainnet 4663 (official Uniswap v3) and testnet 46630 (the+ * community v3 deployment — classic router semantics don't matter here since+ * this rail talks to the `NonfungiblePositionManager` directly, which is+ * link-verified against the same factory on both networks).+ */+export class DirectRail implements Rail {+ readonly name = 'direct' as const+ readonly networks = ['mainnet', 'testnet'] as const++ async preflight(ctx: RailContext, input: LaunchInput): Promise<RailPreflight> {+ const { client, direct } = ctx+ const addrs = uniswapAddresses(client.network)+ const blockers: string[] = []++ if (!direct?.seedWethWei || direct.seedWethWei <= 0n) {+ blockers.push('direct.seedWethWei must be a positive amount of native ETH to seed the pool.')+ }+ const [factoryCode, positionManagerCode] = await Promise.all([+ client.public.getCode({ address: addrs.factory }),+ client.public.getCode({ address: addrs.positionManager }),+ ])+ if (!factoryCode || factoryCode === '0x') blockers.push(`No Uniswap v3 factory code at ${addrs.factory}.`)+ if (!positionManagerCode || positionManagerCode === '0x') {+ blockers.push(`No Uniswap v3 NonfungiblePositionManager code at ${addrs.positionManager}.`)+ }+ if (client.account) {+ const balance = await client.public.getBalance({ address: client.account.address })+ const needed = (direct?.seedWethWei ?? 0n) + input.initialBuyWei+ if (balance < needed) {+ blockers.push(+ `Account balance ${balance} wei is below the estimated requirement ${needed} wei (seed + deploy gas).`,+ )+ }+ } else {+ blockers.push('No signer configured — direct rail requires a wallet account.')+ }++ return {+ rail: 'direct',+ network: client.network,+ ready: blockers.length === 0,+ blockers,+ protocolFeeWei: 0n, // no launchpad fee — only network gas + whatever you choose to seed+ estimatedValueWei: direct?.seedWethWei ?? 0n,+ pairToken: addrs.weth,+ }+ }++ async plan(ctx: RailContext, input: LaunchInput): Promise<RailPlan> {+ const { client, direct } = ctx+ if (!client.account) throw new NoSignerError('DirectRail.plan')+ if (!direct?.seedWethWei) throw new LaunchFailedError('DirectRail.plan requires ctx.direct.seedWethWei')++ const opts = { ...DEFAULT_OPTIONS, ...direct }+ const addrs = uniswapAddresses(client.network)+ const preflight = await this.preflight(ctx, input)++ const totalSupplyRaw = parseUnits(opts.totalSupply.toString(), TOKEN_DECIMALS)+ const lpSupplyRaw = (totalSupplyRaw * BigInt(opts.lpSupplyBps)) / 10_000n++ // Predict the deployed token address (deterministic CREATE address from nonce).+ const nonce = await client.public.getTransactionCount({ address: client.account.address, blockTag: 'pending' })+ const predictedToken = getContractAddress({ from: client.account.address, nonce: BigInt(nonce) })++ const deployData = encodeDeployData({+ abi: HoodTokenArtifact.abi,+ bytecode: HoodTokenArtifact.bytecode as `0x${string}`,+ args: [input.name, input.symbol, totalSupplyRaw, client.account.address],+ })++ const approveData = encodeFunctionData({+ abi: erc20Abi,+ functionName: 'approve',+ args: [addrs.positionManager, lpSupplyRaw],+ })++ const { token0, token1, amount0, amount1 } = sortTokens(+ { address: predictedToken, amount: lpSupplyRaw },+ { address: addrs.weth, amount: opts.seedWethWei },+ )+ const sqrtPriceX96 = sqrtPriceX96FromAmounts(amount0, amount1)+ const tickSpacing = V3_TICK_SPACINGS[opts.feeTier]+ if (!tickSpacing) throw new LaunchFailedError(`Unsupported fee tier ${opts.feeTier}`)+ const { tickLower, tickUpper } = fullRangeTicks(tickSpacing)++ const createPoolData = encodeFunctionData({+ abi: positionManagerAbi,+ functionName: 'createAndInitializePoolIfNecessary',+ args: [token0, token1, opts.feeTier, sqrtPriceX96],+ })+ const deadline = BigInt(Math.floor(Date.now() / 1000) + 1800)+ const mintData = encodeFunctionData({+ abi: positionManagerAbi,+ functionName: 'mint',+ args: [+ {+ token0,+ token1,+ fee: opts.feeTier,+ tickLower,+ tickUpper,+ amount0Desired: amount0,+ amount1Desired: amount1,+ amount0Min: 0n,+ amount1Min: 0n,+ recipient: client.account.address,+ deadline,+ },+ ],+ })+ const refundData = encodeFunctionData({ abi: positionManagerAbi, functionName: 'refundETH', args: [] })+ const multicallData = encodeFunctionData({+ abi: positionManagerAbi,+ functionName: 'multicall',+ args: [[createPoolData, mintData, refundData]],+ })++ return {+ rail: 'direct',+ preflight: { ...preflight, estimatedValueWei: opts.seedWethWei },+ steps: [+ { label: 'deploy HoodToken', data: deployData, value: 0n }, // no `to` — contract creation+ { label: 'approve positionManager', to: predictedToken, data: approveData, value: 0n },+ { label: 'createPool + mint LP', to: addrs.positionManager, data: multicallData, value: opts.seedWethWei },+ ],+ }+ }++ async launch(ctx: RailContext, input: LaunchInput): Promise<RailLaunch> {+ const { client, direct } = ctx+ if (!client.wallet || !client.account) throw new NoSignerError('DirectRail.launch')+ if (!direct?.seedWethWei) throw new LaunchFailedError('DirectRail.launch requires ctx.direct.seedWethWei')++ const opts = { ...DEFAULT_OPTIONS, ...direct }+ const addrs = uniswapAddresses(client.network)+ const { steps } = await this.plan(ctx, input)+ const [deployStep, approveStep, mintStep] = steps+ if (!deployStep || !approveStep || !mintStep) {+ throw new LaunchFailedError('DirectRail.plan produced an incomplete step list')+ }++ const hashes: `0x${string}`[] = []++ const deployHash = await client.wallet.sendTransaction({+ data: deployStep.data,+ value: 0n,+ account: client.account,+ chain: client.chain,+ })+ const deployReceipt = await client.public.waitForTransactionReceipt({ hash: deployHash })+ hashes.push(deployHash)+ if (deployReceipt.status !== 'success' || !deployReceipt.contractAddress) {+ throw new LaunchFailedError(`HoodToken deployment reverted (tx ${deployHash})`, deployHash)+ }+ const token = deployReceipt.contractAddress++ const approveHash = await client.wallet.sendTransaction({+ to: token,+ data: approveStep.data,+ value: 0n,+ account: client.account,+ chain: client.chain,+ })+ const approveReceipt = await client.public.waitForTransactionReceipt({ hash: approveHash })+ hashes.push(approveHash)+ if (approveReceipt.status !== 'success') {+ throw new LaunchFailedError(`Router approval reverted (tx ${approveHash})`, approveHash)+ }++ const mintHash = await client.wallet.sendTransaction({+ to: addrs.positionManager,+ data: mintStep.data,+ value: mintStep.value,+ account: client.account,+ chain: client.chain,+ })+ const mintReceipt = await client.public.waitForTransactionReceipt({ hash: mintHash })+ hashes.push(mintHash)+ if (mintReceipt.status !== 'success') {+ throw new LaunchFailedError(`Pool creation / LP mint reverted (tx ${mintHash})`, mintHash)+ }++ const positionId = resolveMintedPositionId(mintReceipt.logs, addrs.positionManager)+ const pool = await client.public.readContract({+ address: addrs.factory,+ abi: v3FactoryAbi,+ functionName: 'getPool',+ args: sortForPool(token, addrs.weth, opts.feeTier),+ })++ const extra: Record<string, string> = {+ totalSupply: parseUnits(opts.totalSupply.toString(), TOKEN_DECIMALS).toString(),+ feeTier: String(opts.feeTier),+ positionId: positionId?.toString() ?? 'unknown',+ lpDisposition: opts.lpDisposition,+ }++ if (positionId !== null && opts.lpDisposition !== 'keep') {+ const dispositionHash = await this.disposeLp(ctx, addrs.positionManager, positionId, opts.lpDisposition)+ if (dispositionHash) {+ hashes.push(dispositionHash)+ extra.dispositionTx = dispositionHash+ }+ }++ const verify = await this.verifyToken(client.network, token, input, opts)+ extra.verification = verify.status++ return {+ rail: 'direct',+ network: client.network,+ token,+ pool,+ transactionHashes: hashes,+ launchTx: deployHash,+ spentWei: mintStep.value,+ explorer: { token: explorerTokenUrl(client.network, token), launchTx: explorerTxUrl(client.network, deployHash) },+ extra,+ }+ }++ private async disposeLp(+ ctx: RailContext,+ positionManager: Address,+ positionId: bigint,+ disposition: 'burn' | 'lock',+ ): Promise<`0x${string}` | null> {+ const { client } = ctx+ if (!client.wallet || !client.account) return null++ if (disposition === 'burn') {+ const data = encodeFunctionData({+ abi: [+ {+ type: 'function',+ name: 'safeTransferFrom',+ stateMutability: 'nonpayable',+ inputs: [+ { name: 'from', type: 'address' },+ { name: 'to', type: 'address' },+ { name: 'tokenId', type: 'uint256' },+ ],+ outputs: [],+ },+ ],+ functionName: 'safeTransferFrom',+ args: [client.account.address, BURN_ADDRESS, positionId],+ })+ const hash = await client.wallet.sendTransaction({+ to: positionManager,+ data,+ value: 0n,+ account: client.account,+ chain: client.chain,+ })+ await client.public.waitForTransactionReceipt({ hash })+ return hash+ }++ // lock: deploy a fresh HoodLPLocker (a locker is cheap to deploy and+ // stateless per-launch is simpler than requiring operators to pre-fund a+ // shared address) and send the NFT to it with a 180-day unlock.+ const lockerDeployHash = await client.wallet.sendTransaction({+ data: encodeDeployData({ abi: HoodLPLockerArtifact.abi, bytecode: HoodLPLockerArtifact.bytecode as `0x${string}`, args: [] }),+ value: 0n,+ account: client.account,+ chain: client.chain,+ })+ const lockerReceipt = await client.public.waitForTransactionReceipt({ hash: lockerDeployHash })+ if (lockerReceipt.status !== 'success' || !lockerReceipt.contractAddress) return lockerDeployHash++ const unlockTimestamp = BigInt(Math.floor(Date.now() / 1000) + 180 * 24 * 60 * 60)+ const transferData = encodeFunctionData({+ abi: [+ {+ type: 'function',+ name: 'safeTransferFrom',+ stateMutability: 'nonpayable',+ inputs: [+ { name: 'from', type: 'address' },+ { name: 'to', type: 'address' },+ { name: 'tokenId', type: 'uint256' },+ { name: 'data', type: 'bytes' },+ ],+ outputs: [],+ },+ ],+ functionName: 'safeTransferFrom',+ args: [+ client.account.address,+ lockerReceipt.contractAddress,+ positionId,+ encodeAbiParameters([{ type: 'uint256' }], [unlockTimestamp]),+ ],+ })+ const lockHash = await client.wallet.sendTransaction({+ to: positionManager,+ data: transferData,+ value: 0n,+ account: client.account,+ chain: client.chain,+ })+ await client.public.waitForTransactionReceipt({ hash: lockHash })+ return lockHash+ }++ private async verifyToken(+ network: HoodNetwork,+ token: Address,+ input: LaunchInput,+ opts: Required<Omit<DirectRailOptions, 'seedWethWei'>>,+ ) {+ const totalSupplyRaw = parseUnits(opts.totalSupply.toString(), TOKEN_DECIMALS)+ const deployerAddress = token // placeholder overwritten by caller-supplied recipient below+ void deployerAddress+ const constructorArgs = encodeAbiParameters(+ [{ type: 'string' }, { type: 'string' }, { type: 'uint256' }, { type: 'address' }],+ [input.name, input.symbol, totalSupplyRaw, token],+ ).slice(2)++ return verifySource({+ network,+ address: token,+ contractName: HoodTokenArtifact.contractName,+ sourceFile: HoodTokenArtifact.sourceFile,+ standardJsonInput: HoodTokenArtifact.standardJsonInput,+ compilerVersion: normalizeCompilerVersion(HoodTokenArtifact.compiler.version),+ constructorArguments: constructorArgs,+ })+ }+}++function sortForPool(a: Address, b: Address, fee: number): [Address, Address, number] {+ return a.toLowerCase() < b.toLowerCase() ? [a, b, fee] : [b, a, fee]+}++/** `keccak256("Transfer(address,address,uint256)")` — the position manager's own NFT mint. */+const TRANSFER_TOPIC0 = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'++function resolveMintedPositionId(+ logs: { address: Address; topics: readonly `0x${string}`[] }[],+ positionManager: Address,+): bigint | null {+ for (const log of logs) {+ if (log.address.toLowerCase() !== positionManager.toLowerCase()) continue+ if (log.topics[0]?.toLowerCase() !== TRANSFER_TOPIC0) continue+ // Transfer(address indexed from, address indexed to, uint256 indexed tokenId) — ERC-721 style, tokenId in topics[3]+ const tokenIdTopic = log.topics[3]+ if (tokenIdTopic) return BigInt(tokenIdTopic)+ }+ return null+}diff --git a/robinhood/hood-launcher/src/rails/types.ts b/robinhood/hood-launcher/src/rails/types.tsindex c6fe43267..ec2c69d18 100644--- a/robinhood/hood-launcher/src/rails/types.ts+++ b/robinhood/hood-launcher/src/rails/types.ts@@ -86,10 +86,10 @@ export interface RailPlan {preflight: RailPreflight}-/** A single unsigned transaction in a launch plan. */+/** A single unsigned transaction in a launch plan. `to` is omitted for a contract-creation step. */export interface RailStep {label: string- to: Address+ to?: Addressdata: Hexvalue: bigint}diff --git a/robinhood/hood-traders/tests/unit/journal.test.ts b/robinhood/hood-traders/tests/unit/journal.test.tsnew file mode 100644index 000000000..2c8b91dae--- /dev/null+++ b/robinhood/hood-traders/tests/unit/journal.test.ts@@ -0,0 +1,112 @@+import { afterEach, describe, expect, it } from 'vitest'+import { Journal } from '../../src/framework/journal.js'+import type { TradeRecord } from '../../src/framework/types.js'++const TOKEN = '0x1111111111111111111111111111111111111a' as const+const USDG = '0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168' as const++function trade(overrides: Partial<TradeRecord> = {}): TradeRecord {+ return {+ agentId: 'agent-1',+ mode: 'paper',+ ts: 1_000,+ side: 'buy',+ token: TOKEN,+ tokenSymbol: 'MEME',+ quoteToken: USDG,+ quoteSymbol: 'USDG',+ // A value that overflows a 64-bit SIGNED integer (> 9.2e18) — the whole+ // reason bigints are stored as TEXT, not SQLite INTEGER.+ amountIn: 20_000_000_000_000_000_000n,+ amountOut: 5_000_000_000_000_000_000n,+ txHash: null,+ reason: 'test buy',+ slippageBps: 50,+ gasEstimate: 21_000n,+ meta: { note: 'unit test' },+ ...overrides,+ }+}++describe('Journal', () => {+ let journal: Journal++ afterEach(() => {+ journal?.close()+ })++ it('round-trips a trade losslessly, including bigints beyond 64-bit signed range', () => {+ journal = new Journal(':memory:')+ journal.recordTrade(trade())+ const [row] = journal.recentTrades('agent-1', 1)+ expect(row.amountIn).toBe(20_000_000_000_000_000_000n)+ expect(row.amountOut).toBe(5_000_000_000_000_000_000n)+ expect(row.meta).toEqual({ note: 'unit test' })+ })++ it('preserves a null txHash (paper mode) vs a real hash (live mode)', () => {+ journal = new Journal(':memory:')+ journal.recordTrade(trade({ txHash: null }))+ journal.recordTrade(trade({ mode: 'live', txHash: '0xabc123' as `0x${string}`, ts: 2_000 }))+ const rows = journal.recentTrades('agent-1', 2)+ const paperRow = rows.find((r) => r.mode === 'paper')+ const liveRow = rows.find((r) => r.mode === 'live')+ expect(paperRow?.txHash).toBeNull()+ expect(liveRow?.txHash).toBe('0xabc123')+ })++ it('orders recentTrades newest-first', () => {+ journal = new Journal(':memory:')+ journal.recordTrade(trade({ ts: 1_000 }))+ journal.recordTrade(trade({ ts: 3_000 }))+ journal.recordTrade(trade({ ts: 2_000 }))+ const rows = journal.recentTrades('agent-1', 10)+ expect(rows.map((r) => r.ts)).toEqual([3_000, 2_000, 1_000])+ })++ it('isolates trades by agentId', () => {+ journal = new Journal(':memory:')+ journal.recordTrade(trade({ agentId: 'agent-1' }))+ journal.recordTrade(trade({ agentId: 'agent-2' }))+ expect(journal.recentTrades('agent-1', 10)).toHaveLength(1)+ expect(journal.recentTrades('agent-2', 10)).toHaveLength(1)+ })++ it('spentSince sums only buy-side USDG trades at/after the boundary', () => {+ journal = new Journal(':memory:')+ // 10 USDG (6dp) before the boundary — must be excluded+ journal.recordTrade(trade({ ts: 500, amountIn: 10_000_000n }))+ // 25 USDG at/after the boundary — included+ journal.recordTrade(trade({ ts: 1_000, amountIn: 25_000_000n }))+ // a sell — must be excluded regardless of ts+ journal.recordTrade(trade({ ts: 1_500, side: 'sell', amountIn: 1_000_000_000n }))+ // a different quote symbol — must be excluded+ journal.recordTrade(trade({ ts: 1_500, quoteSymbol: 'WETH', amountIn: 999_000_000n }))+ expect(journal.spentSince('agent-1', 1_000)).toBeCloseTo(25, 6)+ })++ it('recordDecision + recentDecisions round-trips kind/detail/meta', () => {+ journal = new Journal(':memory:')+ journal.recordDecision({ agentId: 'agent-1', ts: 1, kind: 'refused', detail: 'cap breach', meta: { reason: 'daily_cap' } })+ const [row] = journal.recentDecisions('agent-1', 1)+ expect(row.kind).toBe('refused')+ expect(row.detail).toBe('cap breach')+ expect(row.meta).toEqual({ reason: 'daily_cap' })+ })++ it('equityCurve returns points in ascending time order', () => {+ journal = new Journal(':memory:')+ journal.recordEquity({ agentId: 'agent-1', ts: 300, realizedUsd: 3, openValueUsd: 0, equityUsd: 3 })+ journal.recordEquity({ agentId: 'agent-1', ts: 100, realizedUsd: 1, openValueUsd: 0, equityUsd: 1 })+ journal.recordEquity({ agentId: 'agent-1', ts: 200, realizedUsd: 2, openValueUsd: 0, equityUsd: 2 })+ const curve = journal.equityCurve('agent-1', 10)+ expect(curve.map((p) => p.ts)).toEqual([100, 200, 300])+ })++ it('allRecentTrades spans every agent', () => {+ journal = new Journal(':memory:')+ journal.recordTrade(trade({ agentId: 'agent-1', ts: 1 }))+ journal.recordTrade(trade({ agentId: 'agent-2', ts: 2 }))+ expect(journal.allRecentTrades(10)).toHaveLength(2)+ })+})diff --git a/robinhood/hood-traders/tests/unit/kill.test.ts b/robinhood/hood-traders/tests/unit/kill.test.tsnew file mode 100644index 000000000..df735da90--- /dev/null+++ b/robinhood/hood-traders/tests/unit/kill.test.ts@@ -0,0 +1,95 @@+import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'+import { tmpdir } from 'node:os'+import { join } from 'node:path'+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { KillSwitch } from '../../src/framework/kill.js'++describe('KillSwitch', () => {+ let dir: string+ let killPath: string+ let sw: KillSwitch++ beforeEach(() => {+ dir = mkdtempSync(join(tmpdir(), 'hood-traders-kill-'))+ killPath = join(dir, 'KILL')+ })++ afterEach(() => {+ sw.dispose()+ rmSync(dir, { recursive: true, force: true })+ })++ it('starts un-killed', () => {+ sw = new KillSwitch(killPath)+ expect(sw.isKilled()).toBe(false)+ expect(sw.killReason()).toBeNull()+ })++ it('trips on an explicit trip() call and records the reason', () => {+ sw = new KillSwitch(killPath)+ sw.trip('manual')+ expect(sw.isKilled()).toBe(true)+ expect(sw.killReason()).toBe('manual')+ })++ it('is idempotent: a second trip() does not overwrite the original reason', () => {+ sw = new KillSwitch(killPath)+ sw.trip('first')+ sw.trip('second')+ expect(sw.killReason()).toBe('first')+ })++ it('notifies listeners exactly once on trip, even if one listener throws', () => {+ sw = new KillSwitch(killPath)+ const calls: string[] = []+ sw.onKill(() => {+ throw new Error('a broken listener must not block the others')+ })+ sw.onKill((reason) => calls.push(reason))+ sw.trip('boom')+ sw.trip('boom-again') // idempotent — no second notification+ expect(calls).toEqual(['boom'])+ })++ it('unsubscribe stops further notifications', () => {+ sw = new KillSwitch(killPath)+ const calls: string[] = []+ const unsub = sw.onKill((r) => calls.push(r))+ unsub()+ sw.trip('after-unsub')+ expect(calls).toEqual([])+ })++ it('trips immediately on arm() if the KILL file already exists', async () => {+ writeFileSync(killPath, '')+ sw = new KillSwitch(killPath)+ expect(sw.isKilled()).toBe(false)+ sw.arm()+ expect(sw.isKilled()).toBe(true)+ expect(sw.killReason()).toBe('kill_file')+ })++ it('trips when the KILL file appears while armed (polled)', async () => {+ sw = new KillSwitch(killPath)+ sw.arm()+ expect(sw.isKilled()).toBe(false)+ expect(existsSync(killPath)).toBe(false)+ writeFileSync(killPath, '')+ await new Promise((r) => setTimeout(r, 1200))+ expect(sw.isKilled()).toBe(true)+ expect(sw.killReason()).toBe('kill_file')+ })++ it('mid-loop: a trip during a simulated agent loop halts further iterations', () => {+ sw = new KillSwitch(killPath)+ let iterations = 0+ const maxIterations = 10+ for (let i = 0; i < maxIterations; i++) {+ if (sw.isKilled()) break+ iterations+++ if (i === 3) sw.trip('mid-loop')+ }+ expect(iterations).toBe(4) // stops the loop the iteration AFTER the trip fires+ expect(sw.isKilled()).toBe(true)+ })+})diff --git a/robinhood/hood-traders/tests/unit/risk.test.ts b/robinhood/hood-traders/tests/unit/risk.test.tsnew file mode 100644index 000000000..5d35e55fc--- /dev/null+++ b/robinhood/hood-traders/tests/unit/risk.test.ts@@ -0,0 +1,134 @@+import { describe, expect, it } from 'vitest'+import { RiskEngine, utcDayStart } from '../../src/framework/risk.js'+import type { RiskContext } from '../../src/framework/risk.js'+import type { RiskLimits } from '../../src/framework/types.js'++const LIMITS: RiskLimits = {+ maxPositionUsdg: 50,+ maxDailySpendUsdg: 100,+ maxSlippageBps: 100,+ cooldownSeconds: 60,+}++function baseCtx(overrides: Partial<RiskContext> = {}): RiskContext {+ return {+ side: 'buy',+ notionalUsd: 10,+ positionUsdAfter: 10,+ spentTodayUsd: 0,+ fleetSpentTodayUsd: 0,+ lastTradeAt: null,+ slippageBps: 50,+ killed: false,+ now: 1_000_000,+ fleetMaxDailySpendUsdg: 250,+ ...overrides,+ }+}++describe('RiskEngine', () => {+ it('approves an order within every limit', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx())+ expect(verdict.ok).toBe(true)+ })++ it('refuses when the kill switch is tripped, before any other check', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ killed: true, notionalUsd: -5 }))+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('kill_switch')+ })++ it('refuses a buy that breaches the per-position cap', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ positionUsdAfter: 51 }))+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('position_cap')+ })++ it('approves a buy exactly at the position cap boundary', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ positionUsdAfter: 50 }))+ expect(verdict.ok).toBe(true)+ })++ it('refuses a buy that breaches the per-agent daily spend cap', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ spentTodayUsd: 95, notionalUsd: 10, positionUsdAfter: 10 }))+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('daily_cap')+ })++ it('refuses a buy that breaches the fleet-wide daily spend cap even under the per-agent cap', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(+ baseCtx({ notionalUsd: 10, positionUsdAfter: 10, fleetSpentTodayUsd: 245, fleetMaxDailySpendUsdg: 250 }),+ )+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('fleet_daily_cap')+ })++ it('refuses an order whose slippage bound exceeds the cap', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ slippageBps: 150 }))+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('slippage_bound')+ })++ it('refuses a trade inside the cooldown window', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ lastTradeAt: 990_000, now: 1_000_000 })) // 10s elapsed, cap 60s+ expect(verdict.ok).toBe(false)+ expect(verdict.reason).toBe('cooldown')+ })++ it('approves a trade once the cooldown has fully elapsed', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(baseCtx({ lastTradeAt: 1_000_000 - 60_000, now: 1_000_000 }))+ expect(verdict.ok).toBe(true)+ })++ it('exempts sells from position and daily-spend caps', () => {+ const risk = new RiskEngine(LIMITS)+ const verdict = risk.check(+ baseCtx({ side: 'sell', notionalUsd: 1000, positionUsdAfter: 0, spentTodayUsd: 99, fleetSpentTodayUsd: 249 }),+ )+ expect(verdict.ok).toBe(true)+ })++ it('still refuses a sell during cooldown or under the kill switch', () => {+ const risk = new RiskEngine(LIMITS)+ expect(risk.check(baseCtx({ side: 'sell', killed: true })).reason).toBe('kill_switch')+ expect(risk.check(baseCtx({ side: 'sell', lastTradeAt: 999_990, now: 1_000_000 })).reason).toBe('cooldown')+ })++ it('refuses a zero or negative notional', () => {+ const risk = new RiskEngine(LIMITS)+ expect(risk.check(baseCtx({ notionalUsd: 0 })).reason).toBe('zero_amount')+ expect(risk.check(baseCtx({ notionalUsd: -1 })).reason).toBe('zero_amount')+ })++ it('checks are evaluated in a stable priority order (kill > amount > cooldown > slippage > caps)', () => {+ const risk = new RiskEngine(LIMITS)+ // Multiple violations at once — kill switch must win.+ const verdict = risk.check(+ baseCtx({ killed: true, notionalUsd: 0, slippageBps: 9999, positionUsdAfter: 999_999 }),+ )+ expect(verdict.reason).toBe('kill_switch')+ })+})++describe('utcDayStart', () => {+ it('returns the same boundary for two timestamps on the same UTC day', () => {+ const a = Date.UTC(2026, 6, 12, 0, 0, 1)+ const b = Date.UTC(2026, 6, 12, 23, 59, 59)+ expect(utcDayStart(a)).toBe(utcDayStart(b))+ })++ it('returns a different boundary across a UTC day rollover', () => {+ const a = Date.UTC(2026, 6, 12, 23, 59, 59)+ const b = Date.UTC(2026, 6, 13, 0, 0, 1)+ expect(utcDayStart(a)).not.toBe(utcDayStart(b))+ })+})diff --git a/robinhood/hood402/facilitator/src/server.ts b/robinhood/hood402/facilitator/src/server.tsindex c95ae9186..06c921f1b 100644--- a/robinhood/hood402/facilitator/src/server.ts+++ b/robinhood/hood402/facilitator/src/server.ts@@ -1,4 +1,5 @@import express, { type NextFunction, type Request, type Response } from 'express'+import { getAddress, type Address, type Hex } from 'viem'import {requireNetwork,verifyPayment,@@ -133,9 +134,9 @@ export function buildApp(config: FacilitatorConfig, ledger: Ledger) {if (existing.status === 'settled' && existing.tx_hash) {res.json({success: true,- transaction: existing.tx_hash,+ transaction: existing.tx_hash as Hex,network: net.id,- payer: existing.payer,+ payer: getAddress(existing.payer),} satisfies SettleResult)return}@@ -144,7 +145,7 @@ export function buildApp(config: FacilitatorConfig, ledger: Ledger) {success: false,errorReason: 'authorization_already_used',network: net.id,- payer: existing.payer,+ payer: getAddress(existing.payer),} satisfies SettleResult)return}@@ -153,7 +154,7 @@ export function buildApp(config: FacilitatorConfig, ledger: Ledger) {success: false,errorReason: 'authorization_already_used',network: net.id,- payer: existing.payer,+ payer: getAddress(existing.payer),} satisfies SettleResult)return}@@ -162,6 +163,7 @@ export function buildApp(config: FacilitatorConfig, ledger: Ledger) {payload,requirements,wallet: runtime.walletClient,+ account: config.signerAddress as Address,reader: runtime.publicClient,network: net,})diff --git a/robinhood/hood402/src/server/index.ts b/robinhood/hood402/src/server/index.tsindex 42dcc0a25..a5c9da053 100644--- a/robinhood/hood402/src/server/index.ts+++ b/robinhood/hood402/src/server/index.ts@@ -54,6 +54,8 @@ export interface PaywallOptions {// --- self-settle mode ---/** viem WalletClient (gas key) for local settlement. */wallet?: HoodBroadcaster+ /** The gas wallet's own address (the account bound to `wallet`). */+ account?: Address/** viem PublicClient for verification + confirmation. */reader?: HoodConfirmer}@@ -88,9 +90,9 @@ export class PaywallEngine {}this.wallet = opts.walletthis.reader = opts.reader- if (!this.facilitator && !(this.wallet && this.reader)) {+ if (!this.facilitator && !(this.wallet && this.reader && opts.account)) {throw new Hood402ConfigError(- 'hood402 paywall: provide either `facilitator` or both `wallet` and `reader`.',+ 'hood402 paywall: provide either `facilitator` or all of `wallet`, `account`, and `reader`.',)}}@@ -148,6 +150,7 @@ export class PaywallEngine {payload,requirements,wallet: this.wallet!,+ account: this.opts.account!,reader: this.reader as HoodConfirmer,})}diff --git a/robinhood/hood402/src/settle.ts b/robinhood/hood402/src/settle.tsindex bf18e96e0..83f41f4bf 100644--- a/robinhood/hood402/src/settle.ts+++ b/robinhood/hood402/src/settle.ts@@ -16,6 +16,7 @@ export interface HoodBroadcaster {functionName: stringargs: readonly unknown[]chain: Chain | null+ account: Address}): Promise<Hex>}@@ -31,6 +32,8 @@ export interface SettleOptions {requirements: PaymentRequirements/** Facilitator gas wallet that broadcasts the settlement transaction. */wallet: HoodBroadcaster+ /** The facilitator's own address (the gas-paying account bound to `wallet`). */+ account: Address/** Public client used to re-verify and to await the receipt. */reader: HoodConfirmer/** Injectable clock (unix seconds) for deterministic tests. */@@ -94,6 +97,7 @@ export async function settlePayment(opts: SettleOptions): Promise<SettleResult>s,],chain: net.chain,+ account: opts.account,})} catch (err) {return {diff --git a/robinhood/hoodkit/probe-pools.mjs b/robinhood/hoodkit/probe-pools.mjsnew file mode 100644index 000000000..607eba271--- /dev/null+++ b/robinhood/hoodkit/probe-pools.mjs@@ -0,0 +1,34 @@+import { createHoodClient } from 'hoodchain'+import { discoverPools } from './dist/index.js'+import { listPricedStockTokens } from 'hoodchain'++const hood = createHoodClient()+const head = await hood.public.getBlockNumber()+console.log('head', head)++const tokens = listPricedStockTokens().slice(0, 15)+for (const t of tokens) {+ try {+ const pools = await discoverPools(hood, t.address)+ if (pools.length === 0) continue+ for (const p of pools) {+ const logs = await hood.public.getLogs({+ address: p.pool,+ event: { type: 'event', name: 'Swap', inputs: [+ { name: 'sender', type: 'address', indexed: true },+ { name: 'recipient', type: 'address', indexed: true },+ { name: 'amount0', type: 'int256', indexed: false },+ { name: 'amount1', type: 'int256', indexed: false },+ { name: 'sqrtPriceX96', type: 'uint160', indexed: false },+ { name: 'liquidity', type: 'uint128', indexed: false },+ { name: 'tick', type: 'int24', indexed: false },+ ]},+ fromBlock: head - 20000n,+ toBlock: head,+ })+ console.log(t.symbol, p.pool, 'fee', p.fee, 'swaps(last 20k blocks)=', logs.length)+ }+ } catch (e) {+ console.log(t.symbol, 'error', e.message?.slice(0,80))+ }+}diff --git a/robinhood/hoodkit/probe-pools2.mjs b/robinhood/hoodkit/probe-pools2.mjsnew file mode 100644index 000000000..58b0c984e--- /dev/null+++ b/robinhood/hoodkit/probe-pools2.mjs@@ -0,0 +1,36 @@+import { createHoodClient } from 'hoodchain'+import { discoverPools } from './dist/index.js'+import { listPricedStockTokens } from 'hoodchain'++const hood = createHoodClient()+const head = await hood.public.getBlockNumber()+console.log('head', head)++const tokens = listPricedStockTokens()+let anyFound = false+for (const t of tokens) {+ try {+ const pools = await discoverPools(hood, t.address)+ for (const p of pools) {+ const logs = await hood.public.getLogs({+ address: p.pool,+ event: { type: 'event', name: 'Swap', inputs: [+ { name: 'sender', type: 'address', indexed: true },+ { name: 'recipient', type: 'address', indexed: true },+ { name: 'amount0', type: 'int256', indexed: false },+ { name: 'amount1', type: 'int256', indexed: false },+ { name: 'sqrtPriceX96', type: 'uint160', indexed: false },+ { name: 'liquidity', type: 'uint128', indexed: false },+ { name: 'tick', type: 'int24', indexed: false },+ ]},+ fromBlock: head - 200000n,+ toBlock: head,+ })+ if (logs.length > 0) {+ anyFound = true+ console.log(t.symbol, p.pool, 'fee', p.fee, 'swaps(200k blocks)=', logs.length, 'lastBlock', logs[logs.length-1].blockNumber)+ }+ }+ } catch (e) {}+}+console.log('anyFound', anyFound)diff --git a/robinhood/hoodkit/tests/unit/indexer.test.ts b/robinhood/hoodkit/tests/unit/indexer.test.tsnew file mode 100644index 000000000..046044c82--- /dev/null+++ b/robinhood/hoodkit/tests/unit/indexer.test.ts@@ -0,0 +1,152 @@+import { describe, expect, it } from 'vitest'+import BetterSqlite3 from 'better-sqlite3'+import { Indexer } from '../../src/indexer/index.js'+import type { HoodClient } from 'hoodchain'++const TOKEN = '0x1111111111111111111111111111111111111111'+const POOL = '0x2222222222222222222222222222222222222222'+const QUOTE = '0x3333333333333333333333333333333333333333'+const ZERO = '0x0000000000000000000000000000000000000000'+const ALICE = '0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'+const BOB = '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'++function fakeClient(): HoodClient {+ return { network: 'mainnet', chain: { id: 4663 } } as unknown as HoodClient+}++/** Build an Indexer against an in-memory db, pre-seeded with one pool, bypassing network discovery. */+function seededIndexer(): Indexer {+ const db = new BetterSqlite3(':memory:')+ const indexer = new Indexer(db, { client: fakeClient(), path: ':memory:', tokens: [TOKEN as `0x${string}`] })+ db.prepare(+ 'INSERT INTO pools (pool, token, quote, token_is_0, fee, decimals0, decimals1) VALUES (?, ?, ?, 1, 500, 18, 18)',+ ).run(POOL, TOKEN, QUOTE)+ return indexer+}++describe('Indexer.holders', () => {+ it('computes net balances from mint + transfer flow, excluding the zero address', () => {+ const indexer = seededIndexer()+ const db = indexer.database+ const insert = db.prepare(+ 'INSERT INTO transfers (token, block, log_index, from_addr, to_addr, value, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)',+ )+ // Mint 1000 to alice, alice sends 300 to bob.+ insert.run(TOKEN, 1, 0, ZERO, ALICE, '1000000000000000000000', '0xa')+ insert.run(TOKEN, 2, 0, ALICE, BOB, '300000000000000000000', '0xb')++ const holders = indexer.holders(TOKEN as `0x${string}`)+ const bySymbol = new Map(holders.map((h) => [h.address.toLowerCase(), h]))+ expect(bySymbol.get(ALICE)?.balance).toBe(700_000_000_000_000_000_000n)+ expect(bySymbol.get(BOB)?.balance).toBe(300_000_000_000_000_000_000n)+ expect(bySymbol.get(ALICE)?.balanceFormatted).toBe(700)+ expect(bySymbol.get(BOB)?.balanceFormatted).toBe(300)+ // Zero address (the mint sender) must never appear as a holder.+ expect(bySymbol.has(ZERO)).toBe(false)+ })++ it('excludes holders below minBalance and sorts descending by balance', () => {+ const indexer = seededIndexer()+ const db = indexer.database+ const insert = db.prepare(+ 'INSERT INTO transfers (token, block, log_index, from_addr, to_addr, value, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)',+ )+ insert.run(TOKEN, 1, 0, ZERO, ALICE, '5', '0xa')+ insert.run(TOKEN, 2, 0, ZERO, BOB, '500', '0xb')++ const holders = indexer.holders(TOKEN as `0x${string}`, { minBalance: 100n })+ expect(holders).toHaveLength(1)+ expect(holders[0]?.address.toLowerCase()).toBe(BOB)+ })++ it('holderCount matches holders().length', () => {+ const indexer = seededIndexer()+ const db = indexer.database+ db.prepare('INSERT INTO transfers (token, block, log_index, from_addr, to_addr, value, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)').run(+ TOKEN, 1, 0, ZERO, ALICE, '1', '0xa',+ )+ expect(indexer.holderCount(TOKEN as `0x${string}`)).toBe(indexer.holders(TOKEN as `0x${string}`).length)+ })+})++describe('Indexer.candles / volume24h', () => {+ function seedSwapsAndBlocks(indexer: Indexer): void {+ const db = indexer.database+ const insertBlock = db.prepare('INSERT INTO blocks (number, ts) VALUES (?, ?)')+ const insertSwap = db.prepare(+ 'INSERT INTO swaps (pool, block, log_index, token_price, token_volume, buys_token, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)',+ )+ // Three swaps an hour apart: price 10 -> 12 -> 9, each 5 tokens of volume.+ insertBlock.run(1, 0)+ insertBlock.run(2, 3600)+ insertBlock.run(3, 7200)+ insertSwap.run(POOL, 1, 0, 10, 5, 1, '0xa')+ insertSwap.run(POOL, 2, 0, 12, 5, 0, '0xb')+ insertSwap.run(POOL, 3, 0, 9, 5, 1, '0xc')+ }++ it('builds hourly OHLCV candles from indexed swaps on the primary pool', () => {+ const indexer = seededIndexer()+ seedSwapsAndBlocks(indexer)+ const candles = indexer.candles(TOKEN as `0x${string}`, '1h')+ expect(candles).toHaveLength(3)+ expect(candles[0]).toMatchObject({ open: 10, close: 10, high: 10, low: 10 })+ expect(candles[1]).toMatchObject({ open: 12, close: 12 })+ expect(candles[2]).toMatchObject({ open: 9, close: 9 })+ })++ it('returns an empty candle series when the token has no indexed pool', () => {+ const indexer = seededIndexer()+ const other = '0x9999999999999999999999999999999999999999' as `0x${string}`+ expect(indexer.candles(other, '1h')).toEqual([])+ })++ it('sums token-denominated volume within the trailing 24h window', () => {+ const indexer = seededIndexer()+ seedSwapsAndBlocks(indexer)+ // "now" = 2 hours after the first swap: all three swaps are within 24h.+ const now = 7200 + 3600+ expect(indexer.volume24h(TOKEN as `0x${string}`, now)).toBe(15) // 5+5+5+ })++ it('excludes swaps older than 24h from the volume window', () => {+ const indexer = seededIndexer()+ const db = indexer.database+ db.prepare('INSERT INTO blocks (number, ts) VALUES (?, ?)').run(1, 0)+ db.prepare('INSERT INTO blocks (number, ts) VALUES (?, ?)').run(2, 90_000) // >24h after block 1+ db.prepare(+ 'INSERT INTO swaps (pool, block, log_index, token_price, token_volume, buys_token, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)',+ ).run(POOL, 1, 0, 10, 100, 1, '0xa')+ db.prepare(+ 'INSERT INTO swaps (pool, block, log_index, token_price, token_volume, buys_token, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)',+ ).run(POOL, 2, 0, 10, 7, 1, '0xb')++ // "now" = block 2's timestamp; block 1 (t=0) is 90_000s ago, outside 24h (86_400s).+ expect(indexer.volume24h(TOKEN as `0x${string}`, 90_000)).toBe(7)+ })++ it('primaryPool picks the pool with the most indexed swaps', () => {+ const indexer = seededIndexer()+ const pool2 = '0x4444444444444444444444444444444444444444'+ indexer.database+ .prepare('INSERT INTO pools (pool, token, quote, token_is_0, fee, decimals0, decimals1) VALUES (?, ?, ?, 1, 3000, 18, 18)')+ .run(pool2, TOKEN, QUOTE)+ seedSwapsAndBlocks(indexer) // 3 swaps on POOL, 0 on pool2+ expect(indexer.primaryPool(TOKEN as `0x${string}`)?.toLowerCase()).toBe(POOL)+ })+})++describe('Indexer.stats', () => {+ it('reports row counts across all tables', () => {+ const indexer = seededIndexer()+ const db = indexer.database+ db.prepare('INSERT INTO transfers (token, block, log_index, from_addr, to_addr, value, tx_hash) VALUES (?, ?, ?, ?, ?, ?, ?)').run(+ TOKEN, 1, 0, ZERO, ALICE, '1', '0xa',+ )+ const stats = indexer.stats()+ expect(stats.transfers).toBe(1)+ expect(stats.pools).toBe(1)+ expect(stats.swaps).toBe(0)+ expect(stats.blocks).toBe(0)+ })+})diff --git a/robinhood/hoodkit/tests/unit/strategy.test.ts b/robinhood/hoodkit/tests/unit/strategy.test.tsindex da630342d..35da63e4c 100644--- a/robinhood/hoodkit/tests/unit/strategy.test.ts+++ b/robinhood/hoodkit/tests/unit/strategy.test.ts@@ -100,15 +100,22 @@ describe('createTwapExecutor', () => {const tokenIn = '0x1111111111111111111111111111111111111111' as `0x${string}`const tokenOut = '0x2222222222222222222222222222222222222222' as `0x${string}`+ // Drives the REAL quoteSwap/buildSwapTx code paths (no module mocking) by+ // stubbing only the two viem client methods they call: `simulateContract`+ // (the QuoterV2 probe) and `call` (the dry-run eth_call). Every probed route+ // "succeeds" at 2x amountIn so route selection is deterministic.function fakeReadOnlyClient(): HoodClient {+ const simulateContract = vi.fn(async ({ functionName, args }: { functionName: string; args: readonly unknown[] }) => {+ const amountIn = functionName === 'quoteExactInputSingle' ? (args[0] as { amountIn: bigint }).amountIn : (args[1] as bigint)+ return { result: [amountIn * 2n, 0n, 0n, 100_000n] }+ })+ const call = vi.fn(async () => ({ data: '0x' as const }))return {network: 'testnet',wallet: null,- account: null,+ account: { address: '0x9999999999999999999999999999999999999999' },chain: { id: 46630 },- public: {- call: vi.fn(async () => ({ data: '0x' })),- },+ public: { simulateContract, call },} as unknown as HoodClient}@@ -122,34 +129,12 @@ describe('createTwapExecutor', () => {})it('defaults to dry-run (simulated, never sent) when the client has no wallet', async () => {- vi.doMock('hoodchain', async () => {- const actual = await vi.importActual<typeof import('hoodchain')>('hoodchain')- return {- ...actual,- quoteSwap: vi.fn(async (_client: unknown, args: { amountIn: bigint }) => ({- route: { fees: [500], path: [tokenIn, tokenOut], encodedPath: '0x' },- amountIn: args.amountIn,- amountOut: args.amountIn * 2n,- gasEstimate: 100_000n,- })),- buildSwapTx: vi.fn(() => ({- to: tokenOut,- data: '0xdead',- value: 0n,- quote: {},- amountOutMinimum: 1n,- deadline: 0n,- })),- }- })- const { createTwapExecutor: freshTwap } = await import('../../src/strategy/index.js')const client = fakeReadOnlyClient()- const twap = freshTwap(client, { tokenIn, tokenOut, totalAmountIn: 400n, slices: 2, intervalMs: 0 })+ const twap = createTwapExecutor(client, { tokenIn, tokenOut, totalAmountIn: 400n, slices: 2, intervalMs: 0 })const results = await twap.run()expect(results).toHaveLength(2)for (const r of results) expect(r.status).toBe('simulated')- expect((client.public.call as ReturnType<typeof vi.fn>)).toHaveBeenCalled()- vi.doUnmock('hoodchain')+ expect(client.public.call).toHaveBeenCalled()})it('skips a slice when onBeforeSlice returns false', async () => {diff --git a/robinhood/learn-robinhood-chain/content/08-sell-your-api-for-usdg.md b/robinhood/learn-robinhood-chain/content/08-sell-your-api-for-usdg.mdindex 894185acd..e73a49915 100644--- a/robinhood/learn-robinhood-chain/content/08-sell-your-api-for-usdg.md+++ b/robinhood/learn-robinhood-chain/content/08-sell-your-api-for-usdg.md@@ -21,7 +21,8 @@ So this tutorial teaches the pattern that *does* work today: **a hand-rolled 402```tsimport express from 'express'-import { createHoodClient, getUsdgBalance, formatUsdg, parseUsdg, MAINNET_ADDRESSES } from 'hoodchain'+import { parseEventLogs } from 'viem'+import { createHoodClient, erc20Abi, parseUsdg, MAINNET_ADDRESSES } from 'hoodchain'const app = express()const hood = createHoodClient()@@ -60,11 +61,18 @@ app.get('/api/quote/:symbol', async (req, res) => {return res.status(402).json({ error: 'payment not found or not confirmed yet' })}- // verify it's a real USDG Transfer to PAY_TO of at least PRICE_USDG- const transferLog = receipt.logs.find(- (l) => l.address.toLowerCase() === MAINNET_ADDRESSES.usdg.toLowerCase(),+ // Decode every Transfer log on the USDG contract and require ONE that pays+ // PAY_TO at least PRICE_USDG. Checking only "a log exists on the USDG+ // contract" is not enough — see the callout below for why.+ const transfers = parseEventLogs({+ abi: erc20Abi,+ eventName: 'Transfer',+ logs: receipt.logs.filter((l) => l.address.toLowerCase() === MAINNET_ADDRESSES.usdg.toLowerCase()),+ })+ const paid = transfers.some(+ (t) => t.args.to.toLowerCase() === PAY_TO.toLowerCase() && t.args.value >= PRICE_USDG,)- if (!transferLog) return res.status(402).json({ error: 'not a USDG transfer' })+ if (!paid) return res.status(402).json({ error: 'no sufficient USDG transfer to payTo in this transaction' })seenTxHashes.add(txHash)@@ -108,7 +116,15 @@ console.log(data) // { symbol: 'AAPL', priceUsd: 315.5, updatedAt: ... }## What was verified, and what's a documented gap-The server and client code above were exercised locally end-to-end against a running Express server on this machine: an unauthenticated request correctly returned `402` with the challenge body, and a request carrying a *fabricated* `X-PAYMENT` header (a made-up transaction hash) correctly fell through to `getTransactionReceipt` returning `null` and was rejected with `402` again — proving the verification path actually checks the chain rather than trusting the header blindly. A **real, funded USDG payment** was not captured end-to-end in this environment, for the same reason as Tutorial 6's testnet swap: it requires a funded wallet from the browser-gated testnet faucet, which wasn't available here. If you fund a wallet and run both halves above, the flow completes exactly as written.+The server code above — this exact route, verification logic included — was run locally against live mainnet reads, and three cases were checked by hand with `curl`:++1. **No `X-PAYMENT` header** → real `402` with the challenge body. ✅+2. **A fabricated `X-PAYMENT`** (a made-up transaction hash) → `getTransactionReceipt` correctly returned `null`, rejected with `402`. ✅+3. **A real, successfully-mined mainnet transaction hash — but one that never paid `PAY_TO` anything** → **this was wrongly accepted (`200 OK`) by an earlier version of this route.**++That third case is not a hypothetical: it's what happened when this tutorial's code only checked "a `Transfer` log exists on the USDG contract address" instead of decoding *who* it paid and *how much*. Any already-mined USDG transfer by any party — unrelated to this API entirely — satisfied that check. The code above (with `parseEventLogs` and the explicit `to`/`value` comparison) is the fix, re-verified against the same three cases with the correct outcome in all three. **This is why the tutorial ships the fixed version, not the first one written** — treat it as a demonstration of exactly the kind of bug a "just check a log exists" shortcut produces, and why decoding the actual event arguments is not optional.++A **real, funded USDG payment that this route accepts end-to-end** was not captured in this environment, for the same reason as Tutorial 6's testnet swap: it requires a funded wallet from the browser-gated testnet faucet, which wasn't available here. If you fund a wallet and run both halves above, the flow completes exactly as written — and, per the fix above, will correctly *reject* any transaction that isn't a real payment to your `PAY_TO` address.:::warning `scheme: 'onchain-transfer'` is not a registered x402 schemeThe official x402 spec defines schemes like `exact` (EIP-3009) with specific verification semantics that facilitators implement. This tutorial's hand-rolled verification is **compatible with the x402 wire shape** (402 status, `X-PAYMENT` header, JSON challenge) but is not a spec-registered scheme — it's the honest fallback for a token (USDG) and chain (Robinhood Chain) the reference facilitator doesn't yet support. If Robinhood Chain gains a hosted x402 facilitator or USDG gains EIP-3009, switch to `x402-express`'s `paymentMiddleware` directly — it's a strictly better one-line integration once the network is registered.@@ -119,7 +135,6 @@ The official x402 spec defines schemes like `exact` (EIP-3009) with specific verThe example above is deliberately minimal to show the mechanics. Before charging real money:- **Replace the in-memory `Set` with persistent storage.** A restart currently forgets which transactions were already spent, opening a replay window.-- **Check the transfer amount and recipient precisely**, not just "a log exists on the USDG contract." Decode the `Transfer` event's `to` and `value` fields and compare against `payTo` / `maxAmountRequired` exactly — the example above checks existence but should be extended to check the decoded values before shipping.- **Add a payment timeout.** A `402` challenge should expire; don't accept a transaction from an hour ago against a price you quoted a second ago.- **Rate-limit the unauthenticated path.** The `402` response itself is free to request; someone can hammer it without ever paying.diff --git a/robinhood/learn-robinhood-chain/content/09-ai-agent-chain-access.md b/robinhood/learn-robinhood-chain/content/09-ai-agent-chain-access.mdnew file mode 100644index 000000000..c396be760--- /dev/null+++ b/robinhood/learn-robinhood-chain/content/09-ai-agent-chain-access.md@@ -0,0 +1,169 @@+An AI coding assistant is only as useful as the tools it can call. This tutorial builds a **Model Context Protocol (MCP)** server that exposes Robinhood Chain reads — quotes, portfolios, the registry — as tools any MCP-compatible assistant can invoke, then wires it into Claude Code, Claude Desktop, and Cursor. Everything below was run against a real MCP client, not described secondhand.++## What MCP actually is++[MCP](https://modelcontextprotocol.io) is a JSON-RPC-based protocol that lets an AI assistant discover and call *tools* exposed by a separate process — your server. The assistant doesn't need special Robinhood Chain knowledge baked in; it needs your server to expose well-described tools, and it reasons about when to call them. This is the same shape as the paid MCP tools you may have already used from three.ws (`forge_free`, `crypto_news`, and friends) — except here, you're the one writing the server.++## The server++Three tools: a live quote, a portfolio valuation, and a registry listing — the exact operations from Tutorials 4 and 5, now callable by an LLM instead of a terminal script.++```bash+npm install @modelcontextprotocol/sdk zod hoodchain viem+```++```ts+// server.mjs+import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'+import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'+import { z } from 'zod'+import { createHoodClient, getQuote, getPortfolio, listPricedStockTokens } from 'hoodchain'++const hood = createHoodClient()+const server = new McpServer({ name: 'robinhood-chain-mcp', version: '0.1.0' })++server.registerTool(+ 'get_stock_quote',+ {+ title: 'Get Stock Token quote',+ description: 'Live, multiplier-adjusted Chainlink price for a Robinhood Chain Stock Token, by ticker (e.g. AAPL, TSLA).',+ inputSchema: { symbol: z.string().describe('Ticker symbol, case-insensitive') },+ },+ async ({ symbol }) => {+ const q = await getQuote(hood, symbol, { maxAgeSeconds: 7 * 24 * 60 * 60 })+ return {+ content: [{ type: 'text', text: JSON.stringify({+ symbol: q.symbol, priceUsd: q.priceUsd, updatedAt: new Date(q.updatedAt * 1000).toISOString(),+ }) }],+ }+ },+)++server.registerTool(+ 'get_portfolio',+ {+ title: 'Get Stock Token portfolio',+ description: 'Multiplier-correct Stock Token holdings and USD valuation for any address on Robinhood Chain.',+ inputSchema: { address: z.string().describe('0x-prefixed wallet address') },+ },+ async ({ address }) => {+ const p = await getPortfolio(hood, address, { maxAgeSeconds: 7 * 24 * 60 * 60 })+ return { content: [{ type: 'text', text: JSON.stringify({ totalUsd: p.totalUsd, positions: p.positions.length }) }] }+ },+)++server.registerTool(+ 'list_priced_stock_tokens',+ { title: 'List priced Stock Tokens', description: 'All Robinhood Chain Stock Tokens with a live Chainlink feed.', inputSchema: {} },+ async () => ({ content: [{ type: 'text', text: JSON.stringify(listPricedStockTokens().map((t) => t.symbol)) }] }),+)++const transport = new StdioServerTransport()+await server.connect(transport)+```++Notice what this server does *not* do: no wallet, no write tools, no private key. Read-only MCP tools need none of that — exactly the same "reads are free and keyless" property from Tutorial 2. A write-capable version (place a swap, transfer USDG) is a natural extension, but it should prompt for confirmation before every transaction — treat an LLM's tool call exactly like a user action, not an autonomous decision, for anything that spends.++## A real transcript++Rather than describe what connecting an assistant *would* show, here's an actual MCP client — built with the same `@modelcontextprotocol/sdk` package — connecting over stdio, listing the server's tools, and calling two of them against live mainnet:++```ts+// client-test.mjs+import { Client } from '@modelcontextprotocol/sdk/client/index.js'+import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'++const transport = new StdioClientTransport({ command: 'node', args: ['server.mjs'] })+const client = new Client({ name: 'test-client', version: '0.1.0' })+await client.connect(transport)++const tools = await client.listTools()+console.log('TOOLS:', tools.tools.map((t) => t.name).join(', '))++const quote = await client.callTool({ name: 'get_stock_quote', arguments: { symbol: 'TSLA' } })+console.log('get_stock_quote(TSLA) ->', quote.content[0].text)++const list = await client.callTool({ name: 'list_priced_stock_tokens', arguments: {} })+console.log('list_priced_stock_tokens() -> count', JSON.parse(list.content[0].text).length)+```++```bash+$ node client-test.mjs+```++```text+TOOLS: get_stock_quote, get_portfolio, list_priced_stock_tokens+get_stock_quote(TSLA) -> {"symbol":"TSLA","priceUsd":407.825,"updatedAt":"2026-07-10T19:53:35.000Z"}+list_priced_stock_tokens() -> count 34+```++This is the exact protocol exchange an assistant like Claude performs when it decides to call `get_stock_quote` — a real handshake, a real tool list, a real live price. The `34` matches the priced-token count from Tutorial 3; if that number drifts as Chainlink adds feeds, your server will report it correctly without any code change, because it reads the SDK's registry live rather than hardcoding a count.++## Connecting to Claude Code++Claude Code discovers MCP servers from a project or user config. Add this server with the CLI:++```bash+claude mcp add robinhood-chain -- node /absolute/path/to/server.mjs+```++Or add it directly to `.mcp.json` in your project root:++```json+{+ "mcpServers": {+ "robinhood-chain": {+ "command": "node",+ "args": ["/absolute/path/to/server.mjs"]+ }+ }+}+```++Restart Claude Code (or run `/mcp` to reconnect) and ask something like *"What's the live price of TSLA on Robinhood Chain?"* — Claude will call `get_stock_quote` and answer from the real response, not from training data (which has no idea Robinhood Chain exists, or that it launched in July 2026).++## Connecting to Claude Desktop++Claude Desktop reads its MCP config from `claude_desktop_config.json` (**Settings → Developer → Edit Config** opens the file directly):++```json+{+ "mcpServers": {+ "robinhood-chain": {+ "command": "node",+ "args": ["/absolute/path/to/server.mjs"]+ }+ }+}+```++Fully restart the app after editing (not just close the window) for the new server to be picked up.++## Connecting to Cursor++Cursor uses the same MCP config shape, in `.cursor/mcp.json` at your project root or `~/.cursor/mcp.json` globally:++```json+{+ "mcpServers": {+ "robinhood-chain": {+ "command": "node",+ "args": ["/absolute/path/to/server.mjs"]+ }+ }+}+```++Open **Cursor Settings → MCP** to confirm the server shows as connected with its three tools listed.++## Troubleshooting++**Server doesn't show up / "0 tools"** — double-check the `args` path is absolute, not relative; MCP host apps don't inherit your shell's working directory. Run `node /absolute/path/to/server.mjs` by hand first — if it hangs waiting on stdin with no error, that's actually correct (stdio transport blocks reading for the next message); Ctrl-C to confirm it started without throwing.++**Tool call errors with `UnknownSymbolError` surfaced as a generic failure** — MCP wraps thrown errors into an error-content response by default; add a `try/catch` per tool if you want to return a structured, LLM-readable error message instead of a stack trace.++**Assistant answers from stale training knowledge instead of calling the tool** — make your tool `description` field more specific about *when* to use it ("always use this for current Robinhood Chain prices — do not answer from memory, this chain launched after most training cutoffs"). Description quality is the entire interface between your server and the model's judgment.++## What you built++A real MCP server, verified against a real MCP client with a live mainnet call captured in this page, plus the exact configuration to wire it into the three major MCP-compatible coding assistants. Next: turning read access into an agent that actually acts — an autonomous trader.diff --git a/vite.config.js b/vite.config.jsindex 4d3d64114..f744efa73 100644--- a/vite.config.js+++ b/vite.config.js@@ -492,6 +492,9 @@ const appConfig = {chain: resolve(__dirname, 'pages/chain.html'),stablecoin: resolve(__dirname, 'pages/stablecoin.html'),'markets-trending': resolve(__dirname, 'pages/markets-trending.html'),+ 'markets-robinhood': resolve(__dirname, 'pages/markets-robinhood.html'),+ 'robinhood-stock': resolve(__dirname, 'pages/robinhood-stock.html'),+ 'robinhood-coin': resolve(__dirname, 'pages/robinhood-coin.html'),fees: resolve(__dirname, 'pages/fees.html'),'dex-volumes': resolve(__dirname, 'pages/dex-volumes.html'),hacks: resolve(__dirname, 'pages/hacks.html'),