Query editor
-- Query 1: Cumulative TVL Tracking for frxUSD PegKeeper Pools-- Tracks total pool TVL and frxUSD TVL by pool over time-- Ethereum pools only---- Note: this assumes each LP token ≈ $1 and each paired-token unit ≈ $1.-- That's approximately correct for stable/stable pairs but will understate-- TVL for pools paired with appreciating ERC-4626 share tokens. The proper-- valuation (balance × paired-token USD price) is deferred until price feeds-- are reliably available for the new pools.WITH eth_pool_addresses AS (SELECT0x13e12BB0E6A2f1A3d6901a59a9d585e89A6243e1 AS pool_address,'frxUSD/crvUSD' AS pool_name,'crvUSD' AS paired_assetUNION ALL SELECT 0x9A9e2e70919c75D80aAaA1D483c46CdBb8ac4d1b, 'frxUSD/msUSD', 'msUSD'UNION ALL SELECT 0x20d4c49a873EaeFf76EfBD0cF19002F6E19EF52c, 'frxUSD/USDaf', 'USDaf'UNION ALL SELECT 0x851907CAC684797eee43669798D78004e269Cb5E, 'frxUSD/fxUSD', 'fxUSD'UNION ALL SELECT 0x2eFC11c7Bb2E0FBdBa8A05a3712398860E6A8E53, 'frxUSD/USDfi', 'USDfi'UNION ALL SELECT 0x2Cc565dDe7C078A8E477763a34C40e52b13e6396, 'frxUSD/YUSD', 'YUSD'UNION ALL SELECT 0x98E9599dab3A936C35DE48E13E026Ef4eA20B5e6, 'frxUSD/USDf', 'USDf'UNION ALL SELECT 0xBf5047039F2980C21eB5692c790BAd8A9533b900, 'frxUSD/pmUSD', 'pmUSD'UNION ALL SELECT 0x68d03Ed49800e92D7Aa8aB171424007e55Fd1F49, 'frxUSD/OUSD', 'OUSD'UNION ALL SELECT 0x3e823bd1015Ba1A12F2F8aFD631c822a1CBA0de7, 'frxUSD/iUSD', 'iUSD'UNION ALL SELECT 0x421194e547eb49304B3e99ffD26b164f9832d395, 'frxUSD/reUSD', 'reUSD'UNION ALL SELECT 0x917213760aF19E938E1C5cf4c6c3a963f6F32152, 'frxUSD/savUSD', 'savUSD'UNION ALL SELECT 0xf76329c6dc10FdfbEe6CA520d0BF4d474E95E46E, 'frxUSD/avUSD', 'avUSD'UNION ALL SELECT 0x6dD7522c83ecd5d67F8eaF11A973219C6A9f7493, 'frxUSD/tmvUSDC', 'tmvUSDC'UNION ALL SELECT 0x249839821B7B673bC68a6d9bC74811fa33A8a49f, 'frxUSD/dUSD', 'dUSD'UNION ALL SELECT 0x310a9fd2906c6a3ee97289095b183f96309c56ae, 'frxUSD/srRoyUSDC', 'srRoyUSDC'UNION ALL SELECT 0x17f9682c9cd1a448b31c0428f1d0783ed13a9fa3, 'frxUSD/alUSD', 'alUSD'UNION ALL SELECT 0xefc056790bb19702b2164ec6ea6ba3ae01d81195, 'frxUSD/USG', 'USG'UNION ALL SELECT 0xd50492de3541d75e61edc34d1aa79c7dc2d20da9, 'frxUSD/USP', 'USP'UNION ALL SELECT 0x31d563e7d382cd934014bec8c6c931751e6b3a9a, 'frxUSD/ebUSD', 'ebUSD'UNION ALL SELECT 0x96bca2cea58a8e08e7da5c9d68b8acbb28419d1d, 'frxUSD/USPC', 'USPC'UNION ALL SELECT 0xcaf1969e9ba98c05113b75d8633a17196e2d02a5, 'frxUSD/sUSDat', 'sUSDat'UNION ALL SELECT 0x9d8afd5ce19a3b948049468188f1de13951a4383, 'frxUSD/sDOLA', 'sDOLA'UNION ALL SELECT 0x552827613fea5eada3871f83b2d407d50cb04116, 'frxUSD/evaUSDT', 'evaUSDT'UNION ALL SELECT 0x01646f6fe0d75ced6e514fab0ea2f4ed5e1a5c9f, 'frxUSD/muBOND', 'muBOND'UNION ALL SELECT 0x16a973f8e466f44e9ea67e7e2d3166bd460ea852, 'frxUSD/AZND', 'AZND'UNION ALL SELECT 0x104d6a1b97a6cef88d905d7b865a378d90be932a, 'frxUSD/DUSD', 'DUSD'UNION ALL SELECT 0x7ba89bc658c07569cfa6d7947adaa80181a24568, 'frxUSD/USD3', 'USD3'UNION ALL SELECT 0x81A2612F6dEA269a6Dd1F6DeAb45C5424EE2c4b7, 'frxUSD/sUSDS', 'sUSDS'),-- Single scan of erc20_ethereum.evt_Transfer for any transfer we care about:-- (a) LP token mints/burns (contract = a pool LP token, from/to = zero address)-- (b) frxUSD movements in/out of any pool-- Time-bounded to keep the scan small. Set the bound generously to before the-- frxUSD token launch (early 2025) so we never clip a pool's initial mints —-- doing so would cause later burns to push cumulative balances negative.relevant_transfers AS (SELECTDATE_TRUNC('day', t.evt_block_time) AS day,t.contract_address,t."from",t.to,TRY_CAST(t.value AS DOUBLE) / 1e18 AS amountFROM erc20_ethereum.evt_Transfer AS tWHERE t.evt_block_time >= TIMESTAMP '2025-01-01'