Query editor
with tgt as (select from_hex(substr(x,3)) a from unnest(split('0x50099df7c254744a79d24ede4f2eeefa05901c92,0x946b6555cbae7750d32f66f57120f27365500800,0xd3c2f40bf1b3979e5fb1cf4d20fb59915fa3fb78,0x6e3e0e5f8dc4c90a7382664e3db63a42b80eb9d7,0xda3fdadc879064827caf128096e48505703783a8,0x6b46efc220c0f0ac81c7f9297569bfda07ce382a,0x28ae1cfe1143532d8e92fd2e9b2931778ea10643,0xc798554f793734313a013ce7827236ef5b5357b9,0x48411b013722f1e20ec087d61785f350f716dd85,0xba69224312a1a0418cc6cfc011e641e43602f158,0xa84a345c26921cf65e75759e989adfb3cf955fe2,0xf97fca82db234e1103f45fb6a398ed1491c12240,0xdbe726053bc6fd8ca200759533343e6cb65e22c1,0x536f1778c4bfa735b261fc3cd6584b88e6060ea2,0x15561e3d0a1d496f3af901be0f7b284024d7e233,0x888266746fefbe594dc56b67de7d697024c5da37,0x75e03d311d89ba1a0cc75dafc207ef34047df542,0x99217f943a797d26ea401daf09fd170e05d8c868,0x85f0b871503ed7904e8a8f6d548516506589dd09,0x267253665b56deafc75f32cb0d072b42602ac15d,0xf654b2e91e926d0a4d718cd0aad26e951e121427,0x0e4b150ad7422dab00132ca8ad9c10457224ce36,0xa60192d7595b538118b6a8ea75d79e5b3160252c,0x147776916c3ee650cf475e29723a01375011336f,0x6635c2e58c3146b45410727baf697d9d43c3b388,0x267ed5f71ee47d3e45bb1569aa37889a2d10f91e,0x1bf89b712162fbc20848dc62b2068bf77d07963a,0xe2008b01a2ad0a9aeea9f71ecc6a176138553a61,0x12dd56f8fdb071741b15fc55072d64d4df83b3aa,0xe195e3393a31c96c2d479717a63449c20ffcc821,0x4049d39b8f2113cef479920abe547f028db02043,0x5f556cc5c294d7d3effaffeb0b1195256a7a19d7,0x1d33a814e1a350e947a1480a88835e47c542b71f,0xd7d6c7d7ae9e4059383838c05ee6a469a72f681e,0xdc6fa837a997729a1b55cfc02c6e9301c87ad43a,0x646cd348d046727ac9fd7e32ad1e99b14a48b9b3,0xcdb0f4d0abe625137b3df6a75de807ca68329983,0x64caea8c916a86ea5ae1620ec2ee05f3201efc68', ',')) t(x)),f as (select t."to" a, t."from" src, sum(cast(t.value as double))/1e18 v, min(t.evt_block_date) dfrom erc20_ethereum.evt_transfer twhere t.evt_block_date >= date '2024-04-01' and t.contract_address in (0xec53bf9167f50cdeb3ae105f56099aaab9061f83, 0x83e9115d334d248ce39a6f36144aeab5b3456e75)and t."to" in (select a from tgt)and t."from" not in (0xacb55c530acdb2849e6d4f36992cd8c9d50ed8f7, 0x858646372cc42e1a627fce94aa7a7033e7cf075a, 0x83e9115d334d248ce39a6f36144aeab5b3456e75, 0xec53bf9167f50cdeb3ae105f56099aaab9061f83, 0x0000000000000000000000000000000000000000, 0x7750d328b314effa365a0402ccfd489b80b0adda)group by 1,2),top as (select a, max_by(src, v) top_src, max(v) top_v, max_by(d, v) top_d, sum(v) tot_in,max(if(src in (0x035bdaeab85e47710c27eda7fd754ba80ad4ad02, 0xf532a5a35007804a9ca79e7fa15d8f648f6d7f28, 0xa105c3abedbaf4295ac6149bf24d5311f629934c), 1, 0)) airdrop from f group by 1),src2 as (select t."to" s, max_by(t."from", cast(t.value as double)) src_of_src from erc20_ethereum.evt_transfer twhere t.evt_block_date >= date '2024-04-01' and t.contract_address in (0xec53bf9167f50cdeb3ae105f56099aaab9061f83, 0x83e9115d334d248ce39a6f36144aeab5b3456e75)and t."to" in (select top_src from top) group by 1),l as (select address, array_join(slice(array_agg(distinct name), 1, 3), '; ') name from labels.addresses where blockchain='ethereum' and (address in (select a from tgt) or address in (select top_src from top) or address in (select src_of_src from src2)) group by 1)select top.a, la.name a_label, top.top_src, ls.name src_label, round(top.top_v) top_v, top.top_d, round(top.tot_in) tot_in, top.airdrop, src2.src_of_src, lss.name src_of_src_labelfrom top left join l la on la.address = top.a left join l ls on ls.address = top.top_srcleft join src2 on src2.s = top.top_src left join l lss on lss.address = src2.src_of_src