Query editor
/* ============================================================================Q1 · Tsunami — fees and protocol revenue, daily, by fee source----------------------------------------------------------------------------FEES (what traders pay to Tsunami)curve 1% platform fee on every bonding-curve buy and sell.buy : TokenBought.amount (topic1) is the gross quote spent;fee = gross x fee_bps / 10000sell: TokenSold.amountOut (data w0) is the quote paid out NET ofthe fee; gross = net x 10000 / (10000 - fee_bps)fee_bps comes from the factory's PlatformFeeUpdated history(100 bps throughout so far; 100 = initialize() value).hook 1% InkFeeHook fee on every swap in a graduated pool on Calamari.Read from SwapFeeAccrued in BOTH shapes:legacy 0xf3d68b7d (currency, amount) hooks 0x110a.., 0xbA72..current 0x234d6d67 (currency, curve, amount) hook 0x5dC5..Charged in the pool's quote currency. Accrued here, swept to thetreasury later (see the reconciliation query).launch LaunchFeePaid on the factory (0.0005 ETH per launch today).CREATOR SHARE (excluded from protocol revenue)feeSharePercent from PlatformFeeUpdated(newFee, feeSharePercent): 1% from2026-09-12, 30% from 2026-09-15 on the original factory. Applied only tolaunches with a FeeShare contract, from the block it was set, on curve feesand on current-hook fees. Legacy hooks pay 100% to the platform.PROTOCOL REVENUE = fees - creator share.Graduated-pool swaps also pay Calamari's 0.1% v4 protocol fee; that is bookedto Calamari (query Q2), never here, so nothing is double counted.USD: prices.hour (native ETH priced off WETH 0x4200..0006). ETH columns coverfees charged in ETH or WETH; other quote assets appear in USD only.========================================================================== */WITH launches AS (SELECT * FROM query_9105569),factories AS (SELECT * FROM (VALUES (0x5934a5c377309453746ee8aa5194f671930c09fa), (0x1fc16511f5fa4b4c1591ffeb8c38affc367076f1)) AS t(factory)),fee_updates AS ( -- PlatformFeeUpdated(uint256 newFee, uint256 feeSharePercent)SELECT contract_address AS factory, block_number,cast(bytearray_to_uint256(bytearray_substring(data, 1, 32)) AS double) AS fee_bps,cast(bytearray_to_uint256(bytearray_substring(data, 33, 32)) AS double) AS creator_pctFROM ink.logsWHERE contract_address IN (SELECT factory FROM factories)AND topic0 = 0xd347e206f25a89b917fc9482f1a2d294d749baa4dc9bde7fb495ee11fe491643AND block_number >= 54686019),fee_sched AS (SELECT factory, block_number AS from_block,coalesce(lead(block_number) OVER (PARTITION BY factory ORDER BY block_number), 9999999999) AS to_block,fee_bps, creator_pctFROM (SELECT * FROM fee_updatesUNION ALL -- before the first update: initialize() fee of 100 bps, no creator split yetSELECT f.factory, 0, 100, 0 FROM factories f)),tsunami_hooks AS (SELECT DISTINCT bytearray_substring(data, 13, 20) AS hookFROM ink.logsWHERE contract_address IN (SELECT factory FROM factories)AND topic0 = 0xe816c20840d998c8612f9b624b91687a80510eeb293cb09f7637379f6d73342d),