Query editor
/* ============================================================================Ink — can a user actually move size? Canonical pool depth.----------------------------------------------------------------------------Three independent reads per pool, because no single one is trustworthy alone:1. real reserves - the pool's actual token balances (exact, frombalances_ink.stg_latest, validated against eth_call). This is the hardceiling: you cannot buy more of a token than the pool holds.2. local impact - CL pools publish active liquidity L and sqrtPriceX96 inevery Swap. At the current tick the pool is constant-product with virtualreserves x = L*2^96/sqrtP, y = L*sqrtP/2^96, so impact ~ 2*S/R. This is aLOWER bound: it assumes L holds through the move, but a tight-range poolexhausts its range first. On tickSpacing=1 stable pools the virtualreserves run into the billions, which is why capacity below is capped bythe real reserves rather than reported raw.3. observed fills - the largest trade that actually cleared, and how many>=$100k fills happened. No modelling at all.Swap topic 0xc42079f9... and fee tiers verified on chain 2026-09-22.========================================================================== */WITH canon (pool, label, dex) AS (VALUES(0x31826a86cd62c6fa12a0a8441ec4c8bcfee8a453, 'USDG/USDT0', 'Velodrome CL'),(0x62c92624b8583156fc9345a7a0ed8a1f6a9ad848, 'USDC/USDT0', 'Velodrome CL'),(0x68ea2123ce20514127b07378773f617491e290cc, 'GHO/USDT0', 'Velodrome CL'),(0xac7fc3e9b9d3377a90650fe62b858ff56bd841c9, 'WETH/USDT0', 'Velodrome CL'),(0xdcf119db83668e8724474dc05f6507cc7430120f, 'kBTC/USDT0', 'Velodrome CL'),(0xedafd349bdac6baaefc13d06b3aa2db779534656, 'kBTC/WETH', 'Velodrome CL'),(0xcc7c17cc1e74016fccd8ef413ca811595f76c67a, 'USDC/WETH', 'Velodrome CL'),(0xa304a3ed0df1f8d797b281c4f12bc3eefa49adaf, 'USDG/WETH', 'Velodrome CL'),(0xad95f3af523d83f00679764dbefb07ddce15d1e1, 'USDG/kBTC', 'Velodrome CL'),(0x356667da30c89cc36c65d394500424d5eba8731c, 'WETH/USDT0', 'Uniswap v3'),(0x6ab98b2e11a3cadb7021c390b9011b6a7c03cdfe, 'kBTC/USDT0', 'Uniswap v3')),px AS (SELECT b.token_address AS token, b.token_symbol AS symbol,coalesce(f.price, CASE WHEN b.token_symbol IN ('USDC','USD₮0','USDG','oUSDT','GHO','USDC.e','USDT') THEN 1 END) AS pxFROM (SELECT DISTINCT token_address, token_symbol FROM balances_ink.stg_latest) bLEFT JOIN (SELECT contract_address, price FROM prices.latest WHERE blockchain='ink') fON f.contract_address = b.token_address),/* 1. real reserves per side */reserves AS (SELECT b.address AS pool,sum(b.balance * px.px) AS tvl_usd,min(b.balance * px.px) AS small_side_usdFROM balances_ink.stg_latest bJOIN px ON px.token = b.token_addressWHERE b.address IN (SELECT pool FROM canon)AND b.balance > 0AND b.token_symbol IN ('WETH','USD₮0','USDC','USDG','kBTC','GHO','USDC.e','oUSDT')GROUP BY 1),/* 2. local depth from the latest Swap */last_swap AS (SELECT contract_address AS pool,cast(bytearray_to_uint256(bytearray_substring(data, 65, 32)) AS double) AS sqrt_p_x96,cast(bytearray_to_uint256(bytearray_substring(data, 97, 32)) AS double) AS liquidity,block_time,row_number() OVER (PARTITION BY contract_address ORDER BY block_number DESC, index DESC) AS rn