Query editor
-- Arbitrum eventsWITH arbitrum_transactions AS (SELECT'arbitrum' AS chain,e.user AS wallet_address,e.builderPool AS subnet_id,e.amount AS amountFROM morpheus_ai_arbitrum.builders_evt_userdeposited eUNION ALLSELECT'arbitrum' AS chain,e.user AS wallet_address,e.builderPool AS subnet_id,-e.amount AS amountFROM morpheus_ai_arbitrum.builders_evt_userwithdrawn e),-- Base eventsbase_transactions AS (SELECT'base' AS chain,e.user AS wallet_address,e.builderPool AS subnet_id,e.amount AS amountFROM morpheus_ai_base.builders_evt_userdeposited eUNION ALLSELECT'base' AS chain,e.user AS wallet_address,e.builderPool AS subnet_id,-e.amount AS amountFROM morpheus_ai_base.builders_evt_userwithdrawn e),-- Combine both chainscombined_transactions AS (SELECT * FROM arbitrum_transactionsUNION ALLSELECT * FROM base_transactions),-- Aggregate net staked by chainnet_staked_by_chain AS (SELECTchain,SUM(amount) AS net_amountFROM combined_transactionsGROUP BY chain)-- Final outputSELECTchain,CAST(net_amount AS DOUBLE) / 1e18 AS current_staked_tokensFROM net_staked_by_chainORDER BY chain;