Query editor
/*This query retrieves the present amount of stETH liquidity in USD and the TVL in USD for the current date*/-- to retrieve daily amounts of (w)stETH involved in unwrapping and wrapping transactions-- for the further calculation of wstETH:stETHwith volumes AS (SELECTu.call_block_time AS time,"output_0" AS steth,"_wstETHAmount" AS wstethFROMlido_ethereum.WstETH_call_unwrap uWHERE"call_success" = TRUEUNION allSELECTu."call_block_time","_stETHAmount" AS steth,"output_0" AS wstethFROMlido_ethereum.WstETH_call_wrap uWHERE"call_success" = TRUE)-- to calculate the current rate of wstETH:stETH from CTE 'volumes', wsteth_rate AS (SELECT SUM(cast(steth AS DOUBLE)) / SUM(cast(wsteth AS DOUBLE)) AS rateFROMvolumes vWHERE date_trunc('day', v.time) = date_trunc('day', now()))SELECTSUM(liquidity_usd) AS liquidity_usd,SUM(tvl) AS tvl,SUM(steth_amount) as steth_amountFROM( --this subquery calculates the pared token reserve in USD and TVL in USD filtering for the current dateSELECTSUM(paired_token_usd_reserve) AS liquidity_usd,SUM(main_token_usd_reserve) + SUM(paired_token_usd_reserve) AS tvl,SUM(CASEWHEN lower(main_token_symbol) = 'steth' THEN main_token_reserveELSE main_token_reserve * (select rate from wsteth_rate)END) AS steth_amountFROMlido.liquidityWHEREcast(time AS DATE) = cast(now() AS DATE)UNION all--this subquery calculates the two pared token reserves in USD and tvl in USD filtering for the current dateSELECTSUM(paired_token_usd_reserve) + SUM(paired1_token_usd_reserve) AS liquidity_usd,SUM(main_token_usd_reserve) + SUM(paired_token_usd_reserve) + SUM(paired1_token_usd_reserve) AS tvl,SUM(main_token_reserve * (select rate from wsteth_rate)) as steth_amount