Query editor
WITH claimed_events AS (SELECTtx_hashFROMethereum.logsWHEREcontract_address IN (0x4B3883cCE3313Ed4445a897355032c273fd87A6f,0x9d118d9b6b38193e3e82cbf8ec0fbd2a8f61f6e2,0x14f263c8b143d52861bB0497040b53ab21a2DDab,0x2EA3A9A13A741b627d7997AE056F31429587E68F)AND topic0 = 0x597a291bf8dedc18fe24ac7ca5fc092b5108111be5a87280cf758b19396941d1),token_transfers AS (SELECT"to" AS recipient,tx_hash,amountFROMtokens.transfersWHEREcontract_address = 0x3073f7aAA4DB83f95e9FFf17424F71D4751a3073AND "from" IN (0x4B3883cCE3313Ed4445a897355032c273fd87A6f,0x9d118d9b6b38193e3e82cbf8ec0fbd2a8f61f6e2,0x14f263c8b143d52861bB0497040b53ab21a2DDab,0x2EA3A9A13A741b627d7997AE056F31429587E68F)AND blockchain = 'ethereum'),aggregated_claims AS (SELECTtt.recipient AS User_address,SUM(tt.amount) AS Total_claimedFROM token_transfers ttINNER JOIN claimed_events ce ON tt.tx_hash = ce.tx_hashGROUP BY tt.recipient)SELECTUser_address,Total_claimed,RANK() OVER (ORDER BY total_claimed DESC) AS RankFROM aggregated_claimsORDER BY rank;