Query editor
-- ============================================================================-- cbBTC EVM Flow Model -- Mint / Burn / Transfer classification-- ============================================================================-- Purpose: normalize raw ERC20 Transfer events into economic flow types.-- - mint: from = 0x0 (new supply entering circulation on this chain)-- - burn: to = 0x0 (supply leaving circulation on this chain,-- typically a redemption back to BTC via Coinbase)-- - transfer: everything else (wallet<->wallet, wallet<->protocol,-- protocol<->protocol movements of existing supply)---- Source: tokens.transfers spell, filtered to cbBTC contract addresses via the-- contract mapping query (query_7838759). Using the spell instead of raw-- decoded event tables means Monad, Arbitrum, Base, and Ethereum are all-- covered by ONE consistent schema instead of 4 separate decoded namespaces.---- This query intentionally does NOT yet filter out "technical noise" beyond-- the mint/burn/transfer split -- that's because at the cbBTC contract level,-- every Transfer event already represents a real balance change (no proxy-- double-logging has been observed for this token). If duplicate-event noise-- is found during validation, add a DISTINCT/dedup step here, not downstream.---- Partition pruning: tokens.transfers is partitioned by block_date, filtered-- below to the last 35 days to support 24h/7d/30d dashboard windows with a-- small buffer.-- ============================================================================WITH cbbtc_contracts AS (SELECT contract_address, chainFROM (VALUES('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'ethereum'),('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'base'),('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'arbitrum'),('0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf', 'monad')) AS t(contract_address, chain)),raw_transfers AS (SELECTt.blockchain AS chain,t.block_time,t.block_date,t.tx_hash,t."from" AS from_address,t."to" AS to_address,t.amount,t.amount_usdFROM tokens.transfers tINNER JOIN cbbtc_contracts cON t.blockchain = c.chainAND t.contract_address = from_hex(c.contract_address)WHERE t.block_date >= CURRENT_DATE - INTERVAL '35' DAY)SELECTchain,block_time,block_date,tx_hash,from_address,