Skip to content
Dune Analytics

@k06a / Cummulative Uniswap USD collected fees PER POOL (365 days) 🧮

Cummulative Uniswap USD collected fees PER POOL (365 days) 🧮

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

1SELECT
2    date_trunc('weeks', tx.block_time) AS Date,
3    ether.contract_address as pool_address,
4    (SELECT symbol FROM erc20.tokens WHERE contract_address =
5        (SELECT token FROM uniswap."Factory_evt_NewExchange" WHERE exchange = ether.contract_address LIMIT 1)
6    LIMIT 1) as pool,
7    SUM(eth*p.price)*0.003/1e18 AS fees,
8    SUM(SUM(eth*p.price)*0.003/1e18) OVER (PARTITION BY ether.contract_address ORDER BY date_trunc('weeks', tx.block_time)) AS TOTAL
9FROM (
10    SELECT evt_tx_hash, eth_sold AS eth, contract_address FROM uniswap."Exchange_evt_TokenPurchase" UNION ALL
11    SELECT evt_tx_hash, eth_bought AS eth, contract_address FROM uniswap."Exchange_evt_EthPurchase"
12) ether
13INNER JOIN (
14    SELECT hash, block_time FROM ethereum.transactions tx
15    WHERE tx.block_time > now() - interval '365 days'
16      AND block_time < date_trunc('day', NOW())
17) tx ON ether.evt_tx_hash = tx.hash
18INNER JOIN prices.usd p ON p.minute = date_trunc('minute', tx.block_time) WHERE p.symbol = 'ETH'
19GROUP BY 1, 2
20ORDER BY 1 DESC, 5 DESC;
21

SQL query results

Loading