0xHaM-dNew Pairs Position
Updated 2023-02-23Copy Reference Fork
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 pairTb as (
SELECT
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[0])) as pair_index,
(HEX_DECODE_STRING(segmented_data[4]::STRING)) as token1,
(HEX_DECODE_STRING(segmented_data[6]::STRING)) as token2,
left(token1, 4) || '/' || left(token2, 3) as pair_name
FROM arbitrum.core.fact_event_logs
WHERE CONTRACT_ADDRESS = '0xf67df2a4339ec1591615d94599081dd037960d4b'
AND topics[0] = '0x3adfd40f2b74073df2a84238acdb7f460565a557b3cc13bddc8833289bf38e09'
)
, arbi1 as (
SELECT
BLOCK_TIMESTAMP,
'Arbitrum' as network,
tx_hash,
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
ethereum.public.udf_hex_to_int(segmented_data[1]) as trader,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[2])) as pair_index,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[3])) as group_index,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[14]))/1e18 as positionSizeDai,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[6])) as open_price,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[7])) as position_index,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[8])) as leverage
FROM arbitrum.core.fact_event_logs
WHERE CONTRACT_ADDRESS = '0x6c612c804c84e3d20e3109c8efd06cd2d8b28f46'
AND topics[0] = '0x165b0f8d6347f7ebe92729625b03ace41aeea8fd7ebf640f89f2593ab0db63d1'
)
, arbi2 as (
SELECT
BLOCK_TIMESTAMP,
'Arbitrum' as network,
tx_hash,
regexp_substr_all(SUBSTR(DATA, 3, len(DATA)), '.{64}') AS segmented_data,
ethereum.public.udf_hex_to_int(segmented_data[0]) as trader,
try_to_number(ethereum.public.udf_hex_to_int(segmented_data[1])) as pair_index,
Run a query to Download Data