Skip to content
Dune Analytics

@overanalyser / Fork of (#11992) Tellor Balance

Fork of (#11992) Tellor Balance


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


SQL query

1WITH transfers AS (
2    SELECT                                                                           
3        substring(topic2 from 13) AS sender,                                         
4        substring(topic3 from 13) AS receiver,                                       
5        bytea2numeric(data)/1e18 AS value
6    FROM ethereum.logs l 
7    WHERE topic1='\xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- Filter by Transfer events
8    AND contract_address = '\x0ba45a8b5d5575935b8158a88c631e9f9c95a2e5' -- Tellor address. Fork and change this line to use for other token
9    AND topic2 IS NOT NULL                                                           
10    AND topic3 IS NOT NULL                                                           
12SELECT wallet, SUM(amt) as balance
13FROM (
14    SELECT sender as wallet, -SUM(value) as amt FROM transfers GROUP BY sender
15    UNION
16    SELECT receiver as wallet, SUM(value) as amt FROM transfers GROUP BY receiver    
17) a
18GROUP BY wallet
19ORDER BY balance desc