Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.
Many protocols deploy one contract per market: a DEX factory creates a pool per token pair, a
lending protocol a vault per asset. To index their events you need the list of child contracts,
and the list keeps growing.The pattern:
Read the factory’s creation events to learn the child addresses.
The factory emits PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool).
The pool’s address is the last 32-byte word of data. With the Python client:
from bloklake import Bloklakebl = Bloklake(chain="eth")FACTORY = "0x1f98431c8ad98523631ae4a59f267346ea31f984" # Uniswap V3POOL_CREATED = "0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118"SWAP = "0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67"def new_pools(frm: int, to: int) -> list[str]: page = bl.collect({"from_block": frm, "to_block": to, "logs": [{"address": [FACTORY], "topic0": [POOL_CREATED]}], "fields": {"log": ["data"]}}) return ["0x" + log["data"][-40:] for log in page.logs] # the pool: last 20 bytes of data
Persist pools (or rebuild it by re-reading PoolCreated from the start; it’s a small query)
and the block you reached. Then create the set again (same values, same id) and continue.
If you only need recent history, filtering on the event alone can be simpler: topic0 = Swap
without an address matches the swaps of every Uniswap V3 pool, plus any other contract that
emits an identical event. Keep address in the output and drop unknown ones client-side.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Bloklake","description":"Historical blockchain data over HTTP: filter logs, transactions and blocks across any block range and get them back as Apache Arrow or JSON.","colors":{"primary":"#155DFC","light":"#5B8DEF","dark":"#155DFC"},"logo":{"light":"https://mintcdn.com/my-company-7009db77/AEOzPZjunXHOKyLs/logo/light.svg?fit=max\u0026auto=format\u0026n=AEOzPZjunXHOKyLs\u0026q=85\u0026s=e35836064fc974b118e53f0b9fab7ed5","dark":"https://mintcdn.com/my-company-7009db77/AEOzPZjunXHOKyLs/logo/dark.svg?fit=max\u0026auto=format\u0026n=AEOzPZjunXHOKyLs\u0026q=85\u0026s=ba4d4816883fd716d501f7a04392fa60"},"favicon":"https://mintcdn.com/my-company-7009db77/AEOzPZjunXHOKyLs/favicon.svg?fit=max\u0026auto=format\u0026n=AEOzPZjunXHOKyLs\u0026q=85\u0026s=08187e2c7d019c8676cdf87e91fd19cd","navbar":{"links":[{"href":"mailto:[email protected]","label":"Support"}],"primary":{"type":"button","label":"Get an API key","href":"https://dashboard.bloklake.com"}},"footer":{"links":[{"header":"Bloklake","items":[{"label":"Dashboard","href":"https://dashboard.bloklake.com"},{"label":"Pricing","href":"/billing/pricing"},{"label":"Support","href":"mailto:[email protected]"}]}]},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Dashboard","icon":"gauge","href":"https://dashboard.bloklake.com"},{"anchor":"Chain status","icon":"signal","href":"https://dashboard.bloklake.com/chains"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"my-company-7009db77","hasAudioNarration":false,"actualSubdomain":"my-company-7009db77","customDomains":["docs.bloklake.com"],"gitSource":{"type":"github","owner":"nikbhintade","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"chroma":{"latestBuiltDeploymentHistoryId":"6ae20e8160416b77ca6b9f99","collectionId":"2fdf09bf-4255-43cb-83dd-8f44c820bec3","liveDeploymentHistoryId":"6ae20e8160416b77ca6b9f99","schemaVersion":"v3"},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6ae20e8160416b77ca6b9f99","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"Documentation","count":43},{"language":"default","tag":"API reference","count":14},{"language":"default","tag":"Querying","count":12},{"language":"default","tag":"Guides","count":7},{"language":"default","tag":"Billing","count":6},{"language":"default","tag":"Production","count":5},{"language":"default","tag":"Responses","count":5},{"language":"default","tag":"Sets and prepared queries","count":4},{"language":"default","tag":"Get started","count":4},{"language":"default","tag":"Account","count":3}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"guides/factory-contracts","slug":"/guides/factory-contracts","pageMetadata":{"title":"Factory contracts","description":"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.","href":"/guides/factory-contracts"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Many protocols deploy one contract per market: a DEX factory creates a pool per token pair, a\nlending protocol a vault per asset. To index their events you need the list of child contracts,\nand the list keeps growing.`}),`\n`,_jsx(_components.p,{children:`The pattern:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Read the factory’s creation events to learn the child addresses.`}),`\n`,_jsxs(_components.li,{children:[`Put the children in a `,_jsx(_components.a,{href:`/querying/sets`,children:`set`}),`.`]}),`\n`,_jsx(_components.li,{children:`Read the children’s events with that set.`}),`\n`,_jsxs(_components.li,{children:[`As new children appear, create a bigger set with `,_jsx(_components.code,{children:`basedOn`}),` pointing at the previous one.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`example-uniswap-v3-pools`,children:`Example: Uniswap V3 pools`}),`\n`,_jsxs(_components.p,{children:[`The factory emits `,_jsx(_components.code,{children:`PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)`}),`.\nThe pool’s address is the last 32-byte word of `,_jsx(_components.code,{children:`data`}),`. With the `,_jsx(_components.a,{href:`/clients`,children:`Python client`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bloklake `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Bloklake`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`bl `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Bloklake(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`chain`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"eth\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`FACTORY`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0x1f98431c8ad98523631ae4a59f267346ea31f984\"`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # Uniswap V3`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`POOL_CREATED`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`SWAP`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` new_pools`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`frm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`to`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> list[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` page `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bl.collect({`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"from_block\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: frm, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"to_block\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: to,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"logs\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"address\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`FACTORY`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`], `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"topic0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`POOL_CREATED`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]}],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"fields\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"log\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]}})`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"0x\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` log[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`][`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`40`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` log `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` page.logs] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# the pool: last 20 bytes of data`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`backfill`,children:`Backfill`}),`\n`,_jsx(_components.p,{children:`Walk the chain in chunks. In each chunk, first learn the pools created in it, then read swaps\nof every pool known so far:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`START`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`END`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`CHUNK`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 12369621`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`21000000`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`200_000`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` # factory deployment … head`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`pools: list[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` []`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`set_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`frm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` START`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`while`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` frm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` END`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` min`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(frm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` CHUNK`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` -`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`END`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` created `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` new_pools(frm, to)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` created:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pools `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` created`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` set_id `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bl.create_set(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"address\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, pools, `}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`based_on`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`set_id).set_id `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# grow the set`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` set_id:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` page `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`in`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bl.paginate({`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"from_block\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: frm, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"to_block\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: to,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"logs\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"address_set\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: set_id, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"topic0\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`SWAP`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]}],`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"fields\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"log\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"block_number\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"address\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"data\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]}}):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` store(page.logs)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` frm `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` to `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`+`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Reading the pools created in a chunk `,_jsx(_components.strong,{children:`before`}),` that chunk’s swaps matters: a pool can be\ncreated and swapped in within the same chunk.`]}),`\n`,_jsxs(Heading,{level:`2`,id:`why-sets-and-basedon`,children:[`Why sets and `,_jsx(_components.code,{children:`basedOn`})]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`The pool list grows to tens of thousands of addresses. As a set, it’s uploaded once per growth\nstep instead of on every request.`}),`\n`,_jsxs(_components.li,{children:[`With `,_jsx(_components.code,{children:`basedOn`}),`, the server works out where the new set’s addresses appear incrementally\ninstead of from scratch, so growing a large set stays fast.`]}),`\n`,_jsx(_components.li,{children:`A set’s id is a hash of its values. Re-creating the same set after a restart returns the same\nid, so restarts need no bookkeeping.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`restarting`,children:`Restarting`}),`\n`,_jsxs(_components.p,{children:[`Persist `,_jsx(_components.code,{children:`pools`}),` (or rebuild it by re-reading `,_jsx(_components.code,{children:`PoolCreated`}),` from the start; it’s a small query)\nand the block you reached. Then create the set again (same values, same id) and continue.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`If you only need recent history, filtering on the event alone can be simpler: `,_jsx(_components.code,{children:`topic0 = Swap`}),`\nwithout an address matches the swaps of every Uniswap V3 pool, plus any other contract that\nemits an identical event. Keep `,_jsx(_components.code,{children:`address`}),` in the output and drop unknown ones client-side.`]})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Factory contracts","description":"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.","href":"/guides/factory-contracts"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Example: Uniswap V3 pools","slug":"example-uniswap-v3-pools","depth":2,"children":[{"title":"Backfill","slug":"backfill","depth":3,"children":[]}]},{"title":"Why sets and basedOn","slug":"why-sets-and-basedon","depth":2,"children":[]},{"title":"Restarting","slug":"restarting","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"my-company-7009db77","siteName":"Bloklake","title":"Factory contracts - Bloklake","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-28T15:02:43.607Z","originalFileLocation":"guides/factory-contracts.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Bloklake\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Factory contracts - Bloklake\">\u003cmeta data-mint-head property=\"og:description\" content=\"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Bloklake\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.bloklake.com/guides/factory-contracts\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://my-company-7009db77.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Factory+contracts\u0026amp;description=Index+contracts+a+factory+creates+over+time%2C+such+as+every+pool+of+a+DEX%2C+with+growing+sets.\u0026amp;theme=20a4be7d56b4aeb125dec394\u0026amp;signature=4566717e8d11c5b7931a25beb95f2056e754b85d73efeaae0ca451e4f42897dd\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Factory contracts - Bloklake\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://my-company-7009db77.mintlify.app/_mintlify/api/og/v2?division=Guides\u0026amp;title=Factory+contracts\u0026amp;description=Index+contracts+a+factory+creates+over+time%2C+such+as+every+pool+of+a+DEX%2C+with+growing+sets.\u0026amp;theme=20a4be7d56b4aeb125dec394\u0026amp;signature=4566717e8d11c5b7931a25beb95f2056e754b85d73efeaae0ca451e4f42897dd\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/my-company-7009db77/ZZq8wWyTTsLus1zT/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Bloklake\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#155DFC\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.bloklake.com/guides/factory-contracts\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/factory-contracts.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.bloklake.com/#organization\",\"name\":\"Bloklake\",\"url\":\"https://docs.bloklake.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/my-company-7009db77/AEOzPZjunXHOKyLs/logo/light.svg?fit=max\u0026auto=format\u0026n=AEOzPZjunXHOKyLs\u0026q=85\u0026s=e35836064fc974b118e53f0b9fab7ed5\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.bloklake.com#website\",\"name\":\"Bloklake\",\"url\":\"https://docs.bloklake.com\",\"publisher\":{\"@id\":\"https://docs.bloklake.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.bloklake.com/guides/factory-contracts#webpage\",\"url\":\"https://docs.bloklake.com/guides/factory-contracts\",\"name\":\"Factory contracts\",\"description\":\"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\",\"dateModified\":\"2026-10-28T15:02:43.607Z\",\"isPartOf\":{\"@id\":\"https://docs.bloklake.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.bloklake.com/guides/factory-contracts#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.bloklake.com/guides/factory-contracts#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.bloklake.com/guides/erc20-transfers\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Factory contracts\",\"item\":\"https://docs.bloklake.com/guides/factory-contracts\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.bloklake.com/guides/factory-contracts#article\",\"headline\":\"Factory contracts\",\"name\":\"Factory contracts\",\"description\":\"Index contracts a factory creates over time, such as every pool of a DEX, with growing sets.\",\"url\":\"https://docs.bloklake.com/guides/factory-contracts\",\"mainEntityOfPage\":{\"@id\":\"https://docs.bloklake.com/guides/factory-contracts#webpage\"},\"dateModified\":\"2026-10-28T15:02:43.607Z\",\"publisher\":{\"@id\":\"https://docs.bloklake.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.bloklake.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Bloklake\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Bloklake","nav":{"global":{"anchors":[{"anchor":"Dashboard","icon":"gauge","href":"https://dashboard.bloklake.com"},{"anchor":"Chain status","icon":"signal","href":"https://dashboard.bloklake.com/chains"}]},"tabs":[{"tab":"Documentation","groups":[{"group":"Get started","pages":[{"title":"Bloklake","mode":"wide","href":""},{"title":"Quickstart","href":"/quickstart"},{"title":"Client libraries","href":"/clients"},{"title":"Core concepts","href":"/concepts"}]},{"group":"Chains","pages":[{"title":"Chains","href":"/chains/overview"},{"title":"Ethereum","href":"/chains/ethereum"},{"title":"Robinhood Chain","href":"/chains/robinhood-chain"}]},{"group":"Querying","pages":[{"title":"Request body","href":"/querying/request-body"},{"title":"Filters","href":"/querying/filters"},{"title":"Selecting fields","href":"/querying/fields"},{"title":"Blocks","href":"/querying/blocks"},{"title":"Joining logs to transactions","href":"/querying/join-transactions"},{"title":"Pagination","href":"/querying/pagination"},{"title":"Sets","href":"/querying/sets"},{"title":"Prepared queries","href":"/querying/prepared-queries"},{"title":"Finality and reorgs","href":"/querying/finality-and-reorgs"},{"title":"Fields a chain doesn't have","href":"/querying/unavailable-fields"}]},{"group":"Responses","pages":[{"title":"Arrow vs JSON","href":"/responses/arrow-vs-json"},{"title":"Reading Arrow","href":"/responses/reading-arrow"},{"title":"The JSON format","href":"/responses/json"},{"title":"Response metadata","href":"/responses/metadata"},{"title":"Data types","href":"/responses/data-types"}]},{"group":"Guides","pages":[{"title":"Index ERC-20 transfers","href":"/guides/erc20-transfers"},{"title":"Wallet activity","description":"Everything a set of wallets sent and received: transactions and token transfers, in one request.","href":"/guides/wallet-activity"},{"title":"Factory contracts","href":"/guides/factory-contracts"},{"title":"Following the head","description":"Keep a dataset up to date as new blocks arrive, correctly through reorgs, without wasting requests.","href":"/guides/follow-the-head"},{"title":"Decoding logs","href":"/guides/decode-logs"},{"title":"Export to Parquet and DuckDB","href":"/guides/export-to-parquet"},{"title":"Sampling blocks","href":"/guides/sampling-blocks"}]},{"group":"Account","pages":[{"title":"Projects and the dashboard","href":"/account/projects"},{"title":"API keys","href":"/account/api-keys"},{"title":"Team and roles","href":"/account/team"}]},{"group":"Billing","pages":[{"title":"Pricing","href":"/billing/pricing"},{"title":"How billing works","href":"/billing/how-billing-works"},{"title":"Estimating costs","href":"/billing/estimating-costs"},{"title":"Pay-as-you-go","href":"/billing/pay-as-you-go"},{"title":"Subscriptions","href":"/billing/subscriptions"},{"title":"Statements and receipts","href":"/billing/statements-and-receipts"}]},{"group":"Production","pages":[{"title":"Production checklist","href":"/production/best-practices"},{"title":"Rate limits","href":"/production/rate-limits"},{"title":"Errors and retries","href":"/production/errors-and-retries"},{"title":"Limits","href":"/production/limits"},{"title":"Troubleshooting and FAQ","href":"/production/troubleshooting"}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Factory contracts - Bloklake","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":[],"chunks":[]}