Query editor
with staking_balance as (selectsum(casewhen "to" = 0x23ebc3770f98c01edab20eb1ef17ee633c19b467 then amountwhen "from" = 0x23ebc3770f98c01edab20eb1ef17ee633c19b467 then -amountelse 0end) as staked_wccfrom tokens.transferswhere blockchain = 'bnb'and contract_address = 0x6050d829f5a5e0ea758d8357ddcdec1381699248and ("to" = 0x23ebc3770f98c01edab20eb1ef17ee633c19b467or "from" = 0x23ebc3770f98c01edab20eb1ef17ee633c19b467)),latest_price as (selectcasewhen token_bought_address = 0x6050d829f5a5e0ea758d8357ddcdec1381699248and token_sold_address = 0x55d398326f99059ff775485246999027b3197955and cast(token_bought_amount as double) > 0then cast(token_sold_amount as double) / cast(token_bought_amount as double)when token_sold_address = 0x6050d829f5a5e0ea758d8357ddcdec1381699248and token_bought_address = 0x55d398326f99059ff775485246999027b3197955and cast(token_sold_amount as double) > 0then cast(token_bought_amount as double) / cast(token_sold_amount as double)else nullend as price_usd,block_timefrom dex.tradeswhere blockchain = 'bnb'and ((token_bought_address = 0x6050d829f5a5e0ea758d8357ddcdec1381699248and token_sold_address = 0x55d398326f99059ff775485246999027b3197955)or (token_sold_address = 0x6050d829f5a5e0ea758d8357ddcdec1381699248and token_bought_address = 0x55d398326f99059ff775485246999027b3197955))),last_nonzero_price as (select price_usdfrom latest_pricewhere price_usd is not nulland price_usd > 0and price_usd < 1000order by block_time desclimit 1)selectstaked_wcc,price_usd,staked_wcc * price_usd as ea_finance_tvl_usdfrom staking_balancecross join last_nonzero_price