Pine AnalyticsSwaps single numbers
Updated 2024-08-14
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 swap_only_tx as (
select
tx_hash
from blast.core.ez_decoded_event_logs
where origin_to_address in ('0x121b5ac4de4a3e6f4171956bc26ceda40cb61a56', '0x136f401478195098cf767351498826fae3e5a368')
and tx_hash is not null
and event_name in ('Swap', 'OpenPosition', 'ClosePosition')
and tx_status like 'SUCCESS'
group by tx_hash
having sum(case when event_name = 'Swap' then 1 else 0 end) = count(*)
),
flattened as (
select
block_timestamp,
event_name,
tx_hash,
contract_address,
origin_to_address,
origin_from_address,
decoded_log:amountFrom as amountFrom,
decoded_log:amountTo as amountTo,
decoded_log:tokenFrom as tokenFrom,
decoded_log:tokenTo as tokenTo
from blast.core.ez_decoded_event_logs
where tx_hash in (select tx_hash from swap_only_tx)
and tx_status like 'SUCCESS'
),
tab_token_price as (
select
date_trunc('day', hour) as Date,
symbol,
QueryRunArchived: QueryRun has been archived