Query editor
-- frxUSD Custodians — Daily Native Mint/Redeem Broken Out Per Custodian-- One row per (day, custodian). Ideal for a stacked area/bar chart of volume by asset over time.-- Volume denominated in frxUSD via the `shares` field (18 decimals).WITH custodians AS (SELECT * FROM (VALUES(0x4F95C5bA0C7c69FB2f9340E190cCeE890B3bd87c, 'USDC', 'Circle'),(0xe827abf9f462ac4f147753d86bc5f91e186e4e9c, 'BUIDL', 'Securitize (BlackRock)'),(0x5fbAa3A3B489199338fbD85F7E3D444dc0504F33, 'USTB', 'Superstate'),(0x860Cc723935FC9A15fF8b1A94237a711DFeF7857, 'WTGXX', 'WisdomTree')-- Add when live: USCC (FIP-420), AUSD (FIP-425), JTRSY (FIP-426)) AS t(custodian, asset, issuer)),events AS (SELECTc.asset,c.issuer,l.block_time,bytearray_to_uint256(bytearray_substring(l.data, 33, 32)) / 1e18 AS frxusd_amount,CASEWHEN l.topic0 = 0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7THEN 'mint'ELSE 'redeem'END AS directionFROM ethereum.logs lJOIN custodians c ON l.contract_address = c.custodianWHERE l.topic0 IN (0xdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7,0xfbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db))SELECTDATE_TRUNC('day', block_time) AS day,asset,issuer,SUM(CASE WHEN direction = 'mint' THEN frxusd_amount ELSE 0 END) AS mint_volume,-SUM(CASE WHEN direction = 'redeem' THEN frxusd_amount ELSE 0 END) AS redeem_volume,SUM(CASE WHEN direction = 'mint' THEN frxusd_amount ELSE frxusd_amount END) AS total_volume,SUM(CASE WHEN direction = 'mint' THEN frxusd_amount ELSE -frxusd_amount END) AS net_flow,COUNT(*) AS txnsFROM eventsGROUP BY 1, 2, 3ORDER BY day DESC, total_volume DESC