siwakondevlp user cmd
Updated 2024-08-23
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 token_relevant_txs AS (
SELECT
DISTINCT tx_hash,
left(input, 10) as function_sig
FROM
berachain.testnet.fact_traces
WHERE
to_address = LOWER('{{lp_address}}')
AND tx_succeeded = true
AND function_sig != '0x095ea7b3'
),
token_transfers AS (
SELECT
block_timestamp,
tx_hash,
from_address,
to_address,
CASE
WHEN to_address = LOWER('{{lp_address}}') THEN utils.udf_hex_to_int(
regexp_substr_all(SUBSTR(input, 11), '.{64}') [4] :: string
)
WHEN regexp_substr_all(SUBSTR(input, 11), '.{64}') [2] IS NULL
OR regexp_substr_all(SUBSTR(input, 11), '.{64}') [2] = '' THEN utils.udf_hex_to_int(
regexp_substr_all(SUBSTR(input, 11), '.{64}') [1] :: string
)
ELSE utils.udf_hex_to_int(
regexp_substr_all(SUBSTR(input, 11), '.{64}') [2] :: string
)
END as token_value
FROM
berachain.testnet.fact_traces
WHERE
tx_hash IN (
SELECT
tx_hash
FROM
QueryRunArchived: QueryRun has been archived