Skip to content
Dune Analytics

@milkyklim / YFI Staked

YFI Staked

Loading
 

About queries and results

Dune Analytics lets you explore, create, and share Ethereum analytics. You can find an endless amount of great queries and dashboards on Dune.

We have decoded Ethereum smart contract data so you can do powerful analysis with simple SQL queries and visualise the query results into beautiful graphs.

Dune Analytics is free for everyone forever. If you want extra features like private queries, export your results and more check out our Pro plan.

SQL query

1with s as (
2    select date_trunc('week', evt_block_time) as time,
3           sum(amount) as amount,
4           'staked' as status 
5    from yearn."YearnGovernance_YFI_evt_Staked"
6    group by time
7),
8w as (
9    select date_trunc('week', evt_block_time) as time,
10           sum(amount) as amount,
11           'withdrawn' as status 
12    from yearn."YearnGovernance_YFI_evt_Withdrawn"
13    group by time
14),
15g as (
16    select s.time,
17           s.amount - w.amount as amount
18    from s 
19    left join w 
20        on s.time = w.time
21)
22select time,
23       sum(amount / 1e18) over (order by time asc rows unbounded preceding) as staked,
24       30000 - sum(amount / 1e18) over (order by time asc rows unbounded preceding) as unstaked
25from g...

SQL query results

Loading