SocioAnalyticamain query V3
Updated 2024-03-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 created_pools as (
select
REGEXP_SUBSTR_ALL(SUBSTR(data, 3, len(data)), '.{64}') as segmented_data,
lower('0x' || substr(topics[1]::string, 27, 40) :: string) as token0,
lower('0x' || substr(topics[2]::string, 27, 40) :: string) as token1,
lower('0x' || substr(segmented_data[1]::string, 25, 40 ) :: string) as pool_address
from blast.core.fact_event_logs
where contract_address = '0x71b08f13b3c3af35aadeb3949afeb1ded1016127'
and topics[0] = '0x783cca1c0412dd0d695e784568c96da2e9c22ff989357a2e8b1d9b2b4e6b7118'
and tx_status = 'SUCCESS'
)
,
swap as (
select
block_timestamp,
block_number,
origin_from_address,
origin_to_address,
ORIGIN_FUNCTION_SIGNATURE,
tx_hash,
event_index,
contract_address,
lower('0x' || substr(topics[1]::string, 27, 40) :: string) as sender_address,
lower('0x' || substr(topics[2]::string, 27, 40) :: string) as recipient_address,
REGEXP_SUBSTR_ALL(SUBSTR(data, 3, len(data)), '.{64}') as segmented_data,
livequery.utils.udf_hex_to_int('s2c',segmented_data[0]::string) :: int as amount_0,
livequery.utils.udf_hex_to_int('s2c',segmented_data[1]::string) :: int as amount_1
from blast.core.fact_event_logs
where topics[0] = '0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67'
and block_timestamp::date >= '2024-02-28'
and tx_status = 'SUCCESS'
)
,
result as (
QueryRunArchived: QueryRun has been archived