Query editor
--Error: Query is too long for wand tools.--Try shortening query to try again.withprice as (select symbol , decimals, avg(token_price_usd) as pricefrom dex.prices_latest,tokens.erc20where token_address = 0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5and contract_address = 0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5and blockchain = 'ethereum'group by 1,2),raw as (select "from" as address, sum(cast(value as double)*-1) as amountfromerc20_ethereum.evt_Transferwhere contract_address = 0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5group by 1union allselect "to" as address, sum(cast(value as double)) as amountfrom erc20_ethereum.evt_Transferwhere contract_address = 0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5group by 1)selectcasewhen percent_holdings >=0.5 then 'H) Holdings >=50%'when percent_holdings >=0.4 and percent_holdings<0.5 then 'G) Holdings >=40% & <50%'when percent_holdings >=0.3 and percent_holdings<0.4 then 'F) Holdings >=30% & <40%'when percent_holdings >=0.2 and percent_holdings<0.3 then 'E) Holdings >=20% & <30%'when percent_holdings >=0.1 and percent_holdings<0.2 then 'D) Holdings >=10% & <20%'when percent_holdings >=0.05 and percent_holdings<0.1 then 'C) Holdings >=5% & <10%'when percent_holdings >=0.01 and percent_holdings<0.05 then 'B) Holdings >=1% & <5%'when percent_holdings <0.01 then 'A) Holdings <1%'end as distribution,count(distinct address) as address_count,sum(holding) as total_holdingfrom (select-- case-- when address in (select distinct address from labels.cex_ethereum) then 'CEX'-- when address in (select distinct project_contract_address from dex.trades) then 'DEX'-- when address in (select distinct address from {{Blockchain}}.creation_traces)-- and address not in (select distinct project_contract_address from dex.trades) then 'Other Smart Contracts'-- else 'Individual Address'-- end as type,address,sum(amount/power(10,decimals)) as holding,sum(amount*price/power(10,decimals)) as holding_usd,sum(amount)/(select sum(amount) from raw where address not in (0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000dEaD,0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5,0x50BC5B35cD3d0A21fC5e45F0943fe0238770456A,0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf,0xa4F4f221b0b46CF40B55845Bf3759705CE7886bd,0xCb49f14b97C06B6E856daDdf5152aac011b3Ebb7,0x3deEb252a63E6B918e692564F2092D7955aCDa18,0x41C168A92e80bE8f0EaF36304e59568EC37ECed2,0x7fB4EC46c3e78048398B18d2952E25D5C581DD3b)) as percent_holdingsfrom price, rawwhere address not in (0x0000000000000000000000000000000000000000,0x000000000000000000000000000000000000dEaD,0xe0bCEEF36F3a6eFDd5EEBFACD591423f8549B9D5,0x50BC5B35cD3d0A21fC5e45F0943fe0238770456A,0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf,0xa4F4f221b0b46CF40B55845Bf3759705CE7886bd,0xCb49f14b97C06B6E856daDdf5152aac011b3Ebb7,0x3deEb252a63E6B918e692564F2092D7955aCDa18,0x41C168A92e80bE8f0EaF36304e59568EC37ECed2,0x7fB4EC46c3e78048398B18d2952E25D5C581DD3b)group by 1)awhere holding_usd>1group by 1