Query editor
-- Beefy active-liquidity-time shares on MegaETH-- Output shape mirrors the end of step 3) in Prism's lp-time-weighted-liquidity.sql-- (a per-address liquidity-time score, all-time and last-7-days).---- Method:-- 1) Pull ERC20 Transfer events for the Beefy Reward Pool token.-- 2) Exclude mints/burns (transfers to/from the zero address) and the project-- helper contract 0x6f66f246bb436b6f4e66a992c2218b57cd906109 (it intermediates-- minting/burning and is not an end user).-- 3) Build signed deltas per address (inflow = +, outflow = -) and a running-- balance per address over time.-- 4) Form spans of constant balance (this event -> next event, or -> now() for-- the last event per address) and sum balance * seconds.---- Note on units / pricing:-- - Score units here are (Reward Pool token quantity) * seconds, matching-- Prism's "liquidity * seconds" shape. It is intended to capture a share of the-- liquidity contributed by the Beefy Strategy on Prism, rather than USD values.WITH base AS (SELECTblock_time,tx_hash,"from","to",CAST(amount_raw AS DOUBLE) / 1e18 AS amount_qFROM tokens.transfersWHEREblockchain = 'megaeth'AND contract_address = 0xf995A90E338f2AE6456F79777f3BBAC42c411F7BAND "from" != 0x0000000000000000000000000000000000000000AND "to" != 0x0000000000000000000000000000000000000000),-- One row per (address, transfer): + for inflow, - for outflow.-- Self-transfers cancel out (both rows emitted, net zero).address_deltas AS (SELECTblock_time,tx_hash,"to" AS address,amount_q AS amount_deltaFROM baseUNION ALLSELECTblock_time,tx_hash,"from" AS address,-amount_q AS amount_deltaFROM base),-- Aggregate to one row per (address, block_time, tx_hash) so that a single-- transaction produces a single balance step per address.events AS (SELECTaddress,block_time,