Query editor
-- Step 1: Extract HNT oracle price from logsWITH price_logs AS (SELECTcall_tx_id,CAST(regexp_extract(regexp_extract(array_join(call_log_messages, ' '), 'HNT Price is ([0-9]+)'),'([0-9]+)') AS DECIMAL) * 1e-8 AS hnt_price -- 8 decimalsFROM helium_solana.data_credits_call_mintDataCreditsV0WHERE array_join(call_log_messages, ' ') LIKE '%HNT Price is %'),-- Step 2: Join price with DC mints → compute HNT burneddc_mints AS (SELECTdate_trunc('day', m.call_block_date) AS block_date,CAST(json_extract_scalar(m.args, '$.MintDataCreditsArgsV0.dcAmount') AS BIGINT) * 1e-5 / p.hnt_price AS hnt_burnedFROM helium_solana.data_credits_call_mintDataCreditsV0 mJOIN price_logs p ON m.call_tx_id = p.call_tx_id),-- Step 3: Daily & cumulative burndaily_burn AS (SELECT block_date, SUM(hnt_burned) AS hnt_burnedFROM dc_mintsGROUP BY 1),cumulative_burn AS (SELECTblock_date,SUM(hnt_burned) OVER (ORDER BY block_date) AS total_hnt_burnedFROM daily_burn),-- Step 4: Supply calculation (from foundation dataset)supply_calc AS (SELECTdate_trunc('day', h.block_date) AS block_date,(SUM(hnt_minted) OVER (ORDER BY date_trunc('day', h.block_date))) + 145113677.530333 AS total_supplyFROM dune."helium-foundation".result_hnt_total_issuance_by_entity h),-- Step 5: Combine supply with burnssupply_with_burn AS (SELECTs.block_date,s.total_supply,s.total_supply - cb.total_hnt_burned AS circulating_supply,cb.total_hnt_burnedFROM supply_calc sLEFT JOIN cumulative_burn cb ON s.block_date = cb.block_date),-- Step 6: Pick latest snapshotlatest AS (SELECT *FROM supply_with_burnORDER BY block_date DESC