Query editor
-- StonkBrokers | daily protocol revenue and trading table-- Chain: Robinhood Chain (Dune schema: robinhood)-- Window: from mainnet mint (2026-07-17 UTC). Change params.start_time for another range.-- Source of truth: raw contract events. This does NOT treat token price, Escrow releases,-- or CEX listing volume as protocol revenue.WITHparams AS (SELECT TIMESTAMP '2026-07-17 00:00:00 UTC' AS start_time),contracts AS (SELECT0xe302733accf4800146e55fc45b46b4e4ffc032d2 AS amm,0xacd5ae3c060c1137fe2ee86b0ab2ef697456f664 AS activation,0xa7b9ac696b252b79568a5a01b2fd02177ef23664 AS loan,0xe934e36a439c94017b64a3fece66af12099abf50 AS stonk),-- All amounts below are ETH unless the suffix is _stonk.-- NFTBought: tokensIn, ethFeePaid, boosterShare, protocolShare, isSpecific.-- NFTSold: tokensOut, ethFeePaid, boosterShare, protocolShare.amm_events AS (SELECTdate_trunc('day', l.block_time) AS day,CASEWHEN l.topic0 = 0xb5efbeab556b17cacd1e111b6dee840d9d3bfeabc055edb46ce2b991b8c58673 THEN 'buy'WHEN l.topic0 = 0xf6ba9b3ae5ce11a745e929565d46b19f01279e1f49a3faca1d6c1e608151c494 THEN 'sell'END AS side,l.tx_hash,CAST(varbinary_to_uint256(varbinary_substring(l.data, 1, 32)) AS DOUBLE) / 1e18 AS stonk_amount,CAST(varbinary_to_uint256(varbinary_substring(l.data, 33, 32)) AS DOUBLE) / 1e18 AS fee_eth,CAST(varbinary_to_uint256(varbinary_substring(l.data, 65, 32)) AS DOUBLE) / 1e18 AS booster_eth,CAST(varbinary_to_uint256(varbinary_substring(l.data, 97, 32)) AS DOUBLE) / 1e18 AS protocol_revenue_ethFROM robinhood.logs lCROSS JOIN params pCROSS JOIN contracts cWHERE l.contract_address = c.ammAND l.block_time >= p.start_timeAND l.topic0 IN (0xb5efbeab556b17cacd1e111b6dee840d9d3bfeabc055edb46ce2b991b8c58673, -- NFTBought0xf6ba9b3ae5ce11a745e929565d46b19f01279e1f49a3faca1d6c1e608151c494 -- NFTSold)),-- Activated data: tier, feePaid. ActivationUpgraded data: fromTier, toTier, feePaid.-- feePaid is denominated in STONKBROKER, not ETH. Current contract split is-- 50% burn / 50% protocol. This query uses that current on-chain-- split; if ActivationFeeSplitUpdated occurs, create a dated split table before using history.activation_events AS (SELECTdate_trunc('day', l.block_time) AS day,CASEWHEN l.topic0 = 0x4e4f107f0e9557eb4a56fbc0e0697242ee73b7aa9002ceb8c344bdaf2f5d0930 THEN 'activation'WHEN l.topic0 = 0xc2bd0116c910da39fbbacb69cc1d0cfa037c1aa3821d99a23ae3d50f9adf7801 THEN 'upgrade'END AS event_type,l.tx_hash,CASEWHEN l.topic0 = 0x4e4f107f0e9557eb4a56fbc0e0697242ee73b7aa9002ceb8c344bdaf2f5d0930THEN CAST(varbinary_to_uint256(varbinary_substring(l.data, 33, 32)) AS DOUBLE) / 1e18WHEN l.topic0 = 0xc2bd0116c910da39fbbacb69cc1d0cfa037c1aa3821d99a23ae3d50f9adf7801