Skip to content

Commit 92bbeb5

Browse files
author
BigQuery AutoFormatter
committed
Auto-format queries
1 parent 7dc65c7 commit 92bbeb5

File tree

2 files changed

+48
-37
lines changed

2 files changed

+48
-37
lines changed

dune/gas/MEV_ZeroCostTx.sql

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
select t.*, b.miner --t.block_time, t.success, t."hash", t."from", t."to", b.miner, t.index, t.gas_used, t.nonce, t.block_number, t.block_hash, t.gas_limit, t.gas_price, t.data
2-
from ethereum.transactions t
3-
join ethereum.blocks b
4-
on t.block_hash = b.hash
5-
where t.gas_price = 0
6-
and t.block_time >= '2021-01-01'
1+
SELECT
2+
t.*,
3+
b.miner --t.block_time, t.success, t."hash", t."from", t."to", b.miner, t.index, t.gas_used, t.nonce, t.block_number, t.block_hash, t.gas_limit, t.gas_price, t.data
4+
FROM
5+
ethereum.transactions AS t
6+
JOIN
7+
ethereum.blocks AS b
8+
ON t.block_hash = b.`hash`
9+
WHERE
10+
t.gas_price = 0 AND t.block_time >= '2021-01-01';

dune/gas/TotalDeposits_Coinbase.sql

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
1-
SELECT address, time, sum(amount/ 1e18) over(order by time)
2-
FROM (
3-
4-
-- outbound transfers
5-
SELECT "from" AS address, -tr.value AS amount , date_trunc('day', block_time) as time
6-
FROM ethereum.traces tr
7-
WHERE "from" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24'
8-
AND success
9-
AND (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS null)
10-
AND block_time > '2021-01-04'AND block_time < '2021-02-07'
11-
12-
13-
UNION ALL
14-
15-
-- inbound transfers
16-
SELECT "to" AS address, value AS amount ,date_trunc('day', block_time) as time
17-
FROM ethereum.traces
18-
WHERE "to" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24'
19-
AND success
20-
AND (call_type NOT IN ('delegatecall', 'callcode', 'staticcall') OR call_type IS null)
21-
AND block_time > '2021-01-04' AND block_time < '2021-02-07'
22-
23-
UNION ALL
24-
25-
-- gas costs
26-
SELECT "from" AS address, -gas_used * gas_price AS amount, date_trunc('day', block_time) as time
27-
FROM ethereum.transactions
28-
WHERE "from" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24'
29-
AND block_time > '2021-01-04'AND block_time < '2021-02-07'
30-
31-
) as t
1+
SELECT
2+
address,
3+
time,
4+
sum(amount / 1e18) OVER (
5+
ORDER BY time)
6+
FROM
7+
-- outbound transfers
8+
(
9+
SELECT
10+
"from" AS address,
11+
- tr.value AS amount,
12+
date_trunc('day', block_time) AS time
13+
FROM
14+
ethereum.traces AS tr
15+
WHERE
16+
"from" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24' AND success AND (call_type NOT IN ('delegatecall',
17+
'callcode', 'staticcall') OR call_type IS null) AND block_time > '2021-01-04' AND block_time < '2021-02-07'
18+
UNION ALL -- inbound transfers
19+
SELECT
20+
"to" AS address,
21+
value AS amount,
22+
date_trunc('day', block_time) AS time
23+
FROM
24+
ethereum.traces
25+
WHERE
26+
"to" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24' AND success AND (call_type NOT IN ('delegatecall',
27+
'callcode', 'staticcall') OR call_type IS null) AND block_time > '2021-01-04' AND block_time < '2021-02-07'
28+
UNION ALL -- gas costs
29+
SELECT
30+
"from" AS address,
31+
- gas_used * gas_price AS amount,
32+
date_trunc('day', block_time) AS time
33+
FROM
34+
ethereum.transactions
35+
WHERE
36+
"from" = '\x713E11c146911B2cBa7df18b89BFfaa64F2c9D24' AND block_time > '2021-01-04' AND block_time <
37+
'2021-02-07'
38+
) AS t;

0 commit comments

Comments
 (0)