petertherock[Cumulative] TCR Distribution
Updated 2022-03-02Copy Reference Fork
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
›
⌄
-- initial allocation: 640,400,000 to treasury
-- TCR started on 8th Sept 2021
WITH addresses AS (
SELECT tx_id
FROM ethereum.transactions
WHERE to_address = '0xa84918f3280d488eb3369cb713ec53ce386b6cba'
AND function_signature = '0xdee4dea0'
AND block_timestamp >='2021-09-08'
AND success
)
-- ORDER BY block_timestamp DESC
SELECT days,
SUM (total_tcr_distributed*1.000) OVER (ORDER BY days ASC) AS cumulativetotaltcrdistributed
FROM
(SELECT
DATE_TRUNC('day', e.block_timestamp) AS days,
-- a.tx_id,
SUM(e.amount) AS total_tcr_distributed
FROM addresses a
LEFT JOIN (SELECT
block_timestamp,
tx_id,
amount
FROM ethereum.udm_events
WHERE block_timestamp >='2021-09-08' ) e
ON a.tx_id = e.tx_id
GROUP BY 1
)
ORDER BY 1 DESC
-- SELECT "days",
-- SUM (total_tcr_distributed) OVER (ORDER BY days ASC) AS days
-- FROM dpd
Run a query to Download Data