Query editor
-- Aave V4 frxUSD Market: Borrowed-frxUSD Destinations [borrower-behavior 2/3]-- Where does borrowed frxUSD GO? Ranks the addresses that receive frxUSD FROM-- borrower wallets (after their first borrow), naming the major venues and-- flagging the rest as Aave V4 / other contract / EOA. Depends on BASE #1 & #2.---- Names below were hand-verified via Etherscan/Blockscan (2026-07-09) because-- `labels.all` is deprecated on Dune. To refresh, look up any unnamed contract-- via its Etherscan link and add a row to `known_destinations`.-- CAVEAT: aggregator/router entries (CoW, 0x, LI.FI, Kyber) are the swap venue,-- not the ultimate counterparty — they mean "borrower swapped/bridged frxUSD".WITH frx_borrowers AS (SELECT wallet, MIN(block_time) AS first_borrowFROM query_7919889 -- 00_frxusd_events_baseWHERE side = 'borrow'GROUP BY walletHAVING SUM(net_amount) > 0),outflows AS (SELECT tr."from" AS borrower,tr.to AS destination,CAST(tr.value AS DOUBLE) / 1e18 AS frxusdFROM erc20_ethereum.evt_Transfer trJOIN frx_borrowers bON tr."from" = b.walletAND tr.evt_block_time >= b.first_borrowWHERE tr.contract_address = 0xcacd6fd266af91b8aed52accc382b4e165586e29AND tr.to <> 0x0000000000000000000000000000000000000000),per_dest AS (SELECT destination,COUNT(DISTINCT borrower) AS num_borrowers,COUNT(*) AS num_transfers,SUM(frxusd) AS frxusd_outFROM outflowsGROUP BY destination),-- Hand-verified names for the notable destinations (2026-07-09)known_destinations AS (SELECT * FROM (VALUES(0x8f10b468b06c6fd214b65f87778827f7d113f996, 'Swap venue (KyberSwap-routed, unverified)', 'DEX / swap'),(0x9008d19f58aabd9ed0d60971565aa8510560ab41, 'CoW Protocol (settlement)', 'DEX aggregator'),(0x7f54f05635d15cde17a49502fedb9d1803a3be8a, '0x Protocol Settler', 'DEX aggregator'),(0x70bf6634ee8cb27d04478f184b9b8bb13e5f4710, '0x Protocol Settler', 'DEX aggregator'),(0xcca852bc40e560adc3b1cc58ca5b55638ce826c9, 'Aave V4 CoreHub', 'Aave V4 (repay/supply)'),(0x4a6c312ec70e8747a587ee860a0353cd42be0ae0, 'Morpho (General Adapter)', 'Lending'),(0x89c6340b1a1f4b25d36cd8b063d49045caf3f818, 'LI.FI (Permit2 Proxy)', 'Bridge / aggregator'),(0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae, 'LI.FI Diamond', 'Bridge / aggregator'),(0x000000000004444c5dc75cb358380d2e3de08a90, 'Uniswap V4 (PoolManager)', 'DEX'),(0x13e12bb0e6a2f1a3d6901a59a9d585e89a6243e1, 'Curve frxUSD/crvUSD pool', 'DEX / Curve'),(0xb300000b72deaeb607a12d5f54773d1c19c7028d, 'Binance DEX Router', 'CEX / aggregator')) AS t(address, name, category)),-- Aave V4 spokes (frxUSD back here = repay / re-supply)aave_spokes AS (SELECT DISTINCT spoke AS address FROM query_7923553 -- 00b_all_supply_positions_base