TOPICS | PART | SENDER | RECEIVER | AMOUNT0_IN | AMOUNT1_IN | AMOUNT0_OUT | AMOUNT1_OUT | POOL_ADDRESS | TOKEN_0 | TOKEN_1 | TX_HASH | BLOCK_TIMESTAMP | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ["0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822","0... | [
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000665500",
"000000000000000000000000000000000000000000000000000aa9ddeca475f5",
"0000000000000000000000000000000000000000000000000000000000000000"
] | 0x64eacfc34079715b7469262b9e907d5c639b8c02 | 0x64eacfc34079715b7469262b9e907d5c639b8c02 | 0 | 6706432 | 3001520390174197 | 0 | 0x73a09cd53871b2ac4f5e08b89eb2e25e1959d92a | 0x4200000000000000000000000000000000000006 | 0xf1815bd50389c46847f0bda824ec8da914045d14 | 0x520517bc6198478651512807c0e5b4acc06c9a4891a6a970d44897ae979e0de6 | 2025-03-01 00:01:35.000 |
samdecoding univ2 and its forks using event logs copy
Updated 2025-05-08
99
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 decoding univ2 and its forks using event logs @ https://flipsidecrypto.xyz/studio/queries/91cbe019-c602-47d6-b730-a80f77b2aae3
/*
pair created 0x6cd7075656b3a2951fc03559b7cc37870678fe1182a953f8770feed91912e03f
uni v2 structure:
1 factory address - to create pairs, 1 pool address
pool address emits sync and swap events
regexp_substr_all(SUBSTR(data, 3), '.{64}') AS part
*/
with pairs_created as (
select
'0x' || substr(topic_1, 27) as token_0,
'0x' || substr(topic_2, 27) as token_1,
regexp_substr_all(SUBSTR(data, 3), '.{64}') AS part_pairs,
'0x' || substr(part_pairs[0], 25) as contract_address -- pools created
from ink.core.fact_event_logs -- contract address + topic 0
where block_timestamp::date >= '2024-12-01'
and tx_hash = '0x6cd7075656b3a2951fc03559b7cc37870678fe1182a953f8770feed91912e03f'
and topic_0 = '0x0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9' -- pair created event
and contract_address = lower('0x6c86ab200661512fDBd27Da4Bb87dF15609A2806') -- dyor pairs factory address
),
swap_raw as (
select
topics,
regexp_substr_all(SUBSTR(data, 3), '.{64}') AS part,
'0x' || substr(topic_1, 27) as sender,
'0x' || substr(topic_2, 27) as receiver,
livequery.utils.udf_hex_to_int(part[0]) as amount0_in,
livequery.utils.udf_hex_to_int(part[1]) as amount1_in,
livequery.utils.udf_hex_to_int(part[2]) as amount0_out,
livequery.utils.udf_hex_to_int(part[3]) as amount1_out,
contract_address as pool_address,
Last run: about 2 months ago
1
839B
38s