Query editor
withL as(select * from query_7816075 where blockchain = 'BNB Chain'),K (contract,name) as (values(0x81a77Db87618d51bc12c9EAbe08cC298764B8277 , 'Pendle'),(0x68930887e1318ef30653a4b7942ab07544ebed4d , 'Pendle'),(0xF80Ab3Cc041d8Ccc1c51AcC295AFdba26AD70Aa9 , 'Pancake'),(0xf3396a9a79257D89f98143d8AB73da1dFF4e0e81 , 'Pancake')),X as(select evt_block_time, "from" as user, "to" as pool, 0+value/1e0 as amount, evt_tx_hash as hash, contract_address from erc20_bnb.evt_transfer union allselect evt_block_time, "to" as user, "from" as pool, 0-value/1e0 as amount, evt_tx_hash as hash, contract_address from erc20_bnb.evt_transfer ),A as(select asset, symbol, pool as user, sum(amount/deci*price) as valuefrom X as ajoin L as b on a.contract_address = b.contractwhere pool not in (select contract from K)group by 1,2,3 ),B as(select user, sum(value) as valuefrom Awhere value >= 1group by 1)selectcasewhen value >= 1e5 then '1. 🐋 Whale'when value >= 1e4 then '2. 🦈 Shark'when value >= 1e3 then '3. 🐬 Dolphin'when value >= 1e2 then '4, 🐟 Fish'when value >= 1e1 then '5. 🦀 Crab'when value >= 1e0 then '6. 🦐 Shrimp'end as tier,casewhen value >= 1e5 then '>= $100,000'when value >= 1e4 then '>= $10,000'when value >= 1e3 then '>= $1,000'when value >= 1e2 then '>= $100'when value >= 1e1 then '>= $10'when value >= 1e0 then '>= $1'end as note,count(distinct user) as user, sum(value) as valuefrom Bgroup by 1,2order by 1