Query editor
/**Data Lpsymbol Data Lpaddress Data LptokenpriceBUSD-BNB LP 0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16 47.690524650518592612USDT-BNB LP 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE 50.687153977806257119BTCB-BNB LP 0x61EB789d75A95CAa3fF50ed7E47b96c132fEc082 5870.021586862496719164ETH-BNB LP 0x74E4716E431f45807DCF19f284c7aA99F18a4fbc 1600.689194227472668205**/with pid as (select pidfrom pancakeswap_v2_bnb.MasterChefV2_evt_AddPoolwhere lptoken = 0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE), sumup as (select user, sum(amount)/power(10,18) * 50.687153977806257119 as amount_usdfrom (select user, cast(amount as decimal(38,0)) as amountfrom pancakeswap_v2_bnb.MasterChefV2_evt_Depositwhere pid = (select* from pid)union allselect user, cast(amount as decimal(38,0))* -1 as amountfrom pancakeswap_v2_bnb.MasterChefV2_evt_Withdrawwhere pid = (select* from pid))group by 1)select case when amount_usd >= 0 and amount_usd < 1 then '(1)$0-$1'when amount_usd >= 1 and amount_usd < 500 then '(2)$1-$500'when amount_usd >= 500 and amount_usd < 2000 then '(3)$500-$2k'when amount_usd >= 2000 and amount_usd < 5000 then '(4)$2-$5k'when amount_usd >= 5000 and amount_usd < 20000 then '(5)$5k-$20k'when amount_usd >= 20000 and amount_usd < 100000 then '(6)$20k-$100k'when amount_usd >= 100000 then '(7)>=$100k'else 'na' end as tvl_tier, count(distinct user) as n, sum(amount_usd) as tvl_usd, sum(amount_usd) / (select sum(amount_usd) from sumup) as tvl_percetangefrom sumupgroup by 1order by 1