SocioAnalyticaBlast Thruster Fi Swap events copy
Updated 2024-03-02
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
›
⌄
-- forked from sam / Blast Thruster Fi Swap events @ https://flipsidecrypto.xyz/sam/q/10tMFoLKJe0v/blast-thruster-fi-swap-events
with swap as (
select
block_timestamp,
origin_from_address,
origin_to_address,
tx_hash,
event_index,
contract_address,
'0x' || substr(topics[1]::string, 27) as pool_address,
'0x' || substr(topics[2]::string, 27) as sender_address, -- the one who sent this request to swap, likely the router address
'0x' || substr(topics[1]::string, 27) as recipient_address, -- the address who receive the swapped assets
REGEXP_SUBSTR_ALL(SUBSTR(data, 3, len(data)), '.{64}') as segmented_data,
livequery.utils.udf_hex_to_int('s2c', segmented_data[0]::string) as amount_0,
livequery.utils.udf_hex_to_int('s2c', segmented_data[1]::string) as amount_1
from blast.core.fact_event_logs
where contract_address = '0x71b08f13b3c3af35aadeb3949afeb1ded1016127'
and topics[0]::string = '0xcdbb3606a8844e31da62a3d26550f61be1e020b98631f8163496c703a063053f'
and block_timestamp::date >= '2024-02-28'
)
,
result as (
select
block_timestamp,
tx_hash,
origin_from_address,
origin_to_address,
b.contract_address,
b.event_index,
pool_address,
sender_address,
recipient_address,
case when amount_0::int > 0 then amount_0::int else amount_1::int end as raw_amount_in,
QueryRunArchived: QueryRun has been archived