Switchboardmonthly_function_routine_request_init_log_messages
Updated 2023-12-06Copy 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
36
›
⌄
-- next up, work on functionInit, routine/requestInit per authority and leases
-- functionVerify is called by our sbatt program
-- which then also calls the ixn in user program in the same txn
-- so does routineVerify and requestVerify only trigger initial execution call?
WITH event AS (
SELECT DISTINCT tx_id AS e_id, instruction
FROM solana.core.fact_events
WHERE block_timestamp BETWEEN '2023-05-01' AND '2023-12-01'
AND program_id = 'sbattyXrzedoNATfc4L31wC9Mhxsi1BmFhTiN8gDshx'
),
tx AS (
SELECT
DISTINCT tx_id AS t_id,
value AS log
FROM solana.core.fact_transactions
INNER JOIN lateral flatten (input => log_messages)
WHERE block_timestamp BETWEEN '2023-05-01' AND '2023-12-01'
AND succeeded
),
fn AS (
SELECT
COUNT(DISTINCT t_id) AS fn_count,
instruction:accounts[2] AS fn_authority
FROM
tx
JOIN event ON tx.t_id = event.e_id
WHERE
log like 'Program log: Instruction: FunctionInit'
GROUP BY 2
),
rt AS (
Run a query to Download Data