Query editor
-- BNB Chain-- ERC-3009 transfers FACILITATED by specific address(es)-- Multiple AuthorizationUsed + Transfer pairs per tx supported-- Assumption: each pair is adjacent in log/event order---- Running totals computed from old -> new:-- 1) requests: running total rows-- 2) volume: running total USD value using token decimals-- and multiplied by CURRENT BNB price-- 3) buyers: running total distinct "from"-- 4) sellers: running total distinct "to"---- FINAL OUTPUT ORDER: newest -> oldest-- (running windows still computed oldest -> newest)WITHparams AS (SELECT 66057406 AS start_block),facilitators AS (SELECT *FROM (VALUES(0x278eb74dd2126fe73e0b6376738cb85047e04553)-- add more facilitator EOAs here later) AS t(facilitator)),bnb_price AS (SELECT price AS bnb_usdFROM prices.latestWHERE blockchain = 'bnb'AND symbol = 'BNB'ORDER BY timestamp DESCLIMIT 1),facilitated_txs AS (SELECTtx.hash AS tx_hash,tx."from" AS facilitator_addressFROM bnb.transactions txJOIN facilitators fON tx."from" = f.facilitatorCROSS JOIN params pWHERE tx.block_number >= p.start_block),auth_used AS (SELECTl.tx_hash,l.contract_address AS token_address,l.index AS auth_log_index,ft.facilitator_addressFROM bnb.logs lJOIN facilitated_txs ftON l.tx_hash = ft.tx_hashCROSS JOIN params pWHERE l.block_number >= p.start_block-- topic0 = keccak256("AuthorizationUsed(address,bytes32)")