HosseinUntitled Query
Updated 2022-12-29
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
›
⌄
SELECT
*,
SUM(smart_contracts) over (order by date) as cum_smart_contracts,
'Successful Creations' as status
FROM
(
SELECT
date_trunc('{{period}}', call.block_timestamp) as date,
COUNT(DISTINCT tr.TX_RECEIVER) as smart_contracts
FROM near.core.fact_actions_events_function_call call
INNER JOIN near.core.fact_transactions tr
ON call.TX_HASH = tr.TX_HASH
INNER JOIN near.core.fact_receipts as rc
ON tr.TX_HASH=rc.TX_HASH
WHERE ACTION_NAME = 'FunctionCall'
AND split(split(rc.status_value,':')[0],'{')[1] ilike '%Success%'
AND METHOD_NAME = 'new'
AND date < CURRENT_DATE
GROUP BY date
)
UNION DISTINCT
SELECT
*,
SUM(smart_contracts) over (order by date) as cum_smart_contracts,
'Failed Creations' as status
FROM
(
SELECT
date_trunc('{{period}}', call.block_timestamp) as date,
COUNT(DISTINCT tr.TX_RECEIVER) as smart_contracts
FROM near.core.fact_actions_events_function_call call
INNER JOIN near.core.fact_transactions tr
ON call.TX_HASH = tr.TX_HASH
INNER JOIN near.core.fact_receipts as rc
Run a query to Download Data