Query editor
-- sfrxUSD — Global Circulating Supply and Value (Frax API) + Ethereum-side detail (Dune)---- CIRCULATING SUPPLY IS THE SUPPLY. Gross ERC20 totalSupply includes unissued inventory held by-- the protocol — minted but never issued, held by no one, burnable at any time. It is carried here-- only as an accounting reconciliation figure; do not chart it as "supply" or "TVL".---- Global figures come from Frax's own API rather than being reconstructed from chain data, because-- Fraxtal — where sfrxUSD is minted and where the largest unissued balance sits — is not indexed by-- Dune. The API also nets out protocol-owned liquidity per pool, which transfer flow alone cannot do.---- Chart type: line (circulating_usd) + secondary axis (pps)---- ============================================================================================-- DEPENDS ON UPLOADED TABLE: dune.fraxfinance.dataset_sfrxusd_api_history-- Source: https://api.frax.finance/v2/sfrxusd/summary-stats/history?range=all-- Cached copy for re-upload: frax_api_history.csv (in this folder)-- The API is the source of truth; refresh the upload periodically or the series goes stale-- silently — the query keeps returning rows, they just stop at the last upload date.-- ============================================================================================WITH api AS (SELECTCAST(day AS DATE) AS day,CAST(circulating AS DOUBLE) AS circulating,CAST(circulating_usd AS DOUBLE) AS circulating_usd,CAST(gross AS DOUBLE) AS gross,CAST(gross_usd AS DOUBLE) AS gross_usd,CAST(pps AS DOUBLE) AS pps,CAST(apy AS DOUBLE) AS apyFROM dune.fraxfinance.dataset_sfrxusd_api_history),-- Ethereum-side detail from chain data, so the global series can be split into-- "on Ethereum" vs "everywhere else" (mostly Fraxtal + Sei).eth_transfers AS (SELECTDATE_TRUNC('day', block_time) AS day,bytearray_substring(topic1, 13, 20) AS from_addr,bytearray_substring(topic2, 13, 20) AS to_addr,CAST(bytearray_to_uint256(data) AS DOUBLE) / 1e18 AS amountFROM ethereum.logsWHERE contract_address = 0xcf62F905562626CfcDD2261162a51fd02Fc9c5b6AND topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef),-- Addresses whose sfrxUSD is not circulating on Ethereum.not_circulating AS (SELECT * FROM (VALUES(0x4b45D73b83686e69d08E61105FdB7F7b51f41Bc1, 'sfrxUSD Comptroller — unissued'),(0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2, 'Fraxtal L1 Bridge on Ethereum'),(0x7311CEA93ccf5f4F7b789eE31eBA5D9B9290E126, 'LayerZero OFT adapter — bridged out'),-- Curve sfrxUSD/frxUSD, deducted in full because it has been ~entirely protocol-owned.-- RE-VERIFY periodically: if third-party LPs enter, this over-deducts.(0xF292eB6c5dcb693Eaaf392D0562a01C3710E5978, 'Curve sfrxUSD/frxUSD — POL')-- The reUSD/sfrxUSD and sfrxUSD/scrvUSD pools are only PARTLY protocol-owned and would-- need LP-share attribution, so they are not deducted here. The API figures above DO-- account for them — which is why eth_circulating is the approximation, not `circulating`.) AS t(address, label)),