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.
1 2-- Returns current usd value of specific listed tokens (by symbol) in a specific address 3 4WITH tokens (symbol) AS (VALUES ('MKR'), ('AAVE'), ('YFI'), ('UNI'), ('COMP'), ('SNX'), ('LINK')), 5addresses(addr) AS (SELECT contract_address FROM erc20.tokens where symbol in (select symbol from tokens)) 6 7-- specifies tokens to look at using erc20.token table 8 9SELECT 10x.contract_address, 11symbol, 12sum(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 13 14-- Reports contract address, symbol and the USD price for the total number of each token 15-- The next two blocks in the FROM (lines 17 - 27) total the number of tokens moving in and then the number of tokens moving out of the specified address. 16 17 From ( 18 SELECT contract_address, value as amt 19 FROM erc20."ERC20_evt_Transfer" 20 WHERE contract_address IN (SELECT addr from addresses) 21 AND "to" = '\x0e5c1813587088378787e7dd6c9cb4cb01a0ea18' 22 UNION ALL 23 SELECT contract_address, -value as amt 24 FROM erc20."ERC20_evt_Transfer" 25 WHERE contract_address IN (SELECT addr FROM addresses)...