@anywalletkit/protocol-swap2-curve 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/provider.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  curveProvider
3
- } from "./chunk-IFREGXMV.js";
3
+ } from "./chunk-NW2OLRIK.js";
4
4
  import "./chunk-RVBZFCRR.js";
5
5
  export {
6
6
  curveProvider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anywalletkit/protocol-swap2-curve",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Curve same-chain swaps straight from the contracts: Router NG get_dy quotes and exchange execution over a curated, pinned pool allowlist — no API, no frontend, no fee.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.anywallet.tech",
@@ -46,17 +46,17 @@
46
46
  ],
47
47
  "dependencies": {
48
48
  "viem": "^2.57.2",
49
- "@anywalletkit/swap2-assets": "0.3.0",
50
- "@anywalletkit/protocol-swap2-core": "0.10.3"
49
+ "@anywalletkit/protocol-swap2-core": "0.12.0",
50
+ "@anywalletkit/swap2-assets": "0.3.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@anywalletkit/core": "0.8.0"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/node": "^22",
57
- "vitest": "^5.0.3",
58
- "@anywalletkit/core": "0.8.0",
57
+ "vitest": "^5.1.0",
59
58
  "@anywalletkit/conformance": "0.5.1",
59
+ "@anywalletkit/core": "0.8.0",
60
60
  "@anywalletkit/history-evm": "0.2.0"
61
61
  },
