PotLockFees on POTs vs. Donations
Updated 2024-06-13
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
›
⌄
WITH txns AS (
SELECT DISTINCT
tx_hash,
transaction_fee AS tx_fee,
block_timestamp
FROM near.core.fact_transactions
WHERE
(tx_receiver = 'registry.potlock.near' OR
tx_signer = 'registry.potlock.near')
AND tx_succeeded = TRUE
),
fees AS (
SELECT
DATE_TRUNC('month', a.block_timestamp) AS month,
SUM(CASE WHEN a.method_name = 'register' THEN txns.tx_fee ELSE 0 END) / 1e24 AS pot_fees,
SUM(CASE WHEN a.method_name = 'donate' THEN txns.tx_fee ELSE 0 END) / 1e24 AS donation_fees
FROM
near.core.fact_actions_events_function_call a
JOIN txns ON a.tx_hash = txns.tx_hash
WHERE
a.method_name IN ('register', 'donate')
GROUP BY
month
)
SELECT
month,
pot_fees,
donation_fees
FROM
fees
ORDER BY
month;
QueryRunArchived: QueryRun has been archived