tubaecciGOA Stakings
Updated 2024-10-22
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 stakes AS (
SELECT
DATE_TRUNC('day', block_timestamp) AS date,
SUM(decoded_log:amount / POW(10, 18)) AS stake_amount,
COUNT(DISTINCT origin_from_address) AS no_of_stakers
FROM arbitrum.core.ez_decoded_event_logs
WHERE contract_address = '0xad9ce8580a1cd887038405275cb02443e8fb88ac'
AND event_name = 'Staked'
GROUP BY 1
),
new AS (
SELECT
DATE_TRUNC('day', first_stake) AS first_stake,
COUNT(staker) AS new_stakers
FROM (
SELECT
origin_from_address AS staker,
MIN(block_timestamp) AS first_stake
FROM arbitrum.core.ez_decoded_event_logs
WHERE contract_address = '0xad9ce8580a1cd887038405275cb02443e8fb88ac'
AND event_name = 'Staked'
GROUP BY 1
)
GROUP BY 1
),
type AS (
SELECT
s.date,
s.stake_amount,
-- s.no_of_stakers AS active_stakers,
COALESCE(n.new_stakers, 0) AS new_stakers,
s.no_of_stakers - COALESCE(n.new_stakers, 0) AS old_stakers
FROM stakes AS s
LEFT JOIN new AS n ON s.date = n.first_stake
),
price AS (
QueryRunArchived: QueryRun has been archived