ali_lifiBase - Collateral Swap
Updated 2025-01-15
999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
WITH
same_chain_txns as (
SELECT a.*, 'Arbitrum' as chain FROM arbitrum.core.ez_decoded_event_logs a, arbitrum.core.ez_decoded_event_logs b, arbitrum.core.ez_decoded_event_logs c
WHERE a.block_timestamp between current_date -31 AND current_date-1
AND b.block_timestamp between current_date -31 AND current_date-1
-- AND a.origin_to_address = '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
AND a.tx_hash = b.tx_hash and a.tx_hash = c.tx_hash
AND a.event_name = 'LiFiGenericSwapCompleted'
AND b.event_name = 'ReserveUsedAsCollateralEnabled' -- in ('ReserveUsedAsCollateralEnabled', 'ReserveUsedAsCollateralDisabled')
AND c.event_name = 'ReserveUsedAsCollateralDisabled' --in ('ReserveUsedAsCollateralEnabled', 'ReserveUsedAsCollateralDisabled')
UNION ALL
SELECT a.*, 'OP' as chain FROM optimism.core.ez_decoded_event_logs a,optimism.core.ez_decoded_event_logs b,optimism.core.ez_decoded_event_logs c
WHERE a.block_timestamp between current_date -31 AND current_date-1
AND b.block_timestamp between current_date -31 AND current_date-1
-- AND a.origin_to_address = '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
AND a.tx_hash = b.tx_hash and a.tx_hash = c.tx_hash
and a.event_name = 'LiFiGenericSwapCompleted'
AND b.event_name = 'ReserveUsedAsCollateralEnabled'
AND c.event_name = 'ReserveUsedAsCollateralDisabled'
UNION ALL
SELECT a.*, 'BSC' as chain FROM bsc.core.ez_decoded_event_logs a, bsc.core.ez_decoded_event_logs b , bsc.core.ez_decoded_event_logs c
WHERE a.block_timestamp between current_date -31 AND current_date-1
AND b.block_timestamp between current_date -31 AND current_date-1
-- AND a.origin_to_address = '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
AND a.tx_hash = b.tx_hash and a.tx_hash = c.tx_hash
and a.event_name = 'LiFiGenericSwapCompleted'
AND b.event_name = 'ReserveUsedAsCollateralEnabled'
AND c.event_name = 'ReserveUsedAsCollateralDisabled'
UNION ALL
SELECT a.*, 'BASE' as chain FROM base.core.ez_decoded_event_logs a, base.core.ez_decoded_event_logs b, base.core.ez_decoded_event_logs c
WHERE a.block_timestamp between current_date -31 AND current_date-1
AND b.block_timestamp between current_date -31 AND current_date-1
-- AND a.origin_to_address = '0x1231deb6f5749ef6ce6943a275a1d3e7486f4eae'
AND a.tx_hash = b.tx_hash and a.tx_hash = c.tx_hash
and a.event_name = 'LiFiGenericSwapCompleted'
AND b.event_name = 'ReserveUsedAsCollateralEnabled'
QueryRunArchived: QueryRun has been archived