1515 SELECT tc .evt_block_time AS block_time
1616 , ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
1717 , ' ETH' AS currency_symbol
18- , ' Ethereum ' AS blockchain
19- , ' Classic ' AS tornado_version
18+ , ' ethereum ' AS blockchain
19+ , ' classic ' AS tornado_version
2020 , et .from AS depositor
2121 , tc .contract_address AS contract_address
2222 , CASE WHEN tc .contract_address = ' 0x12d66f87a04a9e220743712ce6d9bb1b5616b8fc' THEN 0 .1
2929 , tc .evt_index
3030 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
3131 FROM {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }} tc
32- LEFT JOIN {{ source(' ethereum' ,' transactions_0006 ' ) }} et
32+ INNER JOIN {{ source(' ethereum' ,' transactions ' ) }} et
3333 ON et .hash = tc .evt_tx_hash
3434 {% if not is_incremental() %}
3535 AND et .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }})
3636 {% endif %}
3737 {% 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 ' )
3939 {% endif %}
4040 {% if not is_incremental() %}
4141 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' eth_evt_Deposit' ) }})
4242 {% endif %}
4343 {% 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 ' )
4545 {% endif %}
4646
4747 UNION
9494 WHEN tc .contract_address = ' 0x610b717796ad172b316836ac95a2ffad065ceab4' THEN ' WBTC'
9595 WHEN tc .contract_address = ' 0xbb93e510bbcd0b7beb5a853875f9ec60275cf498' THEN ' WBTC'
9696 END AS currency_symbol
97- , ' Ethereum ' AS blockchain
98- , ' Classic ' AS tornado_version
97+ , ' ethereum ' AS blockchain
98+ , ' classic ' AS tornado_version
9999 , et .from AS depositor
100100 , tc .contract_address AS contract_address
101101 , CASE WHEN tc .contract_address = ' 0xd4b88df4d29f5cedd6857912842cff3b20c8cfa3' THEN 100
@@ -126,19 +126,19 @@ FROM
126126 , tc .evt_index
127127 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
128128 FROM {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }} tc
129- LEFT JOIN {{ source(' ethereum' ,' transactions_0006 ' ) }} et
129+ INNER JOIN {{ source(' ethereum' ,' transactions ' ) }} et
130130 ON et .hash = tc .evt_tx_hash
131131 {% if not is_incremental() %}
132132 AND et .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }})
133133 {% endif %}
134134 {% 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 ' )
136136 {% endif %}
137137 {% if not is_incremental() %}
138138 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_ethereum' ,' erc20_evt_Deposit' ) }})
139139 {% endif %}
140140 {% 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 ' )
142142 {% endif %}
143143
144144 UNION
147147 SELECT tc .evt_block_time AS block_time
148148 , ' 0xb8c77482e45f1f44de1745f52c74426c631bdd52' AS currency_contract
149149 , ' BNB' AS currency_symbol
150- , ' BNB ' AS blockchain
151- , ' Classic ' AS tornado_version
150+ , ' bnb ' AS blockchain
151+ , ' classic ' AS tornado_version
152152 , bt .from AS depositor
153153 , tc .contract_address AS contract_address
154154 , CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -161,19 +161,19 @@ FROM
161161 , tc .evt_index
162162 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
163163 FROM {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }} tc
164- LEFT JOIN {{ source(' bnb' ,' transactions' ) }} bt
164+ INNER JOIN {{ source(' bnb' ,' transactions' ) }} bt
165165 ON bt .hash = tc .evt_tx_hash
166166 {% if not is_incremental() %}
167167 AND bt .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }})
168168 {% endif %}
169169 {% 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 ' )
171171 {% endif %}
172172 {% if not is_incremental() %}
173173 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_bnb' ,' TornadoCashBNB_evt_Deposit' ) }})
174174 {% endif %}
175175 {% 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 ' )
177177 {% endif %}
178178
179179 UNION
182182 SELECT tc .evt_block_time AS block_time
183183 , ' 0x6b175474e89094c44da98b954eedeac495271d0f' AS currency_contract
184184 , ' xDAI' AS currency_symbol
185- , ' Gnosis ' AS blockchain
186- , ' Classic ' AS tornado_version
185+ , ' gnosis ' AS blockchain
186+ , ' classic ' AS tornado_version
187187 , gt .from AS depositor
188188 , tc .contract_address AS contract_address
189189 , CASE WHEN tc .contract_address = ' 0x1e34a77868e19a6647b1f2f47b51ed72dede95dd' THEN 100
@@ -196,19 +196,19 @@ FROM
196196 , tc .evt_index
197197 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
198198 FROM {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }} tc
199- LEFT JOIN {{ source(' gnosis' ,' transactions' ) }} gt
199+ INNER JOIN {{ source(' gnosis' ,' transactions' ) }} gt
200200 ON gt .hash = tc .evt_tx_hash
201201 {% if not is_incremental() %}
202202 AND gt .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }})
203203 {% endif %}
204204 {% 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 ' )
206206 {% endif %}
207207 {% if not is_incremental() %}
208208 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_gnosis' ,' eth_evt_Deposit' ) }})
209209 {% endif %}
210210 {% 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 ' )
212212 {% endif %}
213213
214214 UNION
217217 SELECT tc .evt_block_time AS block_time
218218 , ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
219219 , ' ETH' AS currency_symbol
220- , ' Optimism ' AS blockchain
221- , ' Classic ' AS tornado_version
220+ , ' optimism ' AS blockchain
221+ , ' classic ' AS tornado_version
222222 , ot .from AS depositor
223223 , tc .contract_address AS contract_address
224224 , CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -231,19 +231,19 @@ FROM
231231 , tc .evt_index
232232 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
233233 FROM {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }} tc
234- LEFT JOIN {{ source(' optimism' ,' transactions' ) }} ot
234+ INNER JOIN {{ source(' optimism' ,' transactions' ) }} ot
235235 ON ot .hash = tc .evt_tx_hash
236236 {% if not is_incremental() %}
237237 AND ot .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }})
238238 {% endif %}
239239 {% 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 ' )
241241 {% endif %}
242242 {% if not is_incremental() %}
243243 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_optimism' ,' ETHTornado_evt_Deposit' ) }})
244244 {% endif %}
245245 {% 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 ' )
247247 {% endif %}
248248
249249 UNION
252252 SELECT tc .evt_block_time AS block_time
253253 , ' 0x85f138bfEE4ef8e540890CFb48F620571d67Eda3' AS currency_contract
254254 , ' AVAX' AS currency_symbol
255- , ' Avalanche ' AS blockchain
256- , ' Classic ' AS tornado_version
255+ , ' avalanche_c ' AS blockchain
256+ , ' classic ' AS tornado_version
257257 , at .from AS depositor
258258 , tc .contract_address AS contract_address
259259 , CASE WHEN tc .contract_address = ' 0x330bdfade01ee9bf63c209ee33102dd334618e0a' THEN 10
@@ -265,19 +265,19 @@ FROM
265265 , tc .evt_index
266266 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
267267 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
269269 ON at .hash = tc .evt_tx_hash
270270 {% if not is_incremental() %}
271271 AND at .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_avalanche_c' ,' ETHTornado_evt_Deposit' ) }})
272272 {% endif %}
273273 {% 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 ' )
275275 {% endif %}
276276 {% if not is_incremental() %}
277277 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_avalanche_c' ,' ETHTornado_evt_Deposit' ) }})
278278 {% endif %}
279279 {% 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 ' )
281281 {% endif %}
282282
283283 UNION
286286 SELECT tc .evt_block_time AS block_time
287287 , ' 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' AS currency_contract
288288 , ' ETH' AS currency_symbol
289- , ' Arbitrum ' AS blockchain
290- , ' Classic ' AS tornado_version
289+ , ' arbitrum ' AS blockchain
290+ , ' classic ' AS tornado_version
291291 , at .from AS depositor
292292 , tc .contract_address AS contract_address
293293 , CASE WHEN tc .contract_address = ' 0x84443cfd09a48af6ef360c6976c5392ac5023a1f' THEN 0 .1
@@ -300,18 +300,18 @@ FROM
300300 , tc .evt_index
301301 , TRY_CAST(date_trunc(' DAY' , tc .evt_block_time ) AS date ) AS block_date
302302 FROM {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }} tc
303- LEFT JOIN {{ source(' arbitrum' ,' transactions' ) }} at
303+ INNER JOIN {{ source(' arbitrum' ,' transactions' ) }} at
304304 ON at .hash = tc .evt_tx_hash
305305 {% if not is_incremental() %}
306306 AND at .block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }})
307307 {% endif %}
308308 {% 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 ' )
310310 {% endif %}
311311 {% if not is_incremental() %}
312312 WHERE tc .evt_block_time >= (select min (evt_block_time) from {{ source(' tornado_cash_arbitrum' ,' ETHTornado_evt_Deposit' ) }})
313313 {% endif %}
314314 {% 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 ' )
316316 {% endif %}
317317)
0 commit comments