omer93sei liquid staking
Updated 2024-07-19
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
›
⌄
-- credits to Hess
WITH burn_amt AS (
SELECT
tx_id,
(attribute_value / POW(10, 6)) AS burn_amount
FROM
sei.core.fact_msg_attributes
WHERE
attribute_key = 'utoken_refunded'
AND tx_id IN (
SELECT
DISTINCT tx_id
FROM
sei.core.fact_msg_attributes
WHERE
attribute_key = '_contract_address'
AND attribute_value = 'sei1e3gttzq5e5k49f9f5gzvrl0rltlav65xu6p9xc0aj7e84lantdjqp7cncc'
AND tx_succeeded = 'true'
AND block_timestamp::Date >= '2024-01-15'
)
AND block_timestamp::Date >= '2024-01-15'
),
un_user AS (
SELECT
DATE_TRUNC('day', block_timestamp) AS dayly,
IFNULL(COUNT(DISTINCT a.tx_id) * -1, 0) AS burn_txs,
IFNULL(SUM(burn_amount) * -1, 0) AS un_amount,
IFNULL(COUNT(DISTINCT attribute_value) * -1, 0) AS burn_users,
SUM(COALESCE(un_amount, 0)) OVER (ORDER BY dayly) AS cumulative_burn_volumes,
AVG(burn_amount) AS avg_burn_amount
FROM
sei.core.fact_msg_attributes a
JOIN burn_amt b ON a.tx_id = b.tx_id
WHERE
block_timestamp::Date >= '2024-01-15'
AND attribute_key = 'fee_payer'
QueryRunArchived: QueryRun has been archived