Query editor
-- q_sol_premium_inflow [Solana] panel: area (cumulative)-- caption: Pool+treasury inflow proxy (heuristic: owner receiving from >=2 senders = protocol side). ~$0.04 demo. May fold treasury fee-in into premium — read as 'inflow', not pure premium.-- PACT NETWORK | SOLANA | USDC Premium Inflow (agent -> pool)-- NULL-safe protocol_side (avoids NOT IN + NULL trap that silently blanks the panel).WITH pact_legs AS (SELECT t.block_time, t.from_owner, t.to_owner, CAST(t.amount AS double)/1e6 AS usdcFROM tokens_solana.transfers tWHERE t.token_mint_address = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'AND t.outer_executing_account = '5bCJcdWdKLJ7arrMVMFh3z99rQDxV785fnD9XGcr3xwc'AND t.from_owner IS NOT NULL AND t.to_owner IS NOT NULL),protocol_side AS (SELECT to_owner AS owner FROM pact_legs WHERE to_owner IS NOT NULLGROUP BY to_owner HAVING count(DISTINCT from_owner) >= 2),premium_legs AS (SELECT l.block_time, l.usdc FROM pact_legs lWHERE l.to_owner IN (SELECT owner FROM protocol_side)AND NOT EXISTS (SELECT 1 FROM protocol_side p WHERE p.owner = l.from_owner)),daily AS (SELECT date_trunc('day', block_time) AS day, count(*) AS premium_legs, sum(usdc) AS premium_usdcFROM premium_legs GROUP BY 1)SELECT day, premium_legs, premium_usdc,sum(premium_usdc) OVER (ORDER BY day) AS cumulative_premium_usdcFROM daily ORDER BY day