Query editor
-- Cumulative reward distribution.-- Reads payouts_attributed.sql; replace query_0000000 with its Dune query id.---- Cumulative wallets cannot be a running sum of the daily distinct count -- the-- same wallet is paid on most days. It is the running sum of wallets seen for the-- first time, which is what first_seen gives.WITH daily AS (SELECTday,sum(amount) AS quote_distributed,count(*) AS payoutsFROM (-- Attributed reward payouts. Paste in Dune as its own query; every other file in-- sql/rewards/ reads it back as query_0000000.---- Dune parameters:-- HcRLc9VDgjLeK154xDawfb1dmVJ98DoSqcwTHGqiDeJR HcRLc9VDgjLeK154xDawfb1dmVJ98DoSqcwTHGqiDeJR (ZCAT)-- A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS (ZEC, classic SPL)-- 5KXDF6QnqhBj72hDtJNkkpFaQVUfbFXNybMsp3DiK6tD 5KXDF6QnqhBj72hDtJNkkpFaQVUfbFXNybMsp3DiK6tD-- 0.5 0.5 (calibrated -- see threshold_sweep.sql)-- 2026-08-30 2026-08-30 (the pair's launch day)---- Set every parameter's default value before running. Dune substitutes an empty-- string for a blank parameter, which matches no rows and looks like "no results"-- rather than an error. 2026-08-30 is not optional either: without it this-- scans the whole of tokens_solana.transfers.---- Why attribution is needed: StonkFun pays every reward coin quoted in the same-- asset out of one token account, and the payout transaction names no reward-- coin -- it is ~20 bare transferChecked instructions, no memo, no CPI. For ZEC,-- ZCAT is only 77% of the volume and 61% of the payouts leaving that account, so-- filtering on the distributor alone overstates ZCAT by 29% and 65%.---- What makes it tractable: one transaction pays holders of exactly one coin, and-- the holder list is walked in descending balance order. So the batch, not the-- wallet, is the unit of attribution -- a wallet can hold several coins quoted in-- the same asset, but a batch belongs to one of them. A simple majority is the-- rule: 0.5 is where ZEC, payout count and wallet count all match StonkFun at-- once. Stricter thresholds drop the tail of the holder list, where wallets that-- have since sold carry a zero balance forward and score low.WITH payouts AS (SELECTblock_time,tx_id,to_owner AS wallet,amount_display AS amountFROM tokens_solana.transfersWHERE token_mint_address = 'A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS'AND from_owner = '5KXDF6QnqhBj72hDtJNkkpFaQVUfbFXNybMsp3DiK6tD'AND action = 'transfer'AND to_owner IS NOT NULLAND block_time >= TIMESTAMP '2026-08-30'),-- solana_utils.daily_balances carries a row only when an address's balance-- CHANGED that day -- it is sourced from solana.account_activity and is not a-- carry-forward snapshot. Verified: summing token_balance per day gives 963M,-- 737M, 591M, 653M ... while ZCAT's supply is a constant ~968.9M.