Sandeshnekodex swaps copy
Updated 2024-08-22
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 nekodex swaps @ https://flipsidecrypto.xyz/studio/queries/90a88ec3-e767-46cb-a961-29069a8ccc92
with trades_decodes_table as (
with optimism_trades as (
select
tx_hash
,block_timestamp
,concat('0x',substr(topics[3],-40)) as user
,'10' as from_chainID
,regexp_substr_all(SUBSTR(data, 3), '.{64}') AS segmented
,utils.udf_hex_to_int(substr(topics[1],-40)) as to_chainID
,concat('0x', substr(segmented [0], -40)) as from_token
,concat('0x', substr(segmented [3], -40)) as from_token_value
,utils.udf_hex_to_int(from_token_value) as from_token_value_int
,concat('0x', substr(segmented [1], -40)) as to_token
,concat('0x', substr(segmented [4], -40)) as to_token_value
,utils.udf_hex_to_int(to_token_value) as to_token_value_int
from optimism.core.fact_event_logs
where 1=1
and block_number >= '121593991' -- june 19 2024
and TX_STATUS = 'SUCCESS'
and contract_address='0x6cca65f0bc3140019a81a1619aa75a6925c2601e'
and origin_to_address='0x6cca65f0bc3140019a81a1619aa75a6925c2601e'
and topics[0]='0x43784f390addfc00eee6e683e2c14a18da294f5fb331b76fd37c6537106ff9cd'
),
ethereum_trades as (
select
tx_hash
,block_timestamp
,concat('0x',substr(topics[3],-40)) as user
,'1' as from_chainID
,regexp_substr_all(SUBSTR(data, 3), '.{64}') AS segmented
,utils.udf_hex_to_int(substr(topics[1],-40)) as to_chainID
,concat('0x', substr(segmented [0], -40)) as from_token
QueryRunArchived: QueryRun has been archived