Query editor
-- DEGEN given back to the community: every airdrop and reward,-- valued in USD at the DEGEN price on the day each was claimed.WITH totals AS (SELECTCASEWHEN airdrop LIKE 'Liquidity Mining%' THEN 'Liquidity Mining'WHEN airdrop LIKE 'Airdrop 1%' THEN 'Airdrop 1'WHEN airdrop LIKE 'Airdrop 2%' THEN 'Airdrop 2'ELSE airdropEND AS airdrop_category,MAX(claimed_timestamp) AS end_timestamp,SUM(airdrop.amount) / 1e18 AS total_airdrop,SUM(airdrop.amount / 1e18 * usd.price) AS total_airdrop_usdFROM query_4175408 airdropLEFT JOIN prices.day usdON usd.blockchain = 'base'AND usd.contract_address = 0x4ed4E862860beD51a9570b96d89aF5E1B0EfefedAND usd.timestamp = DATE_TRUNC('day', airdrop.claimed_timestamp)GROUP BY 1),with_total AS (SELECTairdrop_category AS program,CAST(end_timestamp AS DATE) AS last_claim,total_airdrop AS degen_given,total_airdrop_usd AS usd_value,0 AS sort_orderFROM totalsUNION ALLSELECT'Total',NULL,SUM(total_airdrop),SUM(total_airdrop_usd),1FROM totals)SELECTprogram AS "Program",last_claim AS "Last claim",degen_given AS "DEGEN given",usd_value AS "USD value (on claim day)"FROM with_totalORDER BY sort_order, usd_value DESC;