commanderjoseph-761gwXTOKEN Weekly Staking Bsc
Updated 2024-10-28
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
›
⌄
with
total
AS
(
SELECT
block_timestamp,
origin_from_address AS staker,
utils.udf_hex_to_int(SUBSTR(data, 67, 64))/POW(10, 9) AS amount_staked,
utils.udf_hex_to_int(SUBSTR(data, 3, 64)) AS stake_number,
tx_hash
FROM
bsc.core.fact_event_logs
WHERE
origin_to_address = lower('0x1E7866B5A5A4F09EfD235D28d49568c2Fe2F7EcD') --TOKENFI STAKING
AND
topics[0] = '0x1449c6dd7851abc30abf37f57715f492010519147cc2652fbc38202c18a6ee90' --STAKED
AND
tx_status = 'SUCCESS'
)
SELECT
DATE_TRUNC('week', block_timestamp) AS transaction_week,
COUNT(DISTINCT staker) AS weekly_staker,
COUNT(DISTINCT stake_number) AS weekly_stake_number,
COUNT(DISTINCT tx_hash) AS weekly_stakes,
SUM(amount_staked) AS weekly_amount_staked
FROM
total
GROUP
BY
transaction_week
ORDER
BY
transaction_week
DESC
QueryRunArchived: QueryRun has been archived