Query editor
-- EtherFi frxUSD: User-Held frxUSD Over Time (Scroll + Optimism)-- Tokens: frxUSD on Scroll (0x397F939C3b91A74C321ea7129396492bA9Cdce82)-- frxUSD on Optimism (0x80Eede496655FB9047dd39d9f418d5483ED600df)-- Tracks frxUSD held by actual users (excludes protocol addresses)-- total_user_held = frxUSD in the Safe wallets + frxUSD those Safes supplied to-- ether.fi Cash Lend (Aave v4 on Optimism). Supplying moves tokens out of the Safe-- into the Aave Hub (0x66753c4e3fC84f1eD0e3C267C927284E9d90C572), so wallet-- flows alone show a false drop-off once users started lending (Aug 2026).-- The remote custodian holds a ~250k pool and swaps users' USDC for frxUSD,-- so mint/burn tracking is misleading. Instead we track net flows into user wallets.WITH frxusd_xfers AS (-- Union frxUSD transfers across Scroll and Optimism (mid-2026 chain migration).SELECT evt_block_time, evt_tx_hash, "from", "to", valueFROM erc20_scroll.evt_TransferWHERE contract_address = 0x397F939C3b91A74C321ea7129396492bA9Cdce82AND evt_block_time >= TIMESTAMP '2026-01-22'UNION ALLSELECT evt_block_time, evt_tx_hash, "from", "to", valueFROM erc20_optimism.evt_transferWHERE contract_address = 0x80Eede496655FB9047dd39d9f418d5483ED600dfAND evt_block_time >= TIMESTAMP '2026-01-22'),-- EtherFi Cash Factory: 0xF4e147Db314947fC1275a8CbB6Cde48c510cd8CF-- Only wallets deployed by this factory (on either chain) count as EtherFi users.-- This filters out unrelated frxUSD holders on Optimism (a more active chain).etherfi_accounts AS (-- Two-level factory pattern: the proxy (0xF4e1…) deploys a per-user beacon,-- which in turn deploys the actual Safe. We want the Safes (grandchildren).SELECT ct_safe.addressFROM scroll.creation_traces ct_beaconJOIN scroll.creation_traces ct_safeON ct_safe."from" = ct_beacon.addressWHERE ct_beacon."from" = 0xF4e147Db314947fC1275a8CbB6Cde48c510cd8CFUNIONSELECT ct_safe.addressFROM optimism.creation_traces ct_beaconJOIN optimism.creation_traces ct_safeON ct_safe."from" = ct_beacon.addressWHERE ct_beacon."from" = 0xF4e147Db314947fC1275a8CbB6Cde48c510cd8CF),-- Aave v4 Cash Spoke (0xdffcC3536D932eb51Df51a7F5FA407c4270d5308), frxUSD reserveId = 4.-- Supply (uint256 indexed reserveId, address indexed caller, address indexed user, uint256 suppliedShares, uint256 suppliedAmount)-- Withdraw(uint256 indexed reserveId, address indexed caller, address indexed user, uint256 withdrawnShares, uint256 withdrawnAmount)-- user (topic3) is the Cash Safe; caller is always the LendGateway, so ignore it.-- Raw logs used because the Spoke isn't decoded on Dune.aave_events AS (SELECTblock_time,CASE WHEN topic0 = 0xd986db228cb1fe8392c5f45ff5f2c639b7db6cbd9ca7d1fe70b2de90c2c8c961THEN 1 ELSE -1 END AS direction,varbinary_substring(topic3, 13, 20) AS safe,CAST(varbinary_to_uint256(varbinary_substring(data, 1, 32)) AS DOUBLE) / 1e18 AS shares,CAST(varbinary_to_uint256(varbinary_substring(data, 33, 32)) AS DOUBLE) / 1e18 AS amountFROM optimism.logsWHERE contract_address = 0xdffcC3536D932eb51Df51a7F5FA407c4270d5308AND topic0 IN (0xd986db228cb1fe8392c5f45ff5f2c639b7db6cbd9ca7d1fe70b2de90c2c8c961, -- Supply