Skip to content
Dune Analytics

@overanalyser / Token based current composition of $DPI

Value of each component in $DPIToken based current composition of $DPI

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 tokens (symbol) AS (VALUES ('MKR'), ('AAVE'), ('YFI'), ('UNI'), ('COMP'), ('REN'), ('LRC'), ('KNC'), ('SNX'), ('BAL'), ('REP')),
2addresses(addr) AS (SELECT contract_address FROM erc20.tokens where symbol in (select symbol from tokens))
3SELECT 
4contract_address,
5sum(amt) * (SELECT p.price/10^p.decimals FROM prices.usd p WHERE p.contract_address = x.contract_address ORDER BY minute DESC LIMIT 1) as usd
6FROM (
7    SELECT contract_address, value as amt
8    FROM erc20."ERC20_evt_Transfer"
9    WHERE  contract_address IN (SELECT addr from addresses)
10    AND "to" = '\x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b'
11    UNION ALL
12    SELECT contract_address, -value as amt
13    FROM erc20."ERC20_evt_Transfer"
14    WHERE  contract_address IN (SELECT addr FROM addresses)
15    AND "from" = '\x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b'
16 ) x
17
18
19
20GROUP BY 1 order by 2

Result visualizations

% of each token in $DPIToken based current composition of $DPI

Loading