Query editor
-- Query to track staking across multiple communities with different token typesWITH-- Define known staking contracts and their tokensstaking_pairs AS (-- WXDAI staking contractsSELECT 0xA9257a428dC6B192bd1ccc14c0a5a61476C767B9 AS contract_address,0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d AS token_address,'WXDAI' AS token_symbol,18 AS decimalsUNION ALL-- Add another WXDAI community (add more as you discover them)-- SELECT 0x... AS contract_address,-- 0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d AS token_address,-- 'WXDAI' AS token_symbol,-- 18 AS decimals-- HONEY staking contractsSELECT 0x6221d5e286cce0d22fc6e0b2597d5d3ca98dacb1 AS contract_address,0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9 AS token_address,'HONEY' AS token_symbol,18 AS decimalsUNION ALLSELECT 0x4d7a042b2fb2504dd98e4c871cc134a8ded712da AS contract_address,0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9 AS token_address,'HONEY' AS token_symbol,18 AS decimalsUNION ALLSELECT 0xe2396fe2169ca026962971d3b2e373ba925b6257 AS contract_address,0x71850b7E9Ee3f13Ab46d67167341E4bDc905Eef9 AS token_address,'HONEY' AS token_symbol,18 AS decimals),-- Get all transfers to/from these staking contracts for their specific tokenstransfers AS (-- Incoming transfers (staking)SELECTevt_block_time,p.contract_address AS staking_contract,"from" AS user_address,p.token_symbol,p.decimals,TRY_CAST(value AS DECIMAL(38,0)) AS positive_amount,0 AS negative_amountFROM erc20_gnosis.evt_transfer tJOIN staking_pairs p ON t."to" = p.contract_address AND t.contract_address = p.token_addressUNION ALL-- Outgoing transfers (unstaking)SELECTevt_block_time,p.contract_address AS staking_contract,