Skip to content
Dune Analytics

@devinwalsh / Fork of (#1005) Collateral USD value per day

Fork of (#1005) Collateral USD value per day

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 results

Loading
 

SQL query

1WITH raw AS 
2  (
3  SELECT date_trunc('day', evt_block_time) AS day,
4             contract_address,
5           SUM(amount) AS amount
6   FROM (
7           ((SELECT evt_block_time, SUM(value/1e18) AS amount, contract_address
8           FROM erc20."ERC20_evt_Transfer"
9            WHERE contract_address = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
10            AND "to" = '\x2f0b23f53734252bda2277357e97e1517d6b042a'
11            GROUP BY 1,3))
12         UNION ALL
13         (SELECT evt_block_time, -SUM(value/1e18) AS amount, contract_address
14         FROM erc20."ERC20_evt_Transfer"
15            WHERE contract_address = '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
16            AND "from" = '\x2f0b23f53734252bda2277357e97e1517d6b042a'
17            GROUP BY 1,3)) t
18   GROUP BY 1, 2
19 
20 UNION ALL  
21 
22 SELECT date_trunc('day', evt_block_time) AS day,
23            contract_address,
24           SUM(amount) AS amount
25           ...