Query editor
-- Amp Supply Composition-- Dune query 8395760: https://dune.com/queries/8395760-- From dashboard: https://dune.com/ampdotxyz/amp-token---- Where the AMP supply sits, daily: staked in Flexa Capacity v3 (reserved-- collateral), staked in Flexa Capacity v2 (Collateral Manager balance),-- held on tracked centralized exchanges, or anywhere else.-- Long format (day, category, amp) for a stacked/100% area chart.---- Caveats:-- * "On exchanges" covers only addresses in Dune's cex.addresses list.-- * "Other" includes DEX pools and the v3 vault's unreserved exit liquidity.-- Staked series uses the exact CollateralVault event reconstruction (see-- flexa-capacity-v3.sql); terminated reservations get a correction delta at-- termination time so history nets to zero.WITHdays AS (SELECT dayFROM UNNEST(SEQUENCE(TRY_CAST('2020-08-01' AS TIMESTAMP),CAST(DATE_TRUNC('day', CURRENT_TIMESTAMP) AS TIMESTAMP),INTERVAL '1' DAY)) AS _u(day)),-- total supply: mints minus burns, dailysupply_deltas AS (SELECT DATE_TRUNC('day', evt_block_time) AS day,SUM(CASE WHEN "from" = 0x0000000000000000000000000000000000000000THEN CAST(value AS int256) ELSE -CAST(value AS int256) END) AS deltaFROM erc20_ethereum.evt_TransferWHERE contract_address = 0xff20817765cb7f73d4bde2e66e067e58d11095c2AND ( "from" = 0x0000000000000000000000000000000000000000OR "to" = 0x0000000000000000000000000000000000000000)GROUP BY 1),-- AMP held by tracked CEX addresses, daily net changecex_eth AS (SELECT DISTINCT address FROM cex.addresses WHERE blockchain = 'ethereum'),cex_deltas AS (SELECT DATE_TRUNC('day', tr.evt_block_time) AS day,SUM(CASEWHEN ct.address IS NOT NULL AND cf.address IS NULL THEN CAST(tr.value AS int256)WHEN cf.address IS NOT NULL AND ct.address IS NULL THEN -CAST(tr.value AS int256)ELSE CAST(0 AS int256)END) AS deltaFROM erc20_ethereum.evt_Transfer trLEFT JOIN cex_eth ct ON ct.address = tr."to"LEFT JOIN cex_eth cf ON cf.address = tr."from"WHERE tr.contract_address = 0xff20817765cb7f73d4bde2e66e067e58d11095c2AND (ct.address IS NOT NULL OR cf.address IS NOT NULL)GROUP BY 1),-- Flexa Capacity v2: net AMP held by the Collateral Manager, daily change-- (self-transfers contribute +v and -v and cancel)v2_deltas AS (SELECT DATE_TRUNC('day', evt_block_time) AS day,