WITH staked_eth AS(
SELECT
date(block_timestamp) AS date,
sum(event_inputs:amount/pow(10,18)) AS total_daily_eth, -- total ETH staked daily
sum(total_daily_eth) OVER (ORDER BY date) AS cumulative_eth -- cumulative ETH staked
FROM ethereum.core.fact_event_logs
WHERE origin_to_address = '0xae7ab96520de3a18e5e111b5eaab095312d7fe84' -- ETH sent to Lido contract address
AND tx_status = 'SUCCESS'
AND date >= dateadd(day, -90, GETDATE()) -- past 3 months
GROUP BY 1
ORDER BY 1
)
-- Labelling the variables --
SELECT
date as "Date",
total_daily_eth as "Daily stETH",
cumulative_eth as "Cumulative stETH"
FROM staked_eth;