Query editor
/* ============================================================================Q4 · Ink Foundation share (70/30 revenue share) — daily and cumulative----------------------------------------------------------------------------Ink Foundation share = protocol revenue x {{foundation_share_pct}}% (70 underthe current agreement; the protocols retain 30%). Shown on two bases, side by side:ACCRUAL revenue when the fee is CHARGED on-chain (Q1 + Q2)CASH revenue when it REACHES the treasury Safe (Q3 inflows by sender)The two differ by fees still sitting in Tsunami's hooks (unswept) and inCalamari's PoolManager (never swept as of 2026-11-09).Protocol revenue excludes creator FeeShare cuts and Calamari LP fees, andincludes Tsunami launch fees. ETH columns: revenue charged/received in ETH orWETH (the native unit for ~95% of launches); USD columns cover every pricedasset, Calamari fees charged in launch tokens valued at the swap's own rate.The 70% is settled off-chain, so there is no on-chain payout column.========================================================================== */WITH rec AS (SELECT * FROM query_9105610 WHERE protocol IN ('Tsunami', 'Calamari')),by_protocol AS (SELECT day, protocol,sum(computed_revenue_eth) AS rev_eth_accrual,sum(computed_revenue_usd) AS rev_usd_accrual,sum(received_in_treasury_eth) AS rev_eth_cash,sum(received_in_treasury_usd) AS rev_usd_cashFROM rec GROUP BY 1, 2),share AS ( -- one row per protocol per day; stacked charts by protocol show the total (KPI query has a Total row)SELECT b.*, {{foundation_share_pct}} / 100.0 AS pct FROM by_protocol b)SELECT day, protocol,round(rev_usd_accrual, 2) AS protocol_revenue_usd,round(rev_eth_accrual, 6) AS protocol_revenue_eth,round(rev_usd_accrual * pct, 2) AS foundation_share_usd,round(rev_eth_accrual * pct, 6) AS foundation_share_eth,round(sum(rev_usd_accrual * pct) OVER w, 2) AS foundation_share_usd_cumulative,round(sum(rev_eth_accrual * pct) OVER w, 6) AS foundation_share_eth_cumulative,round(sum(rev_usd_accrual) OVER w, 2) AS protocol_revenue_usd_cumulative,-- cash basisround(rev_usd_cash, 2) AS received_revenue_usd,round(rev_eth_cash, 6) AS received_revenue_eth,round(rev_usd_cash * pct, 2) AS foundation_share_cash_usd,round(rev_eth_cash * pct, 6) AS foundation_share_cash_eth,round(sum(rev_usd_cash * pct) OVER w, 2) AS foundation_share_cash_usd_cumulative,round(sum(rev_eth_cash * pct) OVER w, 6) AS foundation_share_cash_eth_cumulative,round(avg(rev_usd_accrual) OVER (PARTITION BY protocol ORDER BY day ROWS BETWEEN 6 PRECEDING AND CURRENT ROW), 2)AS protocol_revenue_usd_7d_avgFROM shareWINDOW w AS (PARTITION BY protocol ORDER BY day ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)ORDER BY day DESC, protocol