BuildStateTwin
Read a pool's on-chain state once and return it as a serialized State Twin (JSON): the protocol-specific snapshot plus a content_hash, in the wire form a client rehydrates locally. Use this to pull a single managed-RPC twin, then run any number of counterfactuals (price moves, IL, slippage) client-side, off this server. Covers Uniswap V2/V3, Balancer 2-asset weighted, and Curve 2-asset plain stableswap pools. The endpoint stores and logs nothing — your rpc_url is never persisted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rpc_url | Yes | An Ethereum (or L2) JSON-RPC URL used to read live pool state. Required; supplied by you per call (BYO-RPC) and may carry your provider key. The endpoint stores and logs nothing — the URL is never persisted or written to logs. | |
| chain_id | No | Optional guard. If supplied and the RPC reports a different chain id, the call is rejected. Omit to skip the check. | |
| lwr_tick | No | uniswap_v3 only — lower tick of the position range to snapshot. Omit for the pool's full active-liquidity range. Ignored for other pool types. | |
| upr_tick | No | uniswap_v3 only — upper tick of the position range to snapshot. Omit for the pool's full active-liquidity range. Ignored for other pool types. | |
| pool_type | Yes | Which protocol the pool at pool_address belongs to: 'uniswap_v2' | 'uniswap_v3' | 'balancer' (2-asset weighted) | 'stableswap' (2-asset plain Curve). All four are supported — this tool spans every snapshot type. | |
| block_number | No | Optional block number to pin the read to a historical block. Omit to read the latest block. | |
| pool_address | Yes | On-chain address of the pool/pair to snapshot. Required. Lowercase, uppercase, or checksum casing all work. |