Skip to content
Dune Analytics

@pengiundev / curve.fi all liquidity

curve.fi all liquidity

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 timeseries as (select coalesce(a.day,b.day) as day, 
2max(case when b.busd > 0 then b.busd else a.busd end) as busd, 
3max(case when a.y > 0 then a.y else b.y end) as y, 
4max(case when b.usdt > 0 then b.usdt else a.usdt end) as usdt, 
5max(case when b.compound > 0 then b.compound else a.compound end) as compound,
6max(case when b.susd > 0 then b.susd else a.susd end) as susd,
7max(case when b.susdv2 > 0 then b.susdv2 else a.susdv2 end) as susdv2,
8max(case when b.pax > 0 then b.pax else a.pax end) as pax,
9max(case when b.ren > 0 then b.ren else a.ren end) as ren,
10max(case when b.sbtc > 0 then b.sbtc else a.sbtc end) as sbtc,
11max(case when b.hbtc > 0 then b.hbtc else a.hbtc end) as hbtc,
12max(case when b.TriPool > 0 then b.TriPool else a.TriPool end) as TriPool
13from (
14
15select date_trunc('day', evt_block_time) AS day, max(a.mx) AS mx, 0 AS busd, max((token_supply/1e18)) AS y, 0 AS usdt, 0 AS compound, 0 as susd, 0 as susdv2, 0 as pax, 0 as ren, 0 as sbtc, 0 as hbtc, 0 as TriPool from curvefi."y_evt_AddLiquidity" csa
16INNER JOIN (select date_trunc('day', evt_block_time) AS day, max(evt_block_time) mx from curvefi."y_evt_AddLiquidity" csa group by 1) a ON a.mx = evt_block_time and date_trunc('day', evt_block_time) = a.day   group by 1
17
18union
19
20select date_trunc('day', evt_block_time) AS day, max(a.mx) AS mx, 0 AS busd, 0 AS y, 0 AS usdt, 0 AS compound, max((token_supply/1e18)) as susd, 0 as susdv2, 0 as pax, 0 as ren, 0 as sbtc, 0 as hbtc, 0 as TriPool from curvefi."susd_evt_AddLiquidity" csa
21INNER JOIN (select date_trunc('day', evt_block_time) AS day, max(evt_block_time) mx from curvefi."susd_evt_AddLiquidity" csa group by 1) a ON a.mx = evt_block_time and date_trunc('day', evt_block_time) = a.day   group by 1
22
23union
24
25select date_trunc('day', evt_block_time) AS day, max(a.mx) AS mx, 0 AS busd, 0 AS y, max((token_supply/1e18)) AS usdt, 0 AS compound, 0 as susd, 0 as susdv2, 0 as pax, 0 as ren, 0 as sbtc, 0 as hbtc, 0 as TriPool from curvefi."usdt_evt_AddLiquidity" csa...

SQL query results

Loading