adriaparcerisasLava mainnet staking 1
Updated 2024-12-05
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
›
⌄
WITH t1 AS (
SELECT
x.block_timestamp,
x.tx_id,
-- Extract token based on the provided patterns
CASE
-- For tokens starting with digits followed by 'ibc'
WHEN REGEXP_SUBSTR(x.attribute_value, '[0-9]+ibc/[A-Za-z0-9]+') IS NOT NULL THEN
REGEXP_SUBSTR(x.attribute_value, '[0-9]+ibc/[A-Za-z0-9]+')
-- For tokens without 'ibc' prefix
WHEN REGEXP_SUBSTR(x.attribute_value, '[0-9]+ulava') IS NOT NULL THEN
REGEXP_SUBSTR(x.attribute_value, '[0-9]+ulava')
ELSE NULL
END AS token,
-- Extract amount from the attribute_value string
CASE
-- If it matches the 'ibc' format, extract the number after the comma
WHEN REGEXP_SUBSTR(x.attribute_value, '[0-9]+ibc/[A-Za-z0-9]+') IS NOT NULL THEN
REPLACE(REGEXP_SUBSTR(x.attribute_value, ',[0-9]+'), ',', '')::DECIMAL / POW(10,6)
-- If it matches the plain format (e.g., '96636ulava')
WHEN REGEXP_SUBSTR(x.attribute_value, '[0-9]+ulava') IS NOT NULL THEN
REPLACE(REGEXP_SUBSTR(x.attribute_value, '[0-9]+ulava'), 'ulava', '')::DECIMAL / POW(10,6)
ELSE 0
END AS amount,
y.attribute_value AS Delegator,
z.attribute_value AS Validator
FROM
lava.core.fact_msg_attributes x
JOIN
lava.core.fact_msg_attributes y ON x.tx_id = y.tx_id
JOIN
lava.core.fact_msg_attributes z ON x.tx_id = z.tx_id
WHERE
QueryRunArchived: QueryRun has been archived