62
62
  "keywords": [
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/provider.ts","../src/pools/1.ts","../src/pools/10.ts","../src/pools/100.ts","../src/pools/143.ts","../src/pools/196.ts","../src/pools/8453.ts","../src/pools/9745.ts","../src/pools/42161.ts","../src/pools/index.ts","../src/routes.ts","../src/rpc.ts","../src/slippage.ts","../src/intent.ts","../src/verify.ts"],"sourcesContent":["import {getAddress} from \"viem\";\nimport {evmRef, isEvm, sourceAssetOf} from \"@anywalletkit/protocol-swap2-core/util\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {encodeExchange, encodeGetDy} from \"./abi.js\";\nimport {describeCurveActivity} from \"./activity.js\";\nimport {CURVE_DEPLOYMENTS, deploymentOf, type CurveDeployment} from \"./deployments.js\";\nimport {CURVE_POOLS} from \"./pools/index.js\";\nimport type {CurveChainPools} from \"./pools/types.js\";\nimport {findRoutes, routeArgs, routePools, type CurveRoute} from \"./routes.js\";\nimport {ethCall, wordUint} from \"./rpc.js\";\nimport {curveAutoSlippageBps, curveImpactBps} from \"./slippage.js\";\nimport {curveIntentChain, mintCurveIntentId} from \"./intent.js\";\nimport {curveOnChain, curveQuoteCheck} from \"./verify.js\";\n\n/**\n * Curve, straight from the contracts — Router NG on every chain in `CURVE_DEPLOYMENTS`.\n *\n * Quote: candidate routes of one or two pools from the curated allowlist the package pins (plus the router's\n * wrap hop through the pinned wrapped native, and on Ethereum's v1.2 router the crvUSD ↔ scrvUSD ERC-4626 hop),\n * each priced with the router's own `get_dy` in JSON-RPC batches; the best output wins. Execution: the\n * explicit-receiver `exchange(route, params, amount, min_dy, [pools,] receiver)` — the router pays only the\n * recipient and reverts under `min_dy`, which is never 0. No API, no key, no fee.\n *\n * Router NG has no deadline: the quote's lifetime (`quoteTtlMs`) is enforced by the engine, and right before\n * broadcast `preflightDeposit` re-checks the sealed call byte for byte, each hop pool's code and coins and a fresh\n * `get_dy` of the exact route against the minimum (the router's code hash and version are checked once per chain per\n * process: the router is immutable). ERC-20 sources approve exactly the input to the\n * pinned router (`approvalAddress`); the engine handles that leg (and a USDT-style reset to 0 first).\n */\n\n/** Long enough for an approval to be mined on Ethereum; the router has no deadline of its own. */\nconst DEFAULT_TTL_MS = 180_000;\n\nexport interface CurveProviderConfig {\n enabled?: boolean;\n /** JSON-RPC endpoints per EVM chain id, tried in order. A chain without one is not offered. */\n rpcUrls: Readonly<Record<number, readonly string[]>>;\n /**\n * Slippage when the caller names none (bps). Default: `suggestSlippage` from swap2-core for the pair and the\n * route's price impact (stable ↔ stable 10 bps, majors 50, others 100, plus half the impact).\n */\n defaultSlippageBps?: number;\n /** Local quote lifetime. Router NG has no deadline, so this is the only expiry. Default 3 min. */\n quoteTtlMs?: number;\n /** Override the deployments (tests, new chains). Still verified on-chain before use. */\n deployments?: Readonly<Record<number, CurveDeployment>>;\n /** Override the pool allowlist (tests). */\n pools?: Readonly<Record<number, CurveChainPools>>;\n /** Told when a chain's AddressProvider lists another router than the pinned one (never acted on). Default console.warn. */\n onWarning?: (message: string) => void;\n}\n\nexport function curveProvider(config: CurveProviderConfig): CrossChainProvider {\n const deployments = config.deployments ?? CURVE_DEPLOYMENTS;\n const pools = config.pools ?? CURVE_POOLS;\n const ttl = config.quoteTtlMs ?? DEFAULT_TTL_MS;\n const fixedSlippage = config.defaultSlippageBps;\n if (fixedSlippage !== undefined && (!Number.isInteger(fixedSlippage) || fixedSlippage <= 0 || fixedSlippage >= 5_000)) throw new Error(\"curve: defaultSlippageBps must be 1..4999\");\n const chain = curveOnChain({rpcUrls: config.rpcUrls, deployments, pools, ...(config.onWarning ? {onWarning: config.onWarning} : {})});\n const rpc = chain.rpc;\n const selfCheck = curveQuoteCheck({deployments, pools});\n const tableOf = (chainId: number) => (Object.prototype.hasOwnProperty.call(pools, chainId) ? pools[chainId] : undefined);\n\n const chainIdOf = (caip2: string): number | null => {\n if (!isEvm(caip2)) return null;\n const id = evmRef(caip2);\n return deploymentOf(deployments, id) && config.rpcUrls[id]?.length && tableOf(id)?.pools.length ? id : null;\n };\n\n /** get_dy of each route at `amount` (null where the router reverts). */\n async function price(chainId: number, d: CurveDeployment, routes: readonly CurveRoute[], amount: bigint, signal?: AbortSignal): Promise<(bigint | null)[]> {\n const raw = await rpc(chainId, routes.map((r) => ethCall(d.router, encodeGetDy(d.family, routeArgs(d.family, r), amount))), signal);\n return raw.map(wordUint);\n }\n\n return {\n name: \"curve\",\n describeActivity: (tx, ctx) => describeCurveActivity(tx, ctx, deployments),\n supportsSameChain: true,\n enabled: () => config.enabled ?? true,\n supportsChain: (caip2: string) => chainIdOf(caip2) !== null,\n supportsChainPair: (from: string, to: string) => from === to && chainIdOf(from) !== null,\n supportsRoute(from: Asset, to: Asset): boolean {\n return from.chain === to.chain && chainIdOf(from.chain) !== null;\n },\n\n async getQuote(params: QuoteParams, signal?: AbortSignal): Promise<Quote | null> {\n const refuse = (why: string): null => {\n params.onRefusal?.(`curve: ${why}`);\n return null;\n };\n if (params.flex) return refuse(\"amount-flexible deposits are not supported\");\n if (params.sourceChain !== params.destChain) return refuse(\"same-chain swaps only\");\n const chainId = chainIdOf(params.sourceChain);\n if (chainId === null) return refuse(`no Curve router, pool allowlist or RPC for ${params.sourceChain}`);\n const d = deploymentOf(deployments, chainId)!;\n const src = sourceAssetOf(params);\n if (!src) return refuse(`unknown source token ${params.sourceToken}`);\n const nativeIn = !src.contract;\n const nativeOut = /^0x0+$/.test(params.destToken);\n if (!nativeOut && !/^0x[0-9a-fA-F]{40}$/.test(params.destToken)) return refuse(\"destination token must be an EVM address\");\n if (!/^0x[0-9a-fA-F]{40}$/.test(params.destAddress)) return refuse(\"recipient must be an EVM address\");\n let amountIn: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n } catch {\n return refuse(\"amount is not an integer\");\n }\n if (amountIn <= 0n) return refuse(\"amount must be positive\");\n if (params.slippageBps !== undefined && (!Number.isInteger(params.slippageBps) || params.slippageBps < 0 || params.slippageBps >= 10_000)) return refuse(\"slippage must be 0..9999 bps\");\n if (!nativeIn && src.contract!.toLowerCase() === d.eth.toLowerCase()) return refuse(\"the native coin is named by the catalog, not by the router's 0xEeee sentinel\");\n if (!nativeOut && params.destToken.toLowerCase() === d.eth.toLowerCase()) return refuse(\"name a native output with the zero address, not the router's 0xEeee sentinel\");\n const tokenIn = getAddress(nativeIn ? d.eth : src.contract!);\n const tokenOut = getAddress(nativeOut ? d.eth : params.destToken);\n if (tokenIn === tokenOut) return refuse(\"same token in and out\");\n const wrapPair = [getAddress(d.eth), getAddress(d.weth)];\n if (wrapPair.includes(tokenIn) && wrapPair.includes(tokenOut)) return refuse(\"that is a wrap/unwrap, not a swap\");\n\n try {\n await chain.verifyDeployment(chainId);\n const {routes, truncated} = findRoutes(chainId, d, tableOf(chainId), tokenIn, tokenOut);\n if (!routes.length) return refuse(\"no allowlisted Curve pool route for this pair\");\n const outs = await price(chainId, d, routes, amountIn, signal);\n let best: {route: CurveRoute; out: bigint} | null = null;\n outs.forEach((out, i) => {\n if (out !== null && out > 0n && (!best || out > best.out)) best = {route: routes[i]!, out};\n });\n if (!best) return refuse(\"no allowlisted Curve pool quotes this pair and amount\");\n const {route, out} = best as {route: CurveRoute; out: bigint};\n\n // Price impact: a probe 1/1000 the size on the same route gives the marginal rate; the full-size rate's\n // shortfall against it is the impact (pool fees are paid on both sides and cancel). Informational.\n let priceImpactBps: number | undefined;\n const probeIn = amountIn / 1000n;\n if (probeIn > 0n) {\n try {\n const [probeOut] = await price(chainId, d, [route], probeIn, signal);\n priceImpactBps = curveImpactBps(amountIn, out, probeOut);\n } catch {\n /* the quote stands; impact is information, not a gate */\n }\n }\n\n const bps = params.slippageBps ?? fixedSlippage ?? curveAutoSlippageBps(params, priceImpactBps);\n const minOut = (out * BigInt(10_000 - bps)) / 10_000n;\n if (minOut <= 0n) return refuse(\"the minimum rounds to zero for this amount\");\n if (params.minAmountOut !== undefined && minOut < BigInt(params.minAmountOut)) {\n return refuse(`floor breach (min=${minOut} < floor=${params.minAmountOut})`);\n }\n const args = routeArgs(d.family, route);\n const recipient = getAddress(params.destAddress);\n const data = encodeExchange(d.family, args, amountIn, minOut, recipient);\n // No gas limit: get_dy measures no gas, and a per-step formula was wrong both ways. Run at its limit\n // (eth_call, 2026-11-05) the swap ran out of gas — crvUSD → scrvUSD on Ethereum needs 180 778 (formula\n // 180 000: the vault's deposit), every Monad route 345–352k for one stable-ng pool (formula 300 000) — while a\n // limit with room for the dearest pool overcharges where the limit is what is paid (Monad). The wallet\n // estimates the exact call with headroom right before broadcast, after any approval (as for Uniswap without\n // a quoter figure, THORChain and Chainflip).\n const quote: Quote = {\n provider: \"curve\",\n // One id per quote: a remote stub keys the request a build is checked against by it.\n intentId: mintCurveIntentId(chainId),\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {\n to: d.router,\n data,\n value: nativeIn ? amountIn.toString() : \"0\",\n chainId,\n ...(nativeIn ? {} : {approvalAddress: d.router}),\n },\n sourceAmount: amountIn.toString(),\n destAmount: out.toString(),\n minDestAmount: minOut.toString(),\n feeUsd: 0,\n etaSeconds: 15,\n reliability: 0.97,\n validUntilMs: Date.now() + ttl,\n // Pool fees are inside the router-priced output; nothing is added on top.\n providerData: {\n route: route.label,\n poolFee: \"pools\",\n router: d.router,\n family: d.family,\n tokenIn,\n tokenOut,\n amountIn: amountIn.toString(),\n minOut: minOut.toString(),\n slippageBps: String(bps),\n pools: routePools(args).join(\",\"),\n candidates: `${routes.length}${truncated ? \"+\" : \"\"}`,\n ...(priceImpactBps !== undefined ? {priceImpactBps: String(priceImpactBps)} : {}),\n },\n };\n // The same check a client runs on a remote quote, on what this provider just built.\n const why = selfCheck(params, quote);\n if (why) return refuse(`built a call its own check refuses (${why})`);\n return quote;\n } catch (e) {\n return refuse(e instanceof Error ? e.message.replace(/^curve: /, \"\") : String(e));\n }\n },\n\n /**\n * Right before broadcast (after any approval): the transaction is byte for byte the sealed quote, each hop pool is\n * still the pinned code with the pinned coins (the immutable router's code and version were checked once for the\n * chain), and the exact route still pays at least the signed minimum. Refuse with the reason instead of sending a swap that would revert or was altered.\n */\n async preflightDeposit(quote: Quote, tx: UnsignedTx): Promise<void> {\n const reason = await chain.checkSealed(quote, tx);\n if (reason) throw new Error(`curve: ${reason}. Nothing was sent; refresh the quote.`);\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n if (!tx?.to || !tx.data) throw new Error(\"swap2: Curve quote has no transaction request\");\n return {\n chain: \"\",\n to: tx.to,\n value: tx.value ?? \"0\",\n data: tx.data,\n ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}),\n ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {}),\n ...(tx.approvalAddress ? {approvalAddress: tx.approvalAddress} : {}),\n };\n },\n\n /** Same-chain: the swap is done when its transaction is mined successfully. */\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n if (!ref.sourceTxHash) return {state: \"pending\"};\n const chainId = curveIntentChain(ref.intentId);\n if (chainId === null || !deploymentOf(deployments, chainId) || !config.rpcUrls[chainId]?.length) return {state: \"pending\"};\n try {\n const [receipt] = (await rpc(chainId, [{method: \"eth_getTransactionReceipt\", params: [ref.sourceTxHash]}])) as [{status?: string} | null];\n if (!receipt) return {state: \"pending\"};\n return receipt.status === \"0x1\" ? {state: \"completed\", destTxHash: ref.sourceTxHash} : {state: \"failed\"};\n } catch {\n return {state: \"pending\"};\n }\n },\n };\n}\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Ethereum (1), router ABI ng5. On-chain checks at block 26350656: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $1,000,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 80 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/ethereum.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_1: CurveChainPools = {\n chainId: 1,\n builtAt: '2026-11-05',\n block: 26350656,\n pools: [\n { address: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', name: 'Curve.fi DAI/USDC/USDT', coins: ['0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [18, 6, 6], poolType: 1, swapTypes: [1], codeHash: '0x954a1e212c557c85043985931498ffa3e2fcbe7dfe9cd61513f36eb47d6f4dfc', tvlUsd: 161890942, createdAt: 1599422178 },\n { address: '0xDC24316b9AE028F1497c275EB9192a3Ea0f67022', name: 'Curve.fi ETH/stETH', coins: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0xe2c45ce8268580c40b4c12c574f8a210375ab92998c1555451fef63630e96b35', tvlUsd: 85454194, createdAt: 1609827515 },\n { address: '0x862CB4E988FB66E72f128d1183829f8c05B6c6A0', name: 'Yield Basis cbBTC', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf'], decimals: [18, 8], poolType: 20, swapTypes: [1], codeHash: '0xd19e3a232367411c825df98165c95898c08e181fe2e0f9211445f48eb4c0dc62', tvlUsd: 54490963, createdAt: 1779393887 },\n { address: '0x313698667d7FDD6789a9BC70821309ff891E729A', name: 'Yield Basis WBTC', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'], decimals: [18, 8], poolType: 20, swapTypes: [1], codeHash: '0xe4ac67017f888827e6efe22cd8edc37bf562166368f6eb62837bff2e4a4a23e8', tvlUsd: 48858088, createdAt: 1779393875 },\n { address: '0xD001aE433f254283FeCE51d4ACcE8c53263aa186', name: 'RLUSD/USDC', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x8292Bb45bf1Ee4d140127049757C2E0fF06317eD'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0x0e07a882cbde1fe43a2023b573596d0688cd4511bb04cbff49f1d9cceab84888', tvlUsd: 39310146, createdAt: 1734614699 },\n { address: '0xcc7d5785AD5755B6164e21495E07aDb0Ff11C2A8', name: 'OETH/WETH', coins: ['0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0x8b33e4c54cca2b340c5ac61ac287ecd06cfab84979e63c1260683abcc06f8138', tvlUsd: 38072502, createdAt: 1742850227 },\n { address: '0x4F52C3a81E33521e5a9A47FD9D3BE475D2279c2e', name: 'Yield Basis tBTC', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0x18084fbA666a33d37592fA2633fD49a74DD93a88'], decimals: [18, 18], poolType: 20, swapTypes: [1], codeHash: '0xaefafc4c0157bc496db238fc46d730a140174f3fb542527bb86443974ed4f7a6', tvlUsd: 35972318, createdAt: 1779393911 },\n { address: '0x656341Ef90b622c6634e0573772FfB7f3669b9f3', name: 'Yield Basis WETH', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [18, 18], poolType: 20, swapTypes: [1], codeHash: '0x116eeee684882885cda3ddf0287d0979f71d64030fbec90f1f52924cf0e7643a', tvlUsd: 29312833, createdAt: 1779393923 },\n { address: '0x21E27a5E5513D6e65C4f830167390997aA84843a', name: 'Curve.fi Factory Pool: stETH-ng', coins: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0x9e28a09452d2354fc4e15e3244dde27cbc4d52f12a10b91f2ca755b672bfa9be', tvlUsd: 21919007, createdAt: 1684243259 },\n { address: '0xc061caa073f3d95F80f8e5428d32D2d76F5e1622', name: 'USDG/USDC', coins: ['0xe343167631d89B6Ffc58B88d6b7fB0228795491D', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x1c7b77a94bb42408ab6d5cfd76223f0c794db9b119bb6035db91d8b09da65512', tvlUsd: 20042556, createdAt: 1757337995 },\n { address: '0xC2921134073151490193AC7369313c8e0b08e1E7', name: 'USDtb-USDC', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xC139190F447e929f090Edeb554D95AbB8b18aC1C'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0x003569f063c00de15be2ce5934449342555e009ef7ba9894ef84d302602b186f', tvlUsd: 19974424, createdAt: 1733348927 },\n { address: '0x83f24023d15d835a213df24fd309c47dAb5BEb32', name: 'YB cbBTC', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf'], decimals: [18, 8], poolType: 20, swapTypes: [1], codeHash: '0xb00ba7467a75fffe15d018cc822a09b282a285f4012f857b19966046b3191b3a', tvlUsd: 17762242, createdAt: 1758723599 },\n { address: '0x5dc1BF6f1e983C0b21EfB003c105133736fA0743', name: 'FRAXUSDe', coins: ['0x853d955aCEf822Db058eb8505911ED77F175b99e', '0x4c9EDD5852cd905f086C759E8383e09bff1E68B3'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0x6aa12bb9b18854a3f453e240d7e960190a32f1c16a8e268a90a66c8a95fe3a86', tvlUsd: 16042488, createdAt: 1702770299 },\n { address: '0x13e12BB0E6A2f1A3d6901a59a9d585e89A6243e1', name: 'crvUSD/frxUSD', coins: ['0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0x6de2b24d7a8852d96955f6873f16402e61b5d9f3aff037f62a2004fecf31ce83', tvlUsd: 13934470, createdAt: 1752006431 },\n { address: '0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E', name: 'Curve.fi Factory Plain Pool: crvUSD/USDC', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'], decimals: [6, 18], poolType: 1, swapTypes: [1], codeHash: '0x06a0d9fefe2940f35a5e0b347ff8e2f8085c76ce487b5b234b2e3c831160e34f', tvlUsd: 13078629, createdAt: 1684066067 },\n { address: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA', name: 'Curve.fi Factory USD Metapool: Liquity', coins: ['0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490'], decimals: [18, 18], underlying: ['0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', '0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], underlyingDecimals: [18, 18, 6, 6], basePool: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', poolType: 1, swapTypes: [1, 2], codeHash: '0x156700a4060f3d62786914b50cc60b2b840e6440401bea9a99c0acce0b58beda', tvlUsd: 12967284, createdAt: 1617702355 },\n { address: '0xf5f5B97624542D72A9E06f04804Bf81baA15e2B4', name: 'TricryptoUSDT', coins: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [6, 8, 18], poolType: 30, swapTypes: [1], codeHash: '0xe5a06bd0c8f12bc66b551b99a34cdd7d2a286a53b778244c930a8f6db01fef40', tvlUsd: 12898000, createdAt: 1685482703 },\n { address: '0x4d9f9D15101EEC665F77210cB999639f760F831E', name: 'Curve.fi Factory Plain Pool: stETH/frxETH', coins: ['0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84', '0x5E8422345238F34275888049021821E8E08CAa1f'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0x8d287c58712fcd24b18f60f4a77a4a4d1a7a8bd10e3cb4c9d4752296b307aa51', tvlUsd: 12880550, createdAt: 1677059567 },\n { address: '0x383E6b4437b59fff47B619CBA855CA29342A8559', name: 'PayPool', coins: ['0x6c3ea9036406852006290770BEdFcAbA0e23A0e8', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x36356aefa486ac281df5aa3efb601b135b95da2c266bc4bf627aa6f4b4b22703', tvlUsd: 12266641, createdAt: 1703113055 },\n { address: '0xD51a44d3FaE010294C616388b506AcdA1bfAAE46', name: 'Curve.fi USD-BTC-ETH', coins: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [6, 8, 18], poolType: 3, swapTypes: [1], codeHash: '0x9cb858c1d8e8ab8ba7dc273f146d428965b0ca686d05fb02cb4ffc62149ec928', tvlUsd: 10625171, createdAt: 1626218283 },\n { address: '0x390f3595bCa2Df7d23783dFd126427CCeb997BF4', name: 'Curve.fi Factory Plain Pool: crvUSD/USDT', coins: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'], decimals: [6, 18], poolType: 1, swapTypes: [1], codeHash: '0x06a0d9fefe2940f35a5e0b347ff8e2f8085c76ce487b5b234b2e3c831160e34f', tvlUsd: 9808682, createdAt: 1684066103 },\n { address: '0xDB74dfDD3BB46bE8Ce6C33dC9D82777BCFc3dEd5', name: 'weETH/WETH-ng', coins: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0xf9b0b2342e2132b069f65bb801081a730df7cf80b2ef5a8b9a3fc7a6324724f3', tvlUsd: 9757307, createdAt: 1713832907 },\n { address: '0xB7ECB2AA52AA64a717180E030241bC75Cd946726', name: 'Curve.fi Factory Plain Pool: tBTC/WBTC', coins: ['0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0x18084fbA666a33d37592fA2633fD49a74DD93a88'], decimals: [8, 18], poolType: 1, swapTypes: [1], codeHash: '0x06a0d9fefe2940f35a5e0b347ff8e2f8085c76ce487b5b234b2e3c831160e34f', tvlUsd: 8360462, createdAt: 1692136331 },\n { address: '0x5018BE882DccE5E3F2f3B0913AE2096B9b3fB61f', name: 'USDC/fxUSD', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x085780639CC2cACd35E474e71f4d000e2405d8f6'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0x4a0e13c96d5dddf3d9a22d3ad7b65e6735199e857996056cbc4718ef4869bb48', tvlUsd: 7959448, createdAt: 1719632039 },\n { address: '0xB576491F1E6e5E62f1d8F26062Ee822B40B0E0d4', name: 'Curve CVX-ETH', coins: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B'], decimals: [18, 18], poolType: 2, swapTypes: [1], codeHash: '0x56ba0e921b89ed274e747d68fb8e49ba91fcc6fc4f7c1aaa5294c74b6a4b4d72', tvlUsd: 5926700, createdAt: 1639223635 },\n { address: '0xEFc6516323FbD28e80B85A497B65A86243a54B3E', name: 'BOLD/USDC Pool', coins: ['0x6440f144b7e50D6a8439336510312d2F54beB01D', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0xd2c72b78d7d96bb962fa6429c4bb2e5dce6d92a5bc6712541ab76fe8e4570f07', tvlUsd: 5611794, createdAt: 1747597079 },\n { address: '0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B', name: 'TricryptoUSDC', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [6, 8, 18], poolType: 30, swapTypes: [1], codeHash: '0xffceb70c60b48d7d02df8305161e44ec2454c1bc23fabc528e9a9ec71e4e7806', tvlUsd: 4972786, createdAt: 1685446211 },\n { address: '0x0Bdb2c3AF83EE1d3196FA64d3162e54624B5f6b0', name: 'USAT/USDT', coins: ['0x07041776f5007ACa2A54844F50503a18A72A8b68', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x9d0252403d580a95341bbddbecea09bbe280bd4d87f28ee8531a01d33119ba01', tvlUsd: 4647056, createdAt: 1772798639 },\n { address: '0xC09e82f81Cb811DB0922dD48206fc2e212322caf', name: 'World Liberty USD1 Pool', coins: ['0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d', '0x4f493B7dE8aAC7d55F71853688b1F7C8F0243C85'], decimals: [18, 18], underlying: ['0x8d0D000Ee44948FC98c9B98A4FA4921476f08B0d', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], underlyingDecimals: [18, 6, 6], basePool: '0x4f493B7dE8aAC7d55F71853688b1F7C8F0243C85', poolType: 10, swapTypes: [1, 2], codeHash: '0x25478b25c12a81937ddb75e0c5ed8ca8ab248a102316873d092f49ca870b8cca', tvlUsd: 4343338, createdAt: 1756668467 },\n { address: '0x9c3B46C0Ceb5B9e304FCd6D88Fc50f7DD24B31Bc', name: 'Curve.fi Factory Plain Pool: frxETH/WETH', coins: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x5E8422345238F34275888049021821E8E08CAa1f'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0x06a0d9fefe2940f35a5e0b347ff8e2f8085c76ce487b5b234b2e3c831160e34f', tvlUsd: 4279560, createdAt: 1692135095 },\n { address: '0x4f493B7dE8aAC7d55F71853688b1F7C8F0243C85', name: 'Curve.fi Strategic USD Reserves', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x5f0f1709fa823592ad75b27e32af00a8715d620dcb269be7c26fd5c873c1ce0e', tvlUsd: 4252884, createdAt: 1737825647 },\n { address: '0x2889302a794dA87fBF1D6Db415C1492194663D13', name: 'TricryptoLLAMA', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0x18084fbA666a33d37592fA2633fD49a74DD93a88', '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'], decimals: [18, 18, 18], poolType: 30, swapTypes: [1], codeHash: '0x0c6780573f9c77a247365e2cbeae61fe0af7ea94ded696b5ee5e6462ce51b02e', tvlUsd: 4217439, createdAt: 1686845315 },\n { address: '0x98a7F18d4E56Cfe84E3D081B40001B3d5bD3eB8B', name: 'Curve EURS-USDC', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdB25f211AB05b1c97D595516F45794528a807ad8'], decimals: [6, 2], poolType: 2, swapTypes: [1], codeHash: '0x6c0b789b9f2ee0cbb53935cbe4f88e7d66401e1b4508514c097e7bd81e8ea931', tvlUsd: 3939896, createdAt: 1635766643 },\n { address: '0x66039342C66760874047c36943B1e2d8300363BB', name: 'HemiBTC/cbBTC/WBTC', coins: ['0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x06ea695B91700071B161A434fED42D1DcbAD9f00'], decimals: [8, 8, 8], poolType: 10, swapTypes: [1], codeHash: '0x54a9f7fe4f6e0880c3e7f886d1a0500619b0539dd9d9067221a526ece460e6f7', tvlUsd: 3547580, createdAt: 1764180299 },\n { address: '0xE521BA88837B2726E5343ccA91adA6f19F356C45', name: 'USDx/USDT', coins: ['0xa1fA7777974312f7d801A8880714a218F76233f8', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0x74bb764c9dffe15ac160f6d01f6bdc1e4b03d39722083e674476ed6843c11d33', tvlUsd: 3020901, createdAt: 1788328955 },\n { address: '0x6F63deEDc9870D6c16FC644C6654748352cdc87c', name: 'apxUSD-USDC v3', coins: ['0x98A878b1Cd98131B271883B390f68D2c90674665', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0xe511d7fa636d58614f82e35f2f333d1ed931f75baed8b7b89d2b1ef09825ef26', tvlUsd: 2796538, createdAt: 1785427007 },\n { address: '0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14', name: 'TriCRV', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xD533a949740bb3306d119CC777fa900bA034cd52'], decimals: [18, 18, 18], poolType: 30, swapTypes: [1], codeHash: '0xf29fb95ca44fe2f979303e309cbaba61d44dd503fddeb111caae94e1b0857154', tvlUsd: 2439038, createdAt: 1690291775 },\n { address: '0x04710a7B238386Da58EfAd8b65E150e5E17AA522', name: 'USDC/sUSDat', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xD166337499E176bbC38a1FBd113Ab144e5bd2Df7'], decimals: [6, 18], poolType: 20, swapTypes: [1], codeHash: '0x11ecb979f7468e539cb2ee92b8cf7c59d56b1c97b9fdce333fe1d35ac5c8e110', tvlUsd: 2187783, createdAt: 1785550511 },\n { address: '0xE47E8Ced9D94AA43C922627782E29b41a93202AF', name: 'FIDD/USDC', coins: ['0x7C135549504245B5eAe64fc0E99Fa5ebabb8e35D', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0x11743a6ed542b23b65182e0c5a7b7d90b668a189f287b7c0c367b2f910d46c10', tvlUsd: 2074444, createdAt: 1770210611 },\n { address: '0x8273Cb2cF9AF3228fD14AF25B5B1De2A9676C372', name: 'FIDD/USDT', coins: ['0x7C135549504245B5eAe64fc0E99Fa5ebabb8e35D', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0xb1b0592d31b5fc1b46f56ffaecca522725e94a0e56facab038cb92d8b5e0f2e5', tvlUsd: 1750912, createdAt: 1770210935 },\n { address: '0x839d6bDeDFF886404A6d7a788ef241e4e28F4802', name: 'cbBTC/wBTC', coins: ['0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'], decimals: [8, 8], poolType: 10, swapTypes: [1], codeHash: '0x5270c4f3873d43de1babb9754a903f0de33054dfb7d562c3a3fcadbb8fd3fbca', tvlUsd: 1688187, createdAt: 1725600707 },\n { address: '0xa4c567c662349BeC3D0fB94C4e7f85bA95E208e4', name: 'Curve.fi Factory Plain Pool: msETH/WETH', coins: ['0x64351fC9810aDAd17A690E4e1717Df5e7e085160', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0x148d1345059482faa8834aff0630c9a4b47393df8edf9d99605b8f2f04752f62', tvlUsd: 1672158, createdAt: 1690864487 },\n { address: '0xbcb91E689114B9Cc865AD7871845C95241Df4105', name: 'Curve.fi Factory USD Metapool: PWRD Metapool', coins: ['0xF0a93d4994B3d98Fb5e3A2F90dBc2d69073Cb86b', '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490'], decimals: [18, 18], underlying: ['0xF0a93d4994B3d98Fb5e3A2F90dBc2d69073Cb86b', '0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], underlyingDecimals: [18, 18, 6, 6], basePool: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', poolType: 1, swapTypes: [1, 2], codeHash: '0xf6083ac638c10e3ca56ad0183f22c4bb24fda0f4c180165327954b3dfae28541', tvlUsd: 1438819, createdAt: 1632839676 },\n { address: '0x635EF0056A597D13863B73825CcA297236578595', name: 'GHO/crvUSD', coins: ['0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0x1517d1f4caa802ab0ddf9032274a7ff3781a1453ef7b278fc63245b492154ce2', tvlUsd: 1377020, createdAt: 1709732591 },\n { address: '0xC15F285679a1Ef2d25F53D4CbD0265E1D02F2A92', name: 'Curve.fi Factory Crypto Pool: FXN/ETH', coins: ['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0x365AccFCa291e7D3914637ABf1F7635dB165Bb09'], decimals: [18, 18], poolType: 2, swapTypes: [1], codeHash: '0x6dfb9f924888fe0d10b50c35ced3f2cf372073a7e524450f1ebe491415db66e0', tvlUsd: 1244529, createdAt: 1695111311 },\n { address: '0x625E92624Bc2D88619ACCc1788365A69767f6200', name: 'pyUSD/crvUSD', coins: ['0x6c3ea9036406852006290770BEdFcAbA0e23A0e8', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0x9c3b1c5ac877c1719736bb325d05eb2806f292776a2121a6f1e8a54d31960dbe', tvlUsd: 1175516, createdAt: 1703109587 },\n { address: '0xD9FF8396554A0d18B2CFbeC53e1979b7ecCe8373', name: 'YB WBTC', coins: ['0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E', '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'], decimals: [18, 8], poolType: 20, swapTypes: [1], codeHash: '0x1578c5a836891e466a1fa5879bc7f0e36bfd9fc625586765541191d8cd3880ae', tvlUsd: 1167762, createdAt: 1758723347 },\n { address: '0x971add32Ea87f10bD192671630be3BE8A11b8623', name: 'Curve.fi Factory Plain Pool: cvxCrv/Crv', coins: ['0xD533a949740bb3306d119CC777fa900bA034cd52', '0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7'], decimals: [18, 18], poolType: 1, swapTypes: [1], codeHash: '0x148d1345059482faa8834aff0630c9a4b47393df8edf9d99605b8f2f04752f62', tvlUsd: 1151010, createdAt: 1678280183 },\n { address: '0xF4d0CF32908b2C7f1021339c43Df0F77f06896d7', name: 'USDC/USDat', coins: ['0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x23238f20b894f29041f48D88eE91131C395Aaa71'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x3c0abdd2996e01d3bff6d4430c231f8dd9f539985066729c28fbb2596ecd6e99', tvlUsd: 1107886, createdAt: 1775403179 },\n { address: '0x5B03CcCAb7BA3010fA5CAd23746cbf0794938e96', name: 'Curve Strategic Ethena Reserves', coins: ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0x4c9EDD5852cd905f086C759E8383e09bff1E68B3'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0xbe6391aadd1d4d306c76728d664997ab7a1ef56c16565ca0d1526050b9c93890', tvlUsd: 1084518, createdAt: 1739457767 },\n { address: '0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956', name: 'Curve.fi GUSD/3Crv', coins: ['0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490'], decimals: [2, 18], underlying: ['0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', '0x6B175474E89094C44Da98b954EedeAC495271d0F', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], underlyingDecimals: [2, 18, 6, 6], basePool: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', poolType: 1, swapTypes: [1, 2], codeHash: '0xce79330162abf07fc163331f9d9d1553b93dbf509eeafa1215fafa6113c5088e', tvlUsd: 1068354, createdAt: 1602040124 },\n { address: '0xD6937eA8D33B0C21348F36F7895FdE3054bA4927', name: 'frxUSD/USDT', coins: ['0xCAcd6fd266aF91b8AeD52aCCc382b4e165586E29', '0xdAC17F958D2ee523a2206206994597C13D831ec7'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0xadf65a4e5ed895c5c85762d0b52d482664f1e26976e8401b39e95cd838e25998', tvlUsd: 1005528, createdAt: 1789499843 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Optimism (10), router ABI ng5. On-chain checks at block 159152475: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/optimism.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_10: CurveChainPools = {\n chainId: 10,\n builtAt: '2026-11-05',\n block: 159152475,\n pools: [\n { address: '0xD1b30BA128573fcd7D141C8A987961b40e047BB6', name: 'crvUSD/USDT', coins: ['0xC52D7F23a2e460248Db6eE192Cb23dD12bDDCbf6', '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0xde251e17bf12e902d51f15ea5c2658888801dbb5f6c5095e226bdb808084bd98', tvlUsd: 250955, createdAt: 1703088383 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Gnosis (100), router ABI ng5. On-chain checks at block 49126652: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/xdai.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_100: CurveChainPools = {\n chainId: 100,\n builtAt: '2026-11-05',\n block: 49126652,\n pools: [\n { address: '0x7f90122BF0700F9E7e1F688fe926940E8839F353', name: 'Curve.fi wxDAI/USDC/USDT', coins: ['0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', '0x4ECaBa5870353805a9F068101A40E0f32ed605C6'], decimals: [18, 6, 6], poolType: 1, swapTypes: [1], codeHash: '0x855fc847a134dc1d35593a59c460e334938f53cb115b2befa8174138a1bb3df6', tvlUsd: 447779, createdAt: 1625016390 },\n { address: '0x0eCEC6F5276d2Ec6bB864F063D2b76393d6A1A74', name: 'USDCe/EURe', coins: ['0x2a22f9c3b484c3629090FeED35F17Ff8F88f76F0', '0x420CA0f9B9b604cE0fd9C18EF134C705e5Fa3430'], decimals: [6, 18], poolType: 20, swapTypes: [1], codeHash: '0x0287322b54143499eae6ce611f7895d7f37426f60565a7d1e228dac396ad1a89', tvlUsd: 360118, createdAt: 1786365280 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Monad (143), router ABI lite4. On-chain checks at block 119683641: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api2.curve.finance/get_pools/143.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_143: CurveChainPools = {\n chainId: 143,\n builtAt: '2026-11-05',\n block: 119683641,\n pools: [\n { address: '0xFd945d71D4E9609a1FAb0aE9c30dA8088E7AEE1E', name: 'USDat/USDC', coins: ['0x0Bb150DFa86EA5d7742F07FEfCD8E8edA81D64eF', '0x754704Bc059F8C67012fEd69BC8A327a5aafb603'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0xd5d05317249e8e17bd8c67a05048a7115ec719e3f4198ddfa560b7c0b3b620f6', tvlUsd: 2005448, createdAt: 1784210436 },\n { address: '0x942644106B073E30D72c2C5D7529D5C296ea91ab', name: '3pool', coins: ['0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a', '0x754704Bc059F8C67012fEd69BC8A327a5aafb603', '0xe7cd86e13AC4309349F30B3435a9d337750fC82D'], decimals: [6, 6, 6], poolType: 10, swapTypes: [1], codeHash: '0x93a67dae1693a9327ff151167502f6785ac856025182eebd61150f4e0ea92ffa', tvlUsd: 1442204, createdAt: 1763939652 },\n { address: '0xD665CaAD68ACb093AFF27eC6c71Ccc4F29c28147', name: 'AUSD/trUSD', coins: ['0x00000000eFE302BEAA2b3e6e1b18d08D69a9012a', '0x770a579Ea200784723B31b8668b0773ba80393c9'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0xb7af5a0364e252d950458f28c2d14434dd2961cef09ca1e2f90d7b1a96403a00', tvlUsd: 683014, createdAt: 1790778034 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// X Layer (196), router ABI lite4. On-chain checks at block 75134757: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/x-layer.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_196: CurveChainPools = {\n chainId: 196,\n builtAt: '2026-11-05',\n block: 75134757,\n pools: [\n { address: '0x5B3f7F05b79f3cCBe8F33374A578e14dBBb28478', name: 'USDC/USDT0', coins: ['0xB6CEceAB302E2E4948951eE7843FC24E92933061', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x78281e9e5a691fe225a5c246be69cc35d48e81f4e1c0bcca178121fa41612961', tvlUsd: 300301, createdAt: 1786522937 },\n { address: '0x31F066aA0A687d4F383F96a514984AF727Eb8e38', name: 'USDG/USD0', coins: ['0x4ae46a509F6b1D9056937BA4500cb143933D2dc8', '0x779Ded0c9e1022225f8E0630b35a9b54bE713736'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x855800c63268949eadd5206e5729c69e768f017722f275e90c4185b1fb0733bc', tvlUsd: 300095, createdAt: 1758717026 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Base (8453), router ABI ng5. On-chain checks at block 53566756: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/base.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_8453: CurveChainPools = {\n chainId: 8453,\n builtAt: '2026-11-05',\n block: 53566756,\n pools: [\n { address: '0x302A94E3C28c290EAF2a4605FC52e11Eb915f378', name: 'superOETHb/WETH', coins: ['0x4200000000000000000000000000000000000006', '0xDBFeFD2e8460a6Ee4955A68582F85708BAEA60A3'], decimals: [18, 18], poolType: 10, swapTypes: [1], codeHash: '0xd77abce9f34194324a3f8633aa5132f90aaa293ce9b1d7cfe9616bfaff0b9794', tvlUsd: 5842454, createdAt: 1737744997 },\n { address: '0x11C1fBd4b3De66bC0565779b35171a6CF3E71f59', name: 'Curve.fi Factory Crypto Pool: cbETH/WETH', coins: ['0x4200000000000000000000000000000000000006', '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22'], decimals: [18, 18], poolType: 2, swapTypes: [1], codeHash: '0xbba8650811de0f6d2cc92316e9826589443d72feebb6805b2655e81073abe834', tvlUsd: 1016724, createdAt: 1693260297 },\n { address: '0xfac15A759d0F887Bc7F5ab874491258CF6EC8acE', name: 'TriBitcoin', coins: ['0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', '0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b', '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c'], decimals: [8, 18, 8], poolType: 10, swapTypes: [1], codeHash: '0x51b2520df586800fd89a56f3a098e1a50e175f72b28088201682deb31bec0022', tvlUsd: 563901, createdAt: 1760081729 },\n { address: '0x6e53131F68a034873b6bFA15502aF094Ef0c5854', name: 'tricrypto', coins: ['0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93', '0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b', '0x4200000000000000000000000000000000000006'], decimals: [18, 18, 18], poolType: 30, swapTypes: [1], codeHash: '0x437ca50fd4d25807efaa7d45077d247057a5e16b90609fcfde0b51f3673426d3', tvlUsd: 270418, createdAt: 1693263329 },\n { address: '0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f', name: 'Curve.fi Factory Plain Pool: 4pool', coins: ['0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', '0xEB466342C4d449BC9f53A865D5Cb90586f405215', '0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93'], decimals: [6, 6, 6, 18], poolType: 1, swapTypes: [1], codeHash: '0xca87b5689cf421c7b6a160ea2b22bd23ef9267477918f39a2bbdf3cb838a987d', tvlUsd: 254106, createdAt: 1693751021 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Plasma (9745), router ABI lite4. On-chain checks at block 36960466: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api2.curve.finance/get_pools/9745.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_9745: CurveChainPools = {\n chainId: 9745,\n builtAt: '2026-11-05',\n block: 36960466,\n pools: [\n { address: '0x2D84D79C852f6842AbE0304b70bBaA1506AdD457', name: 'USDT0/USDe', coins: ['0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb', '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34'], decimals: [6, 18], poolType: 10, swapTypes: [1], codeHash: '0xc001cdbdd189f52d922cba4eec3137b5698c715d2370d67a41b937e7793b8bd2', tvlUsd: 719322, createdAt: 1758191172 },\n { address: '0x085BaD2C28Bdd4A40396072D3eb2636BF7Afa39c', name: 'yzUSD/USDT0', coins: ['0x6695c0f8706C5ACe3Bdf8995073179cCA47926dc', '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb'], decimals: [18, 6], poolType: 10, swapTypes: [1], codeHash: '0x8714b6160e5494b54383f64ebd4c8607093175dd697e48655cfd21df80b81804', tvlUsd: 596466, createdAt: 1762342995 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs on 2026-11-05. Do not edit by hand: rerun the script.\n// Arbitrum (42161), router ABI ng5. On-chain checks at block 521558965: coins(i), decimals(),\n// balances(i) > 0, code hash, MetaRegistry/factory registration, get_dy(0, 1, ~$100).\n// Rules: TVL >= $250,000 (on-chain balances of catalog/crvUSD coins x API prices), age >= 30 days, top 40 by TVL;\n// no hidden/broken pools, no stable-ng asset type 2/3, no foreign rate oracles. Discovery: api.curve.finance/v1/getPools/all/arbitrum.\nimport type { CurveChainPools } from './types.js'\n\nexport const POOLS_42161: CurveChainPools = {\n chainId: 42161,\n builtAt: '2026-11-05',\n block: 521558965,\n pools: [\n { address: '0x7f90122BF0700F9E7e1F688fe926940E8839F353', name: 'Curve.fi USDC/USDT', coins: ['0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8', '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'], decimals: [6, 6], poolType: 1, swapTypes: [1], codeHash: '0xc9c2956ac40175996b15ae3a750b84226736322c5c1aef3e6815b77aab3cb27e', tvlUsd: 630740, createdAt: 1631439440 },\n { address: '0x186cF879186986A20aADFb7eAD50e3C20cb26CeC', name: '2BTC-ng', coins: ['0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', '0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40'], decimals: [8, 18], poolType: 10, swapTypes: [1], codeHash: '0xaeb505d765c57572cafa881bfcae2cba4e39f933fa7eea85e952ca3b5e1e6a7d', tvlUsd: 509842, createdAt: 1718829260 },\n { address: '0x82670f35306253222F8a165869B28c64739ac62e', name: 'Tricrypto-crvUSD', coins: ['0x498Bf2B1e120FeD3ad3D42EA2165E9b73f99C1e5', '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f', '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1'], decimals: [18, 8, 18], poolType: 30, swapTypes: [1], codeHash: '0x35da327ca48b6e428478467c3996176d71855383e82d30664f95886822fd507d', tvlUsd: 328993, createdAt: 1704150579 },\n { address: '0x49b720F1Aab26260BEAec93A7BeB5BF2925b2A8F', name: 'Strategic USD Reserves', coins: ['0xaf88d065e77c8cC2239327C5EDb3A432268e5831', '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'], decimals: [6, 6], poolType: 10, swapTypes: [1], codeHash: '0x27724587b6447859a96567a97e5bf015b8e5ae3d90ffdbe97a098c30b268703c', tvlUsd: 257764, createdAt: 1739092049 },\n ],\n} as const\n","// Generated by scripts/build-allowlist.mjs. Do not edit by hand: rerun the script.\nimport type { CurveChainPools } from './types.js'\nimport { POOLS_1 } from './1.js'\nimport { POOLS_10 } from './10.js'\nimport { POOLS_100 } from './100.js'\nimport { POOLS_143 } from './143.js'\nimport { POOLS_196 } from './196.js'\nimport { POOLS_8453 } from './8453.js'\nimport { POOLS_9745 } from './9745.js'\nimport { POOLS_42161 } from './42161.js'\n\nexport type { CurveChainPools, CurvePool, Hex } from './types.js'\n\n/** Curated Curve pools per chain id. A chain missing here has no pool that passed the rules. */\nexport const CURVE_POOLS: Readonly<Record<number, CurveChainPools>> = Object.freeze({\n 1: POOLS_1,\n 10: POOLS_10,\n 100: POOLS_100,\n 143: POOLS_143,\n 196: POOLS_196,\n 8453: POOLS_8453,\n 9745: POOLS_9745,\n 42161: POOLS_42161,\n})\n","/**\n * Routes over the curated pool allowlist: a token graph built from the pools the package pins (coins, and the\n * underlying coins of metapools that allow `exchange_underlying`), plus the router's own pseudo-hops — swap_type 8\n * between the native coin and the pinned wrapped native, and on router v1.2 swap_type 9 between crvUSD and scrvUSD.\n * Routes cross at most {@link MAX_ROUTE_POOLS} pools. A token a route hands its funds through between two hops must be\n * one the swap2-assets catalog lists on the chain by address, or the native coin / the pinned wrapped native\n * ({@link intermediateAllowed}); a pool's other coins, which the route does not touch, may be anything the allowlist\n * admitted. `exchange_underlying` (swap_type 2) runs on a metapool only while its base pool is allowlisted too.\n *\n * `checkRoute` is the same rule set read back from router arguments: what the provider builds, `curveVerifyQuote`\n * (on the client, for a remote quote) and `preflightDeposit` all pass through it.\n */\nimport {getAddress} from \"viem\";\nimport {ccAssetByToken} from \"@anywalletkit/swap2-assets\";\nimport type {RouterArgs} from \"./abi.js\";\nimport {CURVE_DENIED_POOLS, MAX_ROUTE_POOLS, MAX_ROUTE_STEPS, ZERO_ADDRESS, type CurveDeployment} from \"./deployments.js\";\nimport type {CurveChainPools, CurvePool, Hex} from \"./pools/types.js\";\n\n/** One router step: a pool swap, the native ↔ wrapped-native hop (8) or the ERC-4626 hop (9). */\nexport type CurveStep =\n | {kind: \"pool\"; pool: CurvePool; swapType: 1 | 2; i: number; j: number; tokenIn: Hex; tokenOut: Hex}\n | {kind: \"wrap\"; weth: Hex; tokenIn: Hex; tokenOut: Hex}\n | {kind: \"erc4626\"; vault: Hex; deposit: boolean; tokenIn: Hex; tokenOut: Hex};\n\nexport interface CurveRoute {\n steps: readonly CurveStep[];\n /** Human description for the review / logs, e.g. \"3pool\", \"wrap → TricryptoUSDT\". */\n label: string;\n}\n\n/** Most candidate routes priced for one quote (three JSON-RPC batches of ten). */\nexport const MAX_QUOTE_CANDIDATES = 30;\n/** Partial paths explored before the search gives up (an allowlist far larger than any curated one). */\nconst MAX_EXPLORED = 20_000;\n\nconst lc = (a: string) => a.toLowerCase();\nconst STABLE_POOL_TYPES = new Set([1, 10]);\n\n/**\n * Whether a route may hand the swap through `token` between two hops on `chainId`: the router's native sentinel, the\n * pinned wrapped native, or a token the swap2-assets catalog lists on that chain, matched by address. The source and\n * the destination follow the engine's listed / unlisted token policy instead (as for every provider).\n */\nexport function intermediateAllowed(chainId: number, deployment: CurveDeployment, token: string): boolean {\n const t = lc(token);\n if (t === lc(deployment.eth)) return true;\n if (t === lc(deployment.weth)) return t !== lc(ZERO_ADDRESS);\n if (!/^0x[0-9a-f]{40}$/.test(t) || t === lc(ZERO_ADDRESS)) return false;\n const listed = ccAssetByToken(`eip155:${chainId}`, t);\n return !!listed?.contract && lc(listed.contract) === t;\n}\n\n/**\n * Whether `exchange_underlying` (swap_type 2) may run on `pool`, given the chain's allowlisted pools `index`: only on a\n * metapool that names its base pool, with that base pool itself allowlisted (and not denied), and `underlying` the\n * meta coins followed by the base pool's coins. Never on a lending pool (no base pool): its underlying route deposits\n * into the lending venue, which a `get_dy` view never touches (Aave v2 on Polygon has every reserve frozen).\n */\nexport function underlyingAllowed(pool: CurvePool, index: ReadonlyMap<string, CurvePool>): boolean {\n const under = pool.underlying;\n if (!under || under.length < 2 || !pool.swapTypes.includes(2)) return false;\n if (!pool.basePool) return false;\n const base = index.get(lc(pool.basePool));\n if (!base || base === pool) return false;\n const meta = pool.coins.length - 1;\n if (under.length !== meta + base.coins.length) return false;\n return under.every((c, k) => lc(c) === lc(k < meta ? pool.coins[k]! : base.coins[k - meta]!));\n}\n\n/** Pool types the router family can execute: `[4][5]` routers speak only to NG pools (stable-ng, twocrypto-ng, tricrypto-ng). */\nexport function poolTypeAllowed(family: CurveDeployment[\"family\"], poolType: number): boolean {\n return family === \"ng5\" ? [1, 2, 3, 10, 20, 30].includes(poolType) : [10, 20, 30].includes(poolType);\n}\n\ninterface Graph {\n edges: Map<string, CurveStep[]>;\n byAddress: Map<string, CurvePool>;\n}\n\nconst graphs = new WeakMap<CurveChainPools, WeakMap<CurveDeployment, Graph>>();\n\n/** Allowlisted pools by address (lowercase), denied pools left out. */\nexport function poolIndex(chainId: number, deployment: CurveDeployment, table: CurveChainPools | undefined): Map<string, CurvePool> {\n return graphFor(chainId, deployment, table).byAddress;\n}\n\nfunction graphFor(chainId: number, deployment: CurveDeployment, table: CurveChainPools | undefined): Graph {\n if (!table) return {edges: new Map(), byAddress: new Map()};\n let perDeployment = graphs.get(table);\n if (!perDeployment) graphs.set(table, (perDeployment = new WeakMap()));\n let g = perDeployment.get(deployment);\n if (g) return g;\n g = {edges: new Map(), byAddress: new Map()};\n const denied = CURVE_DENIED_POOLS[chainId];\n const eth = lc(deployment.eth);\n const add = (s: CurveStep) => {\n const k = lc(s.tokenIn);\n const list = g!.edges.get(k);\n if (list) list.push(s);\n else g!.edges.set(k, [s]);\n };\n for (const pool of table.chainId === chainId ? table.pools : []) {\n const key = lc(pool.address);\n if (denied?.has(key) || g.byAddress.has(key) || !poolTypeAllowed(deployment.family, pool.poolType)) continue;\n if (!/^0x[0-9a-fA-F]{40}$/.test(pool.address) || pool.coins.length < 2 || pool.coins.length > 8) continue;\n // A `[4][5]` router never forwards the native coin to a pool: a pool listing it would take nothing.\n if (deployment.family === \"lite4\" && [...pool.coins, ...(pool.underlying ?? [])].some((c) => lc(c) === eth)) continue;\n g.byAddress.set(key, pool);\n }\n // Edges once every pool is indexed: a metapool's underlying edges need its base pool's entry.\n for (const pool of g.byAddress.values()) {\n const pairs = new Set<string>();\n if (pool.swapTypes.includes(1)) {\n pool.coins.forEach((a, i) => pool.coins.forEach((b, j) => {\n if (i === j || lc(a) === lc(b)) return;\n pairs.add(`${lc(a)}>${lc(b)}`);\n add({kind: \"pool\", pool, swapType: 1, i, j, tokenIn: getAddress(a), tokenOut: getAddress(b)});\n }));\n }\n const under = pool.underlying;\n if (under && underlyingAllowed(pool, g.byAddress) && (deployment.family === \"ng5\" || pool.poolType === 10)) {\n under.forEach((a, i) => under.forEach((b, j) => {\n if (i === j || lc(a) === lc(b) || pairs.has(`${lc(a)}>${lc(b)}`)) return;\n add({kind: \"pool\", pool, swapType: 2, i, j, tokenIn: getAddress(a), tokenOut: getAddress(b)});\n }));\n }\n }\n if (lc(deployment.weth) !== lc(ZERO_ADDRESS)) {\n add({kind: \"wrap\", weth: getAddress(deployment.weth), tokenIn: getAddress(deployment.eth), tokenOut: getAddress(deployment.weth)});\n add({kind: \"wrap\", weth: getAddress(deployment.weth), tokenIn: getAddress(deployment.weth), tokenOut: getAddress(deployment.eth)});\n }\n const v = erc4626Of(deployment);\n if (v) {\n add({kind: \"erc4626\", vault: getAddress(v.vault), deposit: true, tokenIn: getAddress(v.asset), tokenOut: getAddress(v.vault)});\n add({kind: \"erc4626\", vault: getAddress(v.vault), deposit: false, tokenIn: getAddress(v.vault), tokenOut: getAddress(v.asset)});\n }\n perDeployment.set(deployment, g);\n return g;\n}\n\n/** The ERC-4626 hop a deployment may use: only a `[5][5]` router at v1.2 (v1.1 reverts \"Bad swap type\"). */\nfunction erc4626Of(d: CurveDeployment): {vault: Hex; asset: Hex} | undefined {\n return d.erc4626 && d.family === \"ng5\" && d.version === \"1.2.0\" ? d.erc4626 : undefined;\n}\n\nconst minTvl = (r: readonly CurveStep[]) => r.reduce((m, s) => (s.kind === \"pool\" ? Math.min(m, s.pool.tvlUsd) : m), Number.POSITIVE_INFINITY);\nconst poolCount = (r: readonly CurveStep[]) => r.filter((s) => s.kind === \"pool\").length;\n\n/**\n * Candidate routes tokenIn → tokenOut: at most {@link MAX_ROUTE_POOLS} pools and {@link MAX_ROUTE_STEPS} steps, no\n * token or pool twice, at most one wrap and one ERC-4626 hop. Ranked fewest pools first, then by the thinnest pool's\n * TVL, and cut to `limit`. `truncated` says the cut (or the search budget) dropped some.\n */\nexport function findRoutes(chainId: number, deployment: CurveDeployment, table: CurveChainPools | undefined, tokenIn: Hex, tokenOut: Hex, limit = MAX_QUOTE_CANDIDATES): {routes: CurveRoute[]; truncated: boolean} {\n const g = graphFor(chainId, deployment, table);\n const want = lc(tokenOut);\n const found: CurveStep[][] = [];\n let explored = 0;\n let exhausted = false;\n const walk = (at: string, path: CurveStep[], seenTokens: Set<string>, seenPools: Set<string>) => {\n if (exhausted) return;\n for (const s of g.edges.get(at) ?? []) {\n if (++explored > MAX_EXPLORED) { exhausted = true; return; }\n const next = lc(s.tokenOut);\n if (seenTokens.has(next)) continue;\n if (next !== want && !intermediateAllowed(chainId, deployment, next)) continue;\n if (s.kind === \"pool\" && (seenPools.has(lc(s.pool.address)) || poolCount(path) >= MAX_ROUTE_POOLS)) continue;\n if (s.kind !== \"pool\" && path.some((p) => p.kind === s.kind)) continue;\n const steps = [...path, s];\n if (next === want) {\n if (poolCount(steps) > 0 || steps.some((x) => x.kind === \"erc4626\")) found.push(steps);\n continue;\n }\n if (steps.length >= MAX_ROUTE_STEPS) continue;\n seenTokens.add(next);\n if (s.kind === \"pool\") seenPools.add(lc(s.pool.address));\n walk(next, steps, seenTokens, seenPools);\n seenTokens.delete(next);\n if (s.kind === \"pool\") seenPools.delete(lc(s.pool.address));\n }\n };\n walk(lc(tokenIn), [], new Set([lc(tokenIn)]), new Set());\n found.sort((a, b) => poolCount(a) - poolCount(b) || minTvl(b) - minTvl(a) || a.length - b.length);\n return {routes: found.slice(0, limit).map((steps) => ({steps, label: labelOf(steps)})), truncated: exhausted || found.length > limit};\n}\n\nfunction labelOf(steps: readonly CurveStep[]): string {\n return steps.map((s) => (s.kind === \"pool\" ? `${s.pool.name}${s.swapType === 2 ? \" (underlying)\" : \"\"}` : s.kind === \"wrap\" ? (s.tokenOut === s.weth ? \"wrap\" : \"unwrap\") : s.deposit ? \"scrvUSD deposit\" : \"scrvUSD redeem\")).join(\" → \");\n}\n\n/** The router's `_route` / `_swap_params` for a route, in the deployment's ABI family. */\nexport function routeArgs(family: CurveDeployment[\"family\"], route: CurveRoute): RouterArgs {\n if (route.steps.length < 1 || route.steps.length > MAX_ROUTE_STEPS) throw new Error(`curve: a route has 1–${MAX_ROUTE_STEPS} steps`);\n const path: Hex[] = [route.steps[0]!.tokenIn];\n const params: bigint[][] = [];\n for (const s of route.steps) {\n const swap = s.kind === \"pool\" ? s.pool.address : s.kind === \"wrap\" ? s.weth : s.vault;\n path.push(getAddress(swap), s.tokenOut);\n const row = s.kind === \"pool\"\n ? [BigInt(s.i), BigInt(s.j), BigInt(s.swapType), BigInt(s.pool.poolType), BigInt((s.swapType === 2 ? s.pool.underlying! : s.pool.coins).length)]\n : s.kind === \"wrap\" ? [0n, 0n, 8n, 0n, 0n] : [s.deposit ? 0n : 1n, 0n, 9n, 0n, 0n];\n params.push(family === \"ng5\" ? row : row.slice(0, 4));\n }\n while (path.length < 11) path.push(ZERO_ADDRESS);\n const cols = family === \"ng5\" ? 5 : 4;\n while (params.length < 5) params.push(new Array<bigint>(cols).fill(0n));\n return {route: path, params};\n}\n\n/** Pool addresses a route's router arguments cross, in order. */\nexport function routePools(args: RouterArgs): Hex[] {\n const out: Hex[] = [];\n for (let k = 0; k < 5; k++) {\n const swap = args.route[2 * k + 1];\n const t = args.params[k]?.[2];\n if (!swap || lc(swap) === lc(ZERO_ADDRESS)) break;\n if (t === 1n || t === 2n) out.push(swap);\n }\n return out;\n}\n\n/**\n * Whether router arguments are a route this module would build on `chainId`: from `tokenIn` to `tokenOut`, every pool\n * hop through an allowlisted (and not denied) pool whose pinned coins at `i`/`j` are the hop's tokens, with the pool's\n * own pool type, an allowed swap type (1, or 2 for a metapool listing it whose base pool is allowlisted too) and its\n * coin count; every token between two hops a catalog token, the native coin or the pinned wrapped native; swap_type 8 only through\n * the pinned wrapped native between it and the native sentinel; swap_type 9 only on a v1.2 router through its pinned\n * ERC-4626 vault; no other swap type; at most {@link MAX_ROUTE_POOLS} pools, {@link MAX_ROUTE_STEPS} steps, no pool\n * twice, and nothing after the route's end. The reason it is not, or null.\n */\nexport function checkRoute(chainId: number, deployment: CurveDeployment, table: CurveChainPools | undefined, args: RouterArgs, tokenIn: string, tokenOut: string): string | null {\n const cols = deployment.family === \"ng5\" ? 5 : 4;\n if (args.route.length !== 11 || args.params.length !== 5 || args.params.some((r) => r.length !== cols)) return `the route is not address[11] with uint256[${cols}][5]`;\n const index = poolIndex(chainId, deployment, table);\n const zero = lc(ZERO_ADDRESS);\n const eth = lc(deployment.eth);\n const weth = lc(deployment.weth);\n const v = erc4626Of(deployment);\n let steps = 0;\n while (steps < 5 && lc(args.route[2 * steps + 1]!) !== zero) steps++;\n if (steps === 0) return \"the route has no step\";\n if (steps > MAX_ROUTE_STEPS) return `the route has ${steps} steps, more than ${MAX_ROUTE_STEPS}`;\n for (let k = 2 * steps + 1; k < 11; k++) if (lc(args.route[k]!) !== zero) return \"the route names addresses after its end\";\n for (let k = steps; k < 5; k++) if (args.params[k]!.some((x) => x !== 0n)) return \"the swap params carry rows after the route's end\";\n if (lc(args.route[0]!) !== lc(tokenIn)) return `the route starts at ${args.route[0]}, not the source token`;\n if (lc(args.route[2 * steps]!) !== lc(tokenOut)) return `the route ends at ${args.route[2 * steps]}, not the destination token`;\n for (let k = 1; k < steps; k++) {\n if (!intermediateAllowed(chainId, deployment, args.route[2 * k]!)) return `step ${k} hands the swap through ${args.route[2 * k]}, a token the catalog does not list on this chain`;\n }\n const pools = new Set<string>();\n let wraps = 0;\n let vaults = 0;\n for (let k = 0; k < steps; k++) {\n const a = lc(args.route[2 * k]!);\n const swap = lc(args.route[2 * k + 1]!);\n const b = lc(args.route[2 * k + 2]!);\n const row = args.params[k]!;\n const type = row[2]!;\n if (a === b) return `step ${k + 1} trades a token for itself`;\n if (type === 1n || type === 2n) {\n if (CURVE_DENIED_POOLS[chainId]?.has(swap)) return `step ${k + 1} crosses ${args.route[2 * k + 1]}, a pool this module refuses (fake coin, drained in 2023, or over a dead venue)`;\n const pool = index.get(swap);\n if (!pool) return `step ${k + 1} crosses ${args.route[2 * k + 1]}, which is not in the pool allowlist`;\n if (pools.has(swap)) return `the route crosses ${args.route[2 * k + 1]} twice`;\n pools.add(swap);\n if (!pool.swapTypes.includes(type === 1n ? 1 : 2)) return `step ${k + 1} uses swap_type ${type}, which pool ${pool.name} does not allow`;\n if (row[3] !== BigInt(pool.poolType)) return `step ${k + 1} names pool_type ${row[3]}, not pool ${pool.name}'s ${pool.poolType}`;\n if (type === 2n && deployment.family === \"lite4\" && pool.poolType !== 10) return `step ${k + 1}: exchange_underlying is for stable-ng metapools on this router`;\n if (type === 2n && !underlyingAllowed(pool, index)) return `step ${k + 1}: exchange_underlying on pool ${pool.name} needs its base pool in the allowlist`;\n const list = type === 1n ? pool.coins : pool.underlying;\n if (!list) return `step ${k + 1}: pool ${pool.name} lists no underlying coins`;\n const i = row[0]!, j = row[1]!;\n if (i >= BigInt(list.length) || j >= BigInt(list.length) || i === j) return `step ${k + 1}: coin indexes ${i}/${j} are not two coins of pool ${pool.name}`;\n // i, j < list.length (≤ 8) here: Number() of the decimal string is exact.\n if (lc(list[Number(i.toString())]!) !== a || lc(list[Number(j.toString())]!) !== b) return `step ${k + 1}: pool ${pool.name}'s coins ${i}/${j} are not the hop's tokens`;\n if (deployment.family === \"ng5\" && row[4] !== BigInt(list.length)) return `step ${k + 1} names ${row[4]} coins, not pool ${pool.name}'s ${list.length}`;\n if (deployment.family === \"lite4\" && (a === eth || b === eth)) return `step ${k + 1}: this router does not pass the native coin to pools`;\n if (STABLE_POOL_TYPES.has(pool.poolType) && (i > 127n || j > 127n)) return `step ${k + 1}: coin index out of range`;\n } else if (type === 8n) {\n if (weth === zero) return \"this chain's router has no wrapped native\";\n if (swap !== weth) return `step ${k + 1} wraps through ${args.route[2 * k + 1]}, not the pinned wrapped native`;\n if (!((a === eth && b === weth) || (a === weth && b === eth))) return `step ${k + 1}: swap_type 8 is only native ↔ the pinned wrapped native here`;\n if (row.some((x, c) => c !== 2 && x !== 0n)) return `step ${k + 1}: a wrap carries no other swap params`;\n if (++wraps > 1) return \"the route wraps more than once\";\n } else if (type === 9n) {\n if (!v) return `swap_type 9 (ERC-4626) is not available on ${deployment.label}'s router ${deployment.version}`;\n if (swap !== lc(v.vault)) return `step ${k + 1}: ERC-4626 hop through ${args.route[2 * k + 1]}, not the pinned vault`;\n const deposit = row[0] === 0n && a === lc(v.asset) && b === lc(v.vault);\n const redeem = row[0] === 1n && a === lc(v.vault) && b === lc(v.asset);\n if (!deposit && !redeem) return `step ${k + 1}: the ERC-4626 hop is not a deposit of the vault's asset or a redeem of its shares`;\n if (row.some((x, c) => c > 0 && c !== 2 && x !== 0n)) return `step ${k + 1}: an ERC-4626 hop carries no other swap params`;\n if (++vaults > 1) return \"the route crosses the vault more than once\";\n } else {\n return `step ${k + 1} uses swap_type ${type}, which this module never builds`;\n }\n }\n if (pools.size > MAX_ROUTE_POOLS) return `the route crosses ${pools.size} pools, more than ${MAX_ROUTE_POOLS}`;\n if (pools.size === 0 && vaults === 0) return \"the route crosses no pool\";\n return null;\n}\n","import {redactUrls, timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport type RpcCall = {method: string; params: unknown[]};\n\n/** Largest JSON-RPC batch sent to one node (X Layer's public RPCs refuse more than 10). */\nexport const RPC_BATCH_MAX = 10;\n\n/** Pause before the endpoints are tried once more when the last one refused for its request rate. */\nexport const RPC_RATE_LIMIT_PAUSE_MS = 1_000;\n\n/**\n * A batch element's error that is still an answer about the call: the EVM ran it and stopped (a revert — geth's code 3 —\n * an invalid opcode, out of gas). Anything else says nothing about the call — a rate limit inside an HTTP-200 batch\n * (QuickNode's -32007 \"50/second request limit reached\"), a node fault — and the batch goes to the next endpoint.\n */\nexport function isExecutionError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n const {code, message} = error as {code?: unknown; message?: unknown};\n return code === 3 || (typeof message === \"string\" && /revert|invalid opcode|out of gas/i.test(message));\n}\n\n/** A refusal for the request rate: HTTP 429, or JSON-RPC -32005 / -32007 / 429, or a message naming a limit. */\nfunction isRateLimit(error: unknown): boolean {\n if (!error || typeof error !== \"object\") return false;\n const {code, message} = error as {code?: unknown; message?: unknown};\n return code === -32005 || code === -32007 || code === 429 || (typeof message === \"string\" && /rate|limit|too many/i.test(message));\n}\n\nconst errorText = (error: unknown): string => {\n const m = error && typeof error === \"object\" ? (error as {message?: unknown}).message : undefined;\n return redactUrls(typeof m === \"string\" ? m : JSON.stringify(error) ?? String(error)).slice(0, 160);\n};\n\n/**\n * JSON-RPC over the caller's endpoints for one chain: batches of at most {@link RPC_BATCH_MAX} calls, each batch tried\n * on the endpoints in order until one answers every call (once more after {@link RPC_RATE_LIMIT_PAUSE_MS} when the last\n * refusal was for the request rate). Each slot is the result, or null when that call reverted — a revert is an answer,\n * not a dead endpoint. An element error that is not an execution error, or a call left unanswered, fails the endpoint:\n * a rate-limited read is never returned as a missing code or coin.\n */\nexport function rpcClient(rpcUrls: Readonly<Record<number, readonly string[]>>) {\n async function once(url: string, calls: RpcCall[], signal?: AbortSignal): Promise<(unknown | null)[]> {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\"content-type\": \"application/json\"},\n body: JSON.stringify(calls.map((c, id) => ({jsonrpc: \"2.0\", id, ...c}))),\n signal: signal ?? timeoutSignal(12_000),\n });\n if (!res.ok) throw Object.assign(new Error(`HTTP ${res.status}`), {limited: res.status === 429});\n const body = (await res.json()) as {id: number; result?: unknown; error?: unknown}[] | {error?: {message?: string}};\n if (!Array.isArray(body)) throw Object.assign(new Error(body.error?.message ?? \"batch refused\"), {limited: isRateLimit(body.error)});\n const out: (unknown | null)[] = calls.map(() => null);\n const answered = new Set<number>();\n for (const r of body) {\n if (typeof r.id !== \"number\" || r.id < 0 || r.id >= out.length) continue;\n if (r.error !== undefined && r.error !== null && !isExecutionError(r.error)) throw Object.assign(new Error(errorText(r.error)), {limited: isRateLimit(r.error)});\n answered.add(r.id);\n if (r.error === undefined || r.error === null) out[r.id] = r.result ?? null;\n }\n if (answered.size !== calls.length) throw new Error(`answered ${answered.size} of ${calls.length} calls`);\n return out;\n }\n\n async function batch(chainId: number, calls: RpcCall[], signal?: AbortSignal): Promise<(unknown | null)[]> {\n let lastErr: unknown;\n for (let pass = 0; pass < 2; pass++) {\n if (pass > 0) {\n if (!(lastErr as {limited?: boolean} | undefined)?.limited || signal?.aborted) break;\n await new Promise((r) => setTimeout(r, RPC_RATE_LIMIT_PAUSE_MS));\n }\n for (const url of rpcUrls[chainId] ?? []) {\n try {\n return await once(url, calls, signal);\n } catch (e) {\n lastErr = e;\n }\n }\n }\n throw new Error(`curve: no RPC answered on chain ${chainId} (${lastErr instanceof Error ? lastErr.message : String(lastErr)})`);\n }\n return async function rpc(chainId: number, calls: RpcCall[], signal?: AbortSignal): Promise<(unknown | null)[]> {\n if (calls.length <= RPC_BATCH_MAX) return batch(chainId, calls, signal);\n const chunks: RpcCall[][] = [];\n for (let i = 0; i < calls.length; i += RPC_BATCH_MAX) chunks.push(calls.slice(i, i + RPC_BATCH_MAX));\n return (await Promise.all(chunks.map((c) => batch(chainId, c, signal)))).flat();\n };\n}\n\nexport const ethCall = (to: string, data: string): RpcCall => ({method: \"eth_call\", params: [{to, data}, \"latest\"]});\n\n/** The first 32-byte ABI word of a return (whole words, at least one) as 64 lowercase hex, or null. */\nfunction firstWord(raw: unknown): string | null {\n return typeof raw === \"string\" && raw.length >= 66 && /^0x(?:[0-9a-fA-F]{64})+$/.test(raw) ? raw.slice(2, 66).toLowerCase() : null;\n}\n\n/**\n * A return whose first ABI word holds an address → the address (lowercase), or null when the word's upper 12 bytes are\n * not zero. Only the first word is read: the Liquity factory metapool answers `coins(i)` with 4096 bytes.\n */\nexport function wordAddress(raw: unknown): string | null {\n const w = firstWord(raw);\n return w !== null && /^0{24}/.test(w) ? `0x${w.slice(24)}` : null;\n}\n\n/** A return's first ABI word → uint256, or null. */\nexport function wordUint(raw: unknown): bigint | null {\n const w = firstWord(raw);\n return w === null ? null : BigInt(`0x${w}`);\n}\n","import {bigintToNumber} from \"@anywalletkit/core\";\nimport {ccAssetByToken} from \"@anywalletkit/swap2-assets\";\nimport {suggestSlippage} from \"@anywalletkit/protocol-swap2-core/slippage\";\nimport {sourceAssetOf} from \"@anywalletkit/protocol-swap2-core/util\";\nimport type {QuoteParams} from \"@anywalletkit/protocol-swap2-core/types\";\n\n/**\n * The route's price impact in bps: a probe 1/1000 the size on the same route gives the marginal rate; the full-size\n * rate's shortfall against it is the impact (pool fees are paid on both sides and cancel). Undefined without a probe.\n */\nexport function curveImpactBps(amountIn: bigint, out: bigint, probeOut: bigint | null | undefined): number | undefined {\n const probeIn = amountIn / 1000n;\n if (probeIn <= 0n || probeOut === null || probeOut === undefined || probeOut <= 0n) return undefined;\n const ratioBps = (out * probeIn * 10_000n) / (probeOut * amountIn);\n return Math.max(0, bigintToNumber(10_000n - ratioBps));\n}\n\n/**\n * Slippage when the caller names none: `suggestSlippage` from swap2-core for the pair (catalog symbols) and the route's\n * price impact — stable ↔ stable 10 bps, majors 50, others 100, plus half the impact. The provider sizes its minimum\n * with it, and `curveRemotePins` re-derives it on the device to bound a remote build's minimum.\n */\nexport function curveAutoSlippageBps(params: QuoteParams, priceImpactBps: number | undefined): number {\n const nativeOut = /^0x0+$/.test(params.destToken);\n return suggestSlippage({\n fromChain: params.sourceChain,\n toChain: params.destChain,\n fromSymbol: sourceAssetOf(params)?.symbol ?? \"\",\n toSymbol: ccAssetByToken(params.destChain, nativeOut ? \"\" : params.destToken)?.symbol ?? \"\",\n ...(priceImpactBps !== undefined ? {priceImpactBps} : {}),\n }).bps;\n}\n","/** `curve:<chainId>:<16 hex>`, and on the wire of a swap2 server `~<32 hex>` (its intent token) after it. */\nconst INTENT_ID = /^curve:([1-9][0-9]{0,15}):[0-9a-f]{16}(?:~[0-9a-f]{32})?$/;\n\n/** A fresh Curve intent id for a quote on `chainId`: one per quote, so a remote stub never checks a build against another request. */\nexport function mintCurveIntentId(chainId: number): string {\n const nonce = globalThis.crypto.getRandomValues(new Uint8Array(8));\n return `curve:${chainId}:${Array.from(nonce, (b) => b.toString(16).padStart(2, \"0\")).join(\"\")}`;\n}\n\n/** The chain a Curve intent id names (its on-chain checks and receipt tracking run there), or null. */\nexport function curveIntentChain(intentId: unknown): number | null {\n const m = typeof intentId === \"string\" ? INTENT_ID.exec(intentId) : null;\n const id = m ? Number(m[1]) : NaN;\n return Number.isSafeInteger(id) ? id : null;\n}\n","import {decodeFunctionResult, encodeFunctionData, keccak256, type Hex as ViemHex} from \"viem\";\nimport {sourceAssetOf} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {slippageFloor} from \"@anywalletkit/protocol-swap2-core/validate\";\nimport type {Quote, QuoteParams, RemotePins, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {ADDRESS_PROVIDER_ABI, COINS_INT, COINS_UINT, EXCHANGE_SELECTOR, VERSION_ABI, decodeExchange, encodeGetDy, type DecodedExchange} from \"./abi.js\";\nimport {CURVE_DEPLOYMENTS, ZERO_ADDRESS, chainIdOf, deploymentOf, type CurveDeployment} from \"./deployments.js\";\nimport {CURVE_POOLS} from \"./pools/index.js\";\nimport type {CurveChainPools, CurvePool, Hex} from \"./pools/types.js\";\nimport {checkRoute, poolIndex, routePools} from \"./routes.js\";\nimport {ethCall, rpcClient, wordAddress, wordUint, type RpcCall} from \"./rpc.js\";\nimport {curveIntentChain} from \"./intent.js\";\nimport {curveAutoSlippageBps, curveImpactBps} from \"./slippage.js\";\n\nexport interface CurveTables {\n /** Override the deployments (tests). */\n deployments?: Readonly<Record<number, CurveDeployment>>;\n /** Override the pool allowlist (tests). */\n pools?: Readonly<Record<number, CurveChainPools>>;\n}\n\nconst lc = (a: string) => a.toLowerCase();\nconst isAddress = (a: string) => /^0x[0-9a-fA-F]{40}$/.test(a);\nconst own = <T>(o: Readonly<Record<number, T>>, k: number): T | undefined => (Object.prototype.hasOwnProperty.call(o, k) ? o[k] : undefined);\n\n/**\n * The check of a Curve quote's router call against the app's own request, with the tables it uses. The returned\n * function is {@link curveVerifyQuote} for the shipped tables: synchronous, no I/O — the allowlist is static.\n */\nexport function curveQuoteCheck(tables: CurveTables = {}): (params: QuoteParams, quote: Quote) => string | null {\n const deployments = tables.deployments ?? CURVE_DEPLOYMENTS;\n const pools = tables.pools ?? CURVE_POOLS;\n return function verify(params: QuoteParams, quote: Quote): string | null {\n const chainId = chainIdOf(params.sourceChain);\n const d = deploymentOf(deployments, chainId);\n if (!d || params.destChain !== params.sourceChain) return \"not a same-chain swap on a pinned Curve router\";\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return \"the quote carries no router call\";\n if (!isAddress(tx.to) || lc(tx.to) !== lc(d.router)) return `the call targets ${tx.to}, not the Curve router`;\n if (tx.chainId !== undefined && tx.chainId !== chainId) return `the call is for chain ${tx.chainId}`;\n // The chain the build's on-chain checks and the receipt tracking run on (`curve:<chainId>:…`): this request's.\n if (curveIntentChain(quote.intentId) !== chainId) return `the quote names ${String(quote.intentId).slice(0, 40)}, not a curve:${chainId} swap`;\n const src = sourceAssetOf(params);\n if (!src) return `unknown source token ${params.sourceToken}`;\n const nativeIn = !src.contract;\n const nativeOut = /^0x0+$/.test(params.destToken);\n if (!nativeOut && !isAddress(params.destToken)) return \"destination token must be an EVM address\";\n if (!isAddress(params.destAddress)) return \"recipient must be an EVM address\";\n if ((!nativeIn && lc(src.contract!) === lc(d.eth)) || (!nativeOut && lc(params.destToken) === lc(d.eth))) return \"the router's native sentinel is not a token\";\n const tokenIn = nativeIn ? d.eth : src.contract!;\n const tokenOut = nativeOut ? d.eth : params.destToken;\n let amountIn: bigint, minOut: bigint, value: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n minOut = BigInt(quote.minDestAmount);\n value = BigInt(tx.value ?? \"0\");\n } catch {\n return \"the request does not name amounts\";\n }\n if (nativeIn ? value !== amountIn || tx.approvalAddress !== undefined\n : value !== 0n || !tx.approvalAddress || !isAddress(tx.approvalAddress) || lc(tx.approvalAddress) !== lc(d.router)) {\n return nativeIn ? \"a native input is paid as exactly the input in value, with no approval\" : \"a token input attaches no value and approves exactly the Curve router\";\n }\n const call = decodeExchange(d.family, tx.data);\n if (!call) return \"the router call is not exchange(route, params, amount, min, receiver)\";\n if (call.selector !== EXCHANGE_SELECTOR[d.family]) return `selector ${call.selector} is not the explicit-receiver exchange ${EXCHANGE_SELECTOR[d.family]}`;\n if (!call.receiver || lc(call.receiver) !== lc(params.destAddress)) return `the swap pays ${call.receiver ?? \"the sender\"}, not the recipient`;\n if (call.pools && call.pools.some((p) => lc(p) !== lc(ZERO_ADDRESS))) return \"the call names zap pools this module never uses\";\n if (call.amount !== amountIn) return `the swap sells ${call.amount}, not the ${amountIn} input`;\n if (call.minDy <= 0n) return \"the swap has no minimum (min_dy 0)\";\n if (call.minDy !== minOut) return `the swap's minimum ${call.minDy} is not the quote's ${minOut}`;\n if (quote.providerData?.minOut !== undefined && quote.providerData.minOut !== minOut.toString()) return \"the quote's facts disagree on the minimum\";\n return checkRoute(chainId, d, own(pools, chainId), call, tokenIn, tokenOut);\n };\n}\n\n/**\n * The swap a Curve quote's router call makes, opened on the client against the app's own request: the explicit-receiver\n * `exchange` on the chain's pinned Router NG (`0xc872a3c5` on `[5][5]` routers, `0xfd44959c` on `[4][5]`), selling\n * exactly the input of the source token (the router's native sentinel for a native input, paid as exactly that\n * `value`; a token input attaches no value and approves exactly the router), for the destination token, with\n * `min_dy` the quote's minimum (never 0), paid to the recipient, no zap pools, and a route that `checkRoute` accepts:\n * allowlisted pools only, their pinned coins, swap types 1/2 (8 through the pinned wrapped native, 9 only on router\n * v1.2 through scrvUSD). The reason it fails, or null.\n */\nexport const curveVerifyQuote: (params: QuoteParams, quote: Quote) => string | null = curveQuoteCheck();\n\n/**\n * The Router NG a Curve swap calls and approves on a chain (the shipped {@link CURVE_DEPLOYMENTS} table), and\n * {@link curveVerifyQuote} — the app's pins for `remoteProvider({name: \"curve\", baseUrl, ...curvePins})`. For the build\n * checked on chain as well (router code hash, fresh `get_dy`, pool coins), use {@link curveRemotePins}.\n */\nexport const curvePins: RemotePins = Object.freeze({\n callTargets: (chain: string): readonly string[] => routerFor(CURVE_DEPLOYMENTS, chain),\n spenders: (chain: string): readonly string[] => routerFor(CURVE_DEPLOYMENTS, chain),\n verifyQuote: curveVerifyQuote,\n});\n\nfunction routerFor(deployments: Readonly<Record<number, CurveDeployment>>, chain: string): readonly string[] {\n const d = deploymentOf(deployments, chainIdOf(chain));\n return d ? [d.router] : [];\n}\n\nexport interface CurveOnChainOptions extends CurveTables {\n rpcUrls: Readonly<Record<number, readonly string[]>>;\n /** Told when the chain's AddressProvider lists another router than the pinned one (never acted on). Default console.warn. */\n onWarning?: (message: string) => void;\n}\n\n/**\n * On-chain checks shared by the provider and {@link curveRemotePins}: the pinned router's code hash and version (once\n * per chain; the AddressProvider's id 2 only compared), and a sealed quote re-checked right before broadcast.\n */\nexport function curveOnChain(opts: CurveOnChainOptions) {\n const deployments = opts.deployments ?? CURVE_DEPLOYMENTS;\n const pools = opts.pools ?? CURVE_POOLS;\n const rpc = rpcClient(opts.rpcUrls);\n const warn = opts.onWarning ?? ((m: string) => console.warn(m));\n const verified = new Map<number, Promise<void>>();\n\n /** The pinned router is still the code we pinned, at the version we pinned. */\n function verifyDeployment(chainId: number): Promise<void> {\n let p = verified.get(chainId);\n if (!p) {\n const d = deploymentOf(deployments, chainId);\n p = (async () => {\n if (!d) throw new Error(`curve: no pinned router on chain ${chainId}`);\n const [code, version, listed] = await rpc(chainId, [\n {method: \"eth_getCode\", params: [d.router, \"latest\"]},\n ethCall(d.router, encodeFunctionData({abi: VERSION_ABI, functionName: \"version\"})),\n ethCall(d.addressProvider, encodeFunctionData({abi: ADDRESS_PROVIDER_ABI, functionName: \"get_address\", args: [2n]})),\n ]);\n if (typeof code !== \"string\" || code.length <= 2 || lc(keccak256(code as ViemHex)) !== lc(d.codeHash)) {\n throw new Error(`curve: the router on chain ${chainId} is not the pinned code (code hash mismatch) — refusing`);\n }\n let v = \"\";\n try { v = typeof version === \"string\" ? decodeFunctionResult({abi: VERSION_ABI, functionName: \"version\", data: version as ViemHex}) : \"\"; } catch { /* below */ }\n if (v !== d.version) throw new Error(`curve: the router on chain ${chainId} reports version ${v || \"none\"}, not ${d.version} — refusing`);\n // The AddressProvider is informational (its admin may change any id): a different id 2 is a signal for the\n // module watch, never a router to use.\n const ap = wordAddress(listed);\n if (ap && ap !== lc(d.addressProviderRouter) && ap !== lc(d.router)) {\n warn(`curve: the AddressProvider on ${d.label} lists router ${ap} (id 2); this module keeps the pinned ${d.router}`);\n }\n })();\n p.catch(() => verified.delete(chainId));\n verified.set(chainId, p);\n }\n return p;\n }\n\n /**\n * A sealed quote right before broadcast (or a remote build on the client): the transaction is byte for byte the\n * quote's router call, the route passes `checkRoute`, the router was verified as the pinned code and version (once\n * per chain per process — it is immutable), every hop pool still has its pinned code and coins (re-read each time),\n * and a fresh `get_dy` of that exact route still pays at least the minimum. The reason it fails, or null.\n */\n async function checkSealed(quote: Quote, tx: UnsignedTx): Promise<string | null> {\n const r = await inspectSealed(quote, tx, false);\n return typeof r === \"string\" ? r : null;\n }\n\n /**\n * {@link checkSealed}, and what it read when it passes: the fresh `get_dy` of the exact route at the sealed amount,\n * the call's minimum and, with `probe`, the same route at 1/1000 of the amount (null when it reverts).\n */\n async function inspectSealed(quote: Quote, tx: UnsignedTx, probe: boolean): Promise<string | {out: bigint; probeOut: bigint | null; amount: bigint; minDy: bigint}> {\n const chainId = curveIntentChain(quote.intentId);\n const d = chainId === null ? undefined : deploymentOf(deployments, chainId);\n if (chainId === null || !d) return \"the quote is not a Curve swap on a pinned chain\";\n const quoted = quote.txRequest;\n if (!quoted?.data || !quoted.to || !tx.data) return \"the quote or the transaction carries no router call\";\n if (tx.data.length !== quoted.data.length || lc(tx.data) !== lc(quoted.data)) return \"the transaction is not the quoted router call\";\n if (!isAddress(tx.to) || lc(tx.to) !== lc(d.router) || lc(quoted.to) !== lc(d.router)) return `the transaction calls ${tx.to}, not the Curve router`;\n if ((tx.value ?? \"0\") !== (quoted.value ?? \"0\")) return \"the transaction's value is not the quote's\";\n if ((tx.chainId !== undefined && tx.chainId !== chainId) || (quoted.chainId !== undefined && quoted.chainId !== chainId)) return `the transaction is not for chain ${chainId}`;\n if ((tx.approvalAddress ?? \"\").toLowerCase() !== (quoted.approvalAddress ?? \"\").toLowerCase()) return \"the transaction's approval is not the quote's\";\n const call = decodeExchange(d.family, quoted.data);\n if (!call || call.selector !== EXCHANGE_SELECTOR[d.family]) return \"the quoted call is not the explicit-receiver exchange\";\n if (call.minDy <= 0n) return \"the swap has no minimum (min_dy 0)\";\n const last = lastToken(call);\n const reason = checkRoute(chainId, d, own(pools, chainId), call, call.route[0]!, last);\n if (reason) return reason;\n await verifyDeployment(chainId);\n const index = poolIndex(chainId, d, own(pools, chainId));\n const hops = routePools(call).map((a) => index.get(lc(a))!);\n const reads = poolCalls(hops);\n const calls: RpcCall[] = [ethCall(d.router, encodeGetDy(d.family, call, call.amount)), ...reads];\n const probeIn = call.amount / 1000n;\n const probeAt = calls.length;\n if (probe && probeIn > 0n) calls.push(ethCall(d.router, encodeGetDy(d.family, call, probeIn)));\n const res = await rpc(chainId, calls);\n const poolReason = await poolsReason(chainId, hops, res.slice(1, 1 + reads.length));\n if (poolReason) return poolReason;\n const out = wordUint(res[0]);\n if (out === null) return \"the router no longer quotes this route\";\n if (out < call.minDy) return `price moved — the pools now pay ${out}, under your minimum ${call.minDy}`;\n return {out, probeOut: probe && probeIn > 0n ? wordUint(res[probeAt]) : null, amount: call.amount, minDy: call.minDy};\n }\n\n /** Per pool: its code, then `coins(uint256)` for each pinned coin. */\n function poolCalls(list: readonly CurvePool[]): RpcCall[] {\n return list.flatMap((pool) => [\n {method: \"eth_getCode\", params: [pool.address, \"latest\"]},\n ...pool.coins.map((_, k) => ethCall(pool.address, `${COINS_UINT}${k.toString(16).padStart(64, \"0\")}`)),\n ]);\n }\n\n /** The answers to {@link poolCalls} held to the pins (`coins(int128)` asked where `coins(uint256)` reverts). */\n async function poolsReason(chainId: number, list: readonly CurvePool[], res: readonly unknown[]): Promise<string | null> {\n let at = 0;\n const retry: {pool: CurvePool; k: number}[] = [];\n for (const pool of list) {\n const code = res[at++];\n // eth_getCode does not revert: no string means the read itself failed, which says nothing about the pool.\n if (typeof code !== \"string\") return `could not read pool ${pool.name} (${pool.address}) over RPC`;\n if (code.length <= 2 || lc(keccak256(code as ViemHex)) !== lc(pool.codeHash)) return `pool ${pool.name} (${pool.address}) is not the pinned code`;\n for (let k = 0; k < pool.coins.length; k++) {\n const coin = wordAddress(res[at++]);\n if (coin === null) retry.push({pool, k});\n else if (coin !== lc(pool.coins[k]!)) return `pool ${pool.name} now reports coin ${k} = ${coin}, not the pinned ${pool.coins[k]}`;\n }\n }\n if (retry.length) {\n // The oldest stable pools take coins(int128).\n const again = await rpc(chainId, retry.map(({pool, k}) => ethCall(pool.address, `${COINS_INT}${k.toString(16).padStart(64, \"0\")}`)));\n for (const [n, {pool, k}] of retry.entries()) {\n const coin = wordAddress(again[n]);\n if (coin !== lc(pool.coins[k]!)) return `pool ${pool.name} does not report its pinned coin ${k}`;\n }\n }\n return null;\n }\n\n /**\n * Allowlisted pools as a sealed quote's preflight reads them, without a route: each still has its pinned code and\n * coins. The reason the first one fails, or null (a failed read throws). For live checks over a whole allowlist.\n */\n async function checkPools(chainId: number, list: readonly CurvePool[]): Promise<string | null> {\n return list.length ? poolsReason(chainId, list, await rpc(chainId, poolCalls(list))) : null;\n }\n\n return {rpc, verifyDeployment, checkSealed, inspectSealed, checkPools};\n}\n\nfunction lastToken(call: DecodedExchange): Hex {\n let k = 0;\n while (k < 5 && lc(call.route[2 * k + 1]!) !== lc(ZERO_ADDRESS)) k++;\n return call.route[2 * k]!;\n}\n\n/**\n * How far the device's own auto slippage may sit under the backend's before a remote build's minimum counts as too low:\n * the backend sized it from its probe at quote time, the device from a fresh one, and half the impact moves it.\n */\nexport const CURVE_AUTO_SLIPPAGE_DRIFT_BPS = 5;\n\nexport interface CurveRemotePinsOptions extends CurveOnChainOptions {\n /** The backend provider's `defaultSlippageBps`, when it sets one (a build's minimum is bounded by it). Default: auto slippage. */\n defaultSlippageBps?: number;\n}\n\n/**\n * {@link curvePins} plus `verifyBuild`: a remote Curve build checked on the client — {@link curveVerifyQuote} on the\n * request it answered, then on chain (over the app's own RPCs) the pinned router (code and version, once per chain),\n * each hop pool's pinned code and coins, and a fresh `get_dy` of the exact route at or above the minimum. The quote's\n * figures are then held to that fresh `get_dy` (§5.3 C9: the minimum is the device's own): `destAmount` no more than the\n * slippage above it, and `min_dy` no more than the slippage below it (or below `destAmount`, if lower) — the request's\n * `slippageBps`, else `defaultSlippageBps`, else the provider's auto slippage re-derived here from a fresh 1/1000 probe\n * (plus {@link CURVE_AUTO_SLIPPAGE_DRIFT_BPS}). A backend naming `min_dy = 1` or an inflated output is refused.\n * `remoteProvider({name: \"curve\", baseUrl, ...curveRemotePins({rpcUrls})})`.\n */\nexport function curveRemotePins(opts: CurveRemotePinsOptions): RemotePins & {verifyBuild(quote: Quote, tx: UnsignedTx, params?: QuoteParams): Promise<string | null>} {\n const deployments = opts.deployments ?? CURVE_DEPLOYMENTS;\n const fixedSlippage = opts.defaultSlippageBps;\n if (fixedSlippage !== undefined && (!Number.isInteger(fixedSlippage) || fixedSlippage <= 0 || fixedSlippage >= 5_000)) throw new Error(\"curve: defaultSlippageBps must be 1..4999\");\n const verifyQuote = curveQuoteCheck(opts);\n const chain = curveOnChain(opts);\n return Object.freeze({\n callTargets: (c: string): readonly string[] => routerFor(deployments, c),\n spenders: (c: string): readonly string[] => routerFor(deployments, c),\n verifyQuote,\n async verifyBuild(quote: Quote, tx: UnsignedTx, params?: QuoteParams): Promise<string | null> {\n if (!params) return \"the request this quote answered is unknown\";\n const reason = verifyQuote(params, quote);\n if (reason) return reason;\n try {\n const auto = params.slippageBps === undefined && fixedSlippage === undefined;\n const seen = await chain.inspectSealed(quote, tx, auto);\n if (typeof seen === \"string\") return seen;\n const {out, probeOut, amount, minDy} = seen;\n let dest: bigint;\n try { dest = BigInt(quote.destAmount); } catch { return \"the quote names no output\"; }\n const bps = params.slippageBps ?? fixedSlippage ?? Math.min(9_999, curveAutoSlippageBps(params, curveImpactBps(amount, out, probeOut)) + CURVE_AUTO_SLIPPAGE_DRIFT_BPS);\n if (slippageFloor(dest, bps) > out) return `the quote promises ${dest}, more than ${bps} bps above the ${out} the pools pay now`;\n const fresh = dest < out ? dest : out;\n if (minDy < slippageFloor(fresh, bps)) return `the swap's minimum ${minDy} is more than ${bps} bps under the ${fresh} the pools pay now`;\n return null;\n } catch (e) {\n return e instanceof Error ? e.message.replace(/^curve: /, \"\") : String(e);\n }\n },\n });\n}\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAQ,cAAAA,mBAAiB;AACzB,SAAQ,QAAQ,OAAO,iBAAAC,sBAAoB;;;ACMpC,IAAM,UAA2B;AAAA,EACtC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,IACL,EAAE,SAAS,8CAA8C,MAAM,0BAA0B,OAAO,CAAC,8CAA8C,8CAA8C,4CAA4C,GAAG,UAAU,CAAC,IAAI,GAAG,CAAC,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,GAAG,UAAU,sEAAsE,QAAQ,WAAW,WAAW,WAAW;AAAA,IACxZ,EAAE,SAAS,8CAA8C,MAAM,sBAAsB,OAAO,CAAC,8CAA8C,4CAA4C,GAAG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