nnnnnnray-act
Updated 2025-02-13Copy Reference Fork
999
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
›
⌄
WITH g_time_cte as (
SELECT
block_id,
TO_CHAR(block_timestamp, 'DD/MM HH24:MI:SS') as block_timestamp,
tx_id,
DECODED_INSTRUCTION:accounts[2]:pubkey::string as ca,
block_timestamp as migrated_time
FROM solana.core.fact_decoded_instructions
where event_type = 'withdraw'
and SIGNERS[0] = '39azUYFWPz3VHgKCf3VChUwbpURdCHRxjWVowf5jUJjg'
and DECODED_INSTRUCTION:accounts[2]:pubkey::string = '{{ca}}'
),
tx_range as (
select
DISTINCT
tx_id
from solana.defi.fact_swaps
where block_timestamp between
dateadd('minute' , -5 , (select migrated_time from g_time_cte))
AND dateadd('minute' , 5 , (select migrated_time from g_time_cte))
),
fee_info as (
SELECT
e.tx_id,
sum(e.INSTRUCTION:parsed:info:lamports / 1e9) as total_fee_sol,
array_agg(DISTINCT e.INSTRUCTION:parsed:info:destination) as fee_destinations
FROM solana.core.fact_events e
inner JOIN tx_range t ON e.tx_id = t.tx_id
WHERE e.event_type = 'transfer'
AND e.PROGRAM_ID = '11111111111111111111111111111111'
GROUP BY e.tx_id
),
dex_act as (
SELECT
g.block_id,
g.block_timestamp,
QueryRunArchived: QueryRun has been archived