15
15
SELECT tc .evt_block_time AS block_time
16
16
, ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
17
17
, ' ETH' AS currency_symbol
18
- , ' Ethereum ' AS blockchain
19
- , ' Classic ' AS tornado_version
18
+ , ' ethereum ' AS blockchain
19
+ , ' classic ' AS tornado_version
20
20
, et .from AS depositor
21
21
, tc .contract_address AS contract_address
22
22
, CASE WHEN tc .contract_address = ' 0x12d66f87a04a9e220743712ce6d9bb1b5616b8fc' THEN 0 .1
29
29
, tc .evt_index
30
30
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
31
31
FROM {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }} tc
32
- LEFT JOIN {{ source(' ethereum' ,' transactions_0006 ' ) }} et
32
+ INNER JOIN {{ source(' ethereum' ,' transactions ' ) }} et
33
33
ON et .hash = tc .evt_tx_hash
34
34
{% if not is_incremental() %}
35
35
AND et .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }})
36
36
{% endif %}
37
37
{% if is_incremental() %}
38
- AND et .block_time >= ( select max (block_time) from {{ this }} )
38
+ AND et .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
39
39
{% endif %}
40
40
{% if not is_incremental() %}
41
41
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }})
42
42
{% endif %}
43
43
{% if is_incremental() %}
44
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
44
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
45
45
{% endif %}
46
46
47
47
UNION
94
94
WHEN tc .contract_address = ' 0x610b717796ad172b316836ac95a2ffad065ceab4' THEN ' WBTC'
95
95
WHEN tc .contract_address = ' 0xbb93e510bbcd0b7beb5a853875f9ec60275cf498' THEN ' WBTC'
96
96
END AS currency_symbol
97
- , ' Ethereum ' AS blockchain
98
- , ' Classic ' AS tornado_version
97
+ , ' ethereum ' AS blockchain
98
+ , ' classic ' AS tornado_version
99
99
, et .from AS depositor
100
100
, tc .contract_address AS contract_address
101
101
, CASE WHEN tc .contract_address = ' 0xd4b88df4d29f5cedd6857912842cff3b20c8cfa3' THEN 100
@@ -126,19 +126,19 @@ FROM
126
126
, tc .evt_index
127
127
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
128
128
FROM {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }} tc
129
- LEFT JOIN {{ source(' ethereum' ,' transactions_0006 ' ) }} et
129
+ INNER JOIN {{ source(' ethereum' ,' transactions ' ) }} et
130
130
ON et .hash = tc .evt_tx_hash
131
131
{% if not is_incremental() %}
132
132
AND et .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }})
133
133
{% endif %}
134
134
{% if is_incremental() %}
135
- AND et .block_time >= ( select max (block_time) from {{ this }} )
135
+ AND et .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
136
136
{% endif %}
137
137
{% if not is_incremental() %}
138
138
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }})
139
139
{% endif %}
140
140
{% if is_incremental() %}
141
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
141
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
142
142
{% endif %}
143
143
144
144
UNION
147
147
SELECT tc .evt_block_time AS block_time
148
148
, ' 0xb8c77482e45f1f44de1745f52c74426c631bdd52' AS currency_contract
149
149
, ' BNB' AS currency_symbol
150
- , ' BNB ' AS blockchain
151
- , ' Classic ' AS tornado_version
150
+ , ' bnb ' AS blockchain
151
+ , ' classic ' AS tornado_version
152
152
, bt .from AS depositor
153
153
, tc .contract_address AS contract_address
154
154
, CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -161,19 +161,19 @@ FROM
161
161
, tc .evt_index
162
162
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
163
163
FROM {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }} tc
164
- LEFT JOIN {{ source(' bnb' ,' transactions' ) }} bt
164
+ INNER JOIN {{ source(' bnb' ,' transactions' ) }} bt
165
165
ON bt .hash = tc .evt_tx_hash
166
166
{% if not is_incremental() %}
167
167
AND bt .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }})
168
168
{% endif %}
169
169
{% if is_incremental() %}
170
- AND bt .block_time >= ( select max (block_time) from {{ this }} )
170
+ AND bt .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
171
171
{% endif %}
172
172
{% if not is_incremental() %}
173
173
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }})
174
174
{% endif %}
175
175
{% if is_incremental() %}
176
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
176
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
177
177
{% endif %}
178
178
179
179
UNION
182
182
SELECT tc .evt_block_time AS block_time
183
183
, ' 0x6b175474e89094c44da98b954eedeac495271d0f' AS currency_contract
184
184
, ' xDAI' AS currency_symbol
185
- , ' Gnosis ' AS blockchain
186
- , ' Classic ' AS tornado_version
185
+ , ' gnosis ' AS blockchain
186
+ , ' classic ' AS tornado_version
187
187
, gt .from AS depositor
188
188
, tc .contract_address AS contract_address
189
189
, CASE WHEN tc .contract_address = ' 0x1e34a77868e19a6647b1f2f47b51ed72dede95dd' THEN 100
@@ -196,19 +196,19 @@ FROM
196
196
, tc .evt_index
197
197
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
198
198
FROM {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }} tc
199
- LEFT JOIN {{ source(' gnosis' ,' transactions' ) }} gt
199
+ INNER JOIN {{ source(' gnosis' ,' transactions' ) }} gt
200
200
ON gt .hash = tc .evt_tx_hash
201
201
{% if not is_incremental() %}
202
202
AND gt .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }})
203
203
{% endif %}
204
204
{% if is_incremental() %}
205
- AND gt .block_time >= ( select max (block_time) from {{ this }} )
205
+ AND gt .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
206
206
{% endif %}
207
207
{% if not is_incremental() %}
208
208
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }})
209
209
{% endif %}
210
210
{% if is_incremental() %}
211
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
211
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
212
212
{% endif %}
213
213
214
214
UNION
217
217
SELECT tc .evt_block_time AS block_time
218
218
, ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
219
219
, ' ETH' AS currency_symbol
220
- , ' Optimism ' AS blockchain
221
- , ' Classic ' AS tornado_version
220
+ , ' optimism ' AS blockchain
221
+ , ' classic ' AS tornado_version
222
222
, ot .from AS depositor
223
223
, tc .contract_address AS contract_address
224
224
, CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -231,19 +231,19 @@ FROM
231
231
, tc .evt_index
232
232
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
233
233
FROM {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }} tc
234
- LEFT JOIN {{ source(' optimism' ,' transactions' ) }} ot
234
+ INNER JOIN {{ source(' optimism' ,' transactions' ) }} ot
235
235
ON ot .hash = tc .evt_tx_hash
236
236
{% if not is_incremental() %}
237
237
AND ot .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }})
238
238
{% endif %}
239
239
{% if is_incremental() %}
240
- AND ot .block_time >= ( select max (block_time) from {{ this }} )
240
+ AND ot .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
241
241
{% endif %}
242
242
{% if not is_incremental() %}
243
243
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }})
244
244
{% endif %}
245
245
{% if is_incremental() %}
246
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
246
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
247
247
{% endif %}
248
248
249
249
UNION
252
252
SELECT tc .evt_block_time AS block_time
253
253
, ' 0x85f138bfEE4ef8e540890CFb48F620571d67Eda3' AS currency_contract
254
254
, ' AVAX' AS currency_symbol
255
- , ' Avalanche ' AS blockchain
256
- , ' Classic ' AS tornado_version
255
+ , ' avalanche_c ' AS blockchain
256
+ , ' classic ' AS tornado_version
257
257
, at .from AS depositor
258
258
, tc .contract_address AS contract_address
259
259
, CASE WHEN tc .contract_address = ' 0x330bdfade01ee9bf63c209ee33102dd334618e0a' THEN 10
@@ -265,19 +265,19 @@ FROM
265
265
, tc .evt_index
266
266
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
267
267
FROM {{ source(' tornado_cash_avalanche_c' ,' ETHTornado_evt_Deposit' ) }} tc
268
- LEFT JOIN {{ source(' avalanche_c' ,' transactions' ) }} at
268
+ INNER JOIN {{ source(' avalanche_c' ,' transactions' ) }} at
269
269
ON at .hash = tc .evt_tx_hash
270
270
{% if not is_incremental() %}
271
271
AND at .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_avalanche_c' ,' ETHTornado_evt_Deposit' ) }})
272
272
{% endif %}
273
273
{% if is_incremental() %}
274
- AND at .block_time >= ( select max (block_time) from {{ this }} )
274
+ AND at .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
275
275
{% endif %}
276
276
{% if not is_incremental() %}
277
277
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_avalanche_c' ,' ETHTornado_evt_Deposit' ) }})
278
278
{% endif %}
279
279
{% if is_incremental() %}
280
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
280
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
281
281
{% endif %}
282
282
283
283
UNION
286
286
SELECT tc .evt_block_time AS block_time
287
287
, ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
288
288
, ' ETH' AS currency_symbol
289
- , ' Arbitrum ' AS blockchain
290
- , ' Classic ' AS tornado_version
289
+ , ' arbitrum ' AS blockchain
290
+ , ' classic ' AS tornado_version
291
291
, at .from AS depositor
292
292
, tc .contract_address AS contract_address
293
293
, CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -300,18 +300,18 @@ FROM
300
300
, tc .evt_index
301
301
, TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
302
302
FROM {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }} tc
303
- LEFT JOIN {{ source(' arbitrum' ,' transactions' ) }} at
303
+ INNER JOIN {{ source(' arbitrum' ,' transactions' ) }} at
304
304
ON at .hash = tc .evt_tx_hash
305
305
{% if not is_incremental() %}
306
306
AND at .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }})
307
307
{% endif %}
308
308
{% if is_incremental() %}
309
- AND at .block_time >= ( select max (block_time) from {{ this }} )
309
+ AND at .block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
310
310
{% endif %}
311
311
{% if not is_incremental() %}
312
312
WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }})
313
313
{% endif %}
314
314
{% if is_incremental() %}
315
- WHERE tc .evt_block_time >= ( select max (block_time) from {{ this }} )
315
+ WHERE tc .evt_block_time >= date_trunc( " day " , now() - interval ' 1 week ' )
316
316
{% endif %}
317
317
)
0 commit comments