2:I[91610,["87","static/chunks/app/docs/liquidity/page-71e8aa5905179886.js"],"CodeBlock"] 4:I[75001,[],""] 5:I[9596,[],""] 6:I[83453,["575","static/chunks/575-5a246ccadcf411fa.js","418","static/chunks/418-f3b6d2f154485d8f.js","998","static/chunks/app/docs/layout-c4230139aed5d08b.js"],"default",1] 7:I[5520,["575","static/chunks/575-5a246ccadcf411fa.js","913","static/chunks/913-95a4bf8751887fd7.js","319","static/chunks/319-a605e396582267ab.js","114","static/chunks/114-54f34015d309a9f8.js","654","static/chunks/654-8e46d05deaba89c2.js","395","static/chunks/395-2e55d845c3f0b2f3.js","185","static/chunks/app/layout-0fe9fc7be6bfdac9.js"],"Providers"] 3:T435,import { parseAbi } from "viem"; const pairAbi = parseAbi([ "function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)", "function token0() view returns (address)", ]); const factoryAbi = parseAbi([ "function getPair(address tokenA, address tokenB) view returns (address pair)", ]); // 1 — Resolve the pool pair address const pairAddress = await publicClient.readContract({ address: UNISWAP_V2_FACTORY, abi: factoryAbi, functionName: "getPair", args: [TSLA, USDG], }); // 2 — Query pair reserves const [res0, res1] = await publicClient.readContract({ address: pairAddress, abi: pairAbi, functionName: "getReserves", }); const token0Address = await publicClient.readContract({ address: pairAddress, abi: pairAbi, functionName: "token0", }); // 3 — Match reserves to tokens const [reserveTsla, reserveUsdg] = token0Address.toLowerCase() === TSLA.toLowerCase() ? [res0, res1] : [res1, res0]; console.log(`Pool Reserves: ${Number(reserveTsla) / 1e18} TSLA | ${Number(reserveUsdg) / 1e6} USDG`);0:["oSNFCr-VaZMgs1L9AoMiI",[[["",{"children":["docs",{"children":["liquidity",{"children":["__PAGE__",{}]}]}]},"$undefined","$undefined",true],["",{"children":["docs",{"children":["liquidity",{"children":["__PAGE__",{},[["$L1",[["$","h1",null,{"className":"mb-3 font-display text-3xl font-bold tracking-tight text-cream","children":"Liquidity & Reserves"}],["$","p",null,{"className":"mb-8 text-base leading-relaxed text-muted","children":"Understanding how Uniswap V2 pairs calculate trading prices on-chain, how price impact/slippage operates under the Constant Product formula, and how market forces drive oracle-pair convergence."}],["$","h2",null,{"className":"mb-3 mt-10 font-display text-xl font-semibold text-cream","children":"Uniswap V2 Pair Reserves"}],["$","p",null,{"className":"mb-4 text-sm leading-relaxed text-muted","children":["Unlike mainnet stock trading which flows through complex off-chain RFQ (Request-for-Quote) or Uniswap V3 Concentrated Liquidity, stock tokens on Robinhood Chain testnet and early L2 mainnet settle inside standard Uniswap V2 Constant Product pools (",["$","code",null,{"className":"rounded bg-white/10 px-1.5 py-0.5 text-[13px] text-cream","children":"x × y = k"}],")."]}],["$","p",null,{"className":"mb-4 text-sm leading-relaxed text-muted","children":"Each pool pairs a stock token (e.g. TSLA, decimals 18) against the default gas-pegged stablecoin (USDG, decimals 6). You can query the reserves directly:"}],["$","$L2",null,{"code":"$3","language":"javascript","title":"fetch-reserves.ts"}],["$","h2",null,{"className":"mb-3 mt-10 font-display text-xl font-semibold text-cream","children":"Constant Product Pricing Formula"}],["$","p",null,{"className":"mb-4 text-sm leading-relaxed text-muted","children":["Uniswap V2 calculates output tokens using the constant product swap equation with a flat 0.3% pool fee. To calculate the exact output amount ",["$","code",null,{"className":"rounded bg-white/10 px-1.5 py-0.5 text-[13px] text-cream","children":"dy"}]," for a given input ",["$","code",null,{"className":"rounded bg-white/10 px-1.5 py-0.5 text-[13px] text-cream","children":"dx"}],", use this math:"]}],["$","$L2",null,{"code":"// dx = amount of TSLA to sell (1.0 * 1e18)\n// x = reserveTsla, y = reserveUsdg\n// 0.3% fee: dxWithFee = dx * 997\n\nconst dx = 1_000000000000000000n; // 1 TSLA\nconst dxWithFee = dx * 997n;\nconst numerator = dxWithFee * reserveUsdg;\nconst denominator = (reserveTsla * 1000n) + dxWithFee;\n\nconst dyAmountOut = numerator / denominator; // Output in USDG (6 decimals)\nconst executionPrice = Number(dyAmountOut) / 1e6; // Price received per TSLA","language":"javascript","title":"swap-pricing.ts"}],["$","h2",null,{"className":"mb-3 mt-10 font-display text-xl font-semibold text-cream","children":"Price Impact vs. Oracle Prices"}],["$","div",null,{"className":"mb-5 rounded-xl border p-4 text-sm leading-relaxed border-gold/40 bg-gold/10 text-gold","children":[["$","strong",null,{"children":"Price impact is size-dependent, not oracle-dependent."}],"The Chainlink price feed acts solely as the *trigger threshold* for limit orders. The actual execution swap price is determined entirely by the Uniswap V2 pool reserves at the block of execution. If a user places an order of $10,000 in a shallow pool with only $20,000 of reserves, the swap will experience significant slippage (nearly 33% price impact) regardless of what NASDAQ quotes!"]}],["$","h2",null,{"className":"mb-3 mt-10 font-display text-xl font-semibold text-cream","children":"Arbitrage Mechanics"}],["$","p",null,{"className":"mb-4 text-sm leading-relaxed text-muted","children":"Because trading pools are on-chain 24/7 while traditional markets close, pool prices can drift. Arbitrageurs keep the on-chain pool prices aligned with Chainlink/NASDAQ stock quotes:"}],["$","ul",null,{"className":"mb-4 list-disc space-y-1.5 pl-5 text-sm leading-relaxed text-muted marker:text-neon","children":[["$","li",null,{"children":[["$","strong",null,{"className":"text-cream","children":"Pool Discount"}]," — If the pool price of TSLA falls below the Chainlink trigger price, arbitrageurs buy TSLA on-chain and hold it, pushing the pool price back up."]}],["$","li",null,{"children":[["$","strong",null,{"className":"text-cream","children":"Pool Premium"}]," — If the pool price climbs above NASDAQ quotes, traders sell stock tokens into the pool to take a USDG profit, depressing the pool price back to equilibrium."]}]]}]],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","docs","children","liquidity","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[null,["$","$L6",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","docs","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}],"params":{}}]],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/f55723d0ee21179d.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"en","className":"__variable_f367f3 __variable_dd5b2f","children":["$","body",null,{"className":"font-sans","children":["$","$L7",null,{"children":["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]}]}]}]],null],null],["$L8",null]]]] 8:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"Longbow Docs — Liquidity & Reserves"}],["$","meta","3",{"name":"description","content":"Wall Street closes, the chain doesn't. Longbow tracks the gap between on-chain stock prices and real quotes on Robinhood Chain — non-custodial limit orders & DCA, keeper-executed through Uniswap V2. Nock. Draw. Loose."}],["$","meta","4",{"property":"og:title","content":"Longbow — Wall Street closes. The chain doesn't."}],["$","meta","5",{"property":"og:description","content":"The gap terminal for tokenized stocks: on-chain price vs real quote, live — with non-custodial limit & DCA orders keepers execute through Uniswap V2."}],["$","meta","6",{"property":"og:image","content":"https://longbowtrade.xyz/brand/og.png"}],["$","meta","7",{"property":"og:image:width","content":"1200"}],["$","meta","8",{"property":"og:image:height","content":"630"}],["$","meta","9",{"property":"og:image:alt","content":"Longbow"}],["$","meta","10",{"name":"twitter:card","content":"summary_large_image"}],["$","meta","11",{"name":"twitter:site","content":"@longbowtrade"}],["$","meta","12",{"name":"twitter:title","content":"Longbow — Wall Street closes. The chain doesn't."}],["$","meta","13",{"name":"twitter:description","content":"The gap terminal for tokenized stocks: on-chain price vs real quote, live — with non-custodial limit & DCA orders keepers execute through Uniswap V2."}],["$","meta","14",{"name":"twitter:image","content":"https://longbowtrade.xyz/brand/og.png"}],["$","link","15",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"48x48"}],["$","link","16",{"rel":"icon","href":"/brand/favicon.svg","type":"image/svg+xml"}],["$","link","17",{"rel":"icon","href":"/brand/favicon-32.png","sizes":"32x32","type":"image/png"}],["$","link","18",{"rel":"icon","href":"/brand/icon-192.png","sizes":"192x192","type":"image/png"}],["$","link","19",{"rel":"apple-touch-icon","href":"/brand/apple-touch-icon.png"}]] 1:null