Skip to content
Dune Analytics

@ashachaf / Bancor v2 Volume (hour)

Bancor v2 Volume (hour)

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 view_convert AS (
2    SELECT 
3           "_fromToken" AS source_token_address,
4           t1.symbol AS source_token_symbol,
5           "_toToken" AS target_token_address,
6           t2.symbol AS target_token_symbol,
7           "_amount" / 10^t1.decimals AS source_token_amount,
8           "_return" / 10^t2.decimals AS target_token_amount,
9           "_amount" AS source_token_amount_raw,
10           "_return" AS target_token_amount_raw,
11           "_trader" AS trader,
12           s.contract_address,
13           evt_tx_hash AS tx_hash,
14           evt_index,
15           evt_block_time AS block_time
16    FROM bancornetwork."BancorConverter_evt_Conversion" s
17    LEFT JOIN erc20.tokens t1 ON s."_fromToken" = t1.contract_address
18    LEFT JOIN erc20.tokens t2 ON s."_toToken" = t2.contract_address
19),
20conversions AS (
21    SELECT 
22        source_token_amount, 
23        CASE WHEN source_token_address = '\xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' THEN
24            '\xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'::bytea -- use weth
25        ELSE source_token_address...