commanderjoseph-761gwXTOKEN Weekly Staking Reward 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
35
›
⌄
with
total
AS
(
SELECT
block_timestamp,
origin_from_address AS claimer,
utils.udf_hex_to_int(SUBSTR(data, 67, 64))/POW(10, 9) AS reward_amount,
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] = '0xd6f2c8500df5b44f11e9e48b91ff9f1b9d81bc496d55570c2b1b75bf65243f51' --REWARD PAID
AND
tx_status = 'SUCCESS'
)
SELECT
DATE_TRUNC('week', block_timestamp) AS transaction_week,
COUNT(DISTINCT claimer) AS weekly_claimer,
--COUNT(DISTINCT user) AS weekly_user,
COUNT(DISTINCT stake_number) AS weeklystake_number ,
COUNT(DISTINCT tx_hash) AS weekly_claims ,
SUM(reward_amount) AS weekly_reward_claimed
FROM
total
GROUP
BY
transaction_week
ORDER
BY
transaction_week
DESC
QueryRunArchived: QueryRun has been archived