Skip to content
Dune Analytics

@Brecht / Loopring Volume Per Day

Loopring Volume Per Day

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

1WITH trades AS (
2    SELECT loopring.fn_process_trade_block(CAST(b."blockSize" AS INT), b._3, b.call_block_time) as trade
3    FROM loopring."DEXBetaV1_call_commitBlock" b
4    WHERE b."blockType" = '0'
5), exchange_tokens AS (
6    SELECT 0 AS "tokenId", '\x0000000000000000000000000000000000000000' AS token, 'WETH' AS "symbol", 18 AS decimals
7        UNION
8    SELECT "tokenId", "token", "symbol", "decimals"
9    FROM loopring."DEXBetaV1_evt_TokenRegistered" e
10    LEFT JOIN erc20.tokens t ON t.contract_address = e."token"
11    WHERE token != '\x0000000000000000000000000000000000000000'
12    ORDER BY "tokenId"
13), token_table AS (
14    SELECT p.minute, p.contract_address, p.symbol, p.price, et."tokenId", et."decimals"
15    FROM prices.usd p
16    INNER JOIN exchange_tokens et ON p.symbol = et.symbol
17), volume_data AS (
18    SELECT (t.trade).block_timestamp as block_timestamp,
19           (CASE WHEN (t.trade).tokenA < (t.trade).tokenB THEN (t.trade).tokenA ELSE (t.trade).tokenB END) as token,
20           (CASE WHEN (t.trade).tokenA < (t.trade).tokenB THEN (t.trade).fillA ELSE (t.trade).fillB END) as amount
21    FROM trades t
22), token_totals AS (
23    SELECT date_trunc('minute', t.block_timestamp) as block_timestamp,
24        t.token as token,
25        SUM(...

SQL query results

Loading