jackguyGMX on Avalanche 4
Updated 2022-08-05
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
›
⌄
with tab1 as (
SELECT *
FROM avalanche.core.fact_event_logs
WHERE contract_address LIKE lower('0x0c91a070f862666bBcce281346BE45766d874D98')
AND event_name LIKE 'Swap'
-- WHERE tx_hash LIKE '0x541f92e4d8fd9ad851dede60fce90ee6a46cad34e04287e340a7f3b47a7d059c'
), tab2 as (
SELECT
DISTINCT origin_from_address
FROM avalanche.core.fact_token_transfers
LEFT OUTER JOIN avalanche.core.dim_labels
on address = contract_address
WHERE tx_hash in (SELECT tx_hash FROM tab1)
AND to_address LIKE lower('0x0c91a070f862666bBcce281346BE45766d874D98')
AND ADDRESS_NAME LIKE 'wrapped avax'
)
SELECT
datediff(day, min_day, CURRENT_DATE),
count(*) as amt
FROM (
SELECT
origin_from_address,
min(date_trunc('day', block_timestamp)) as min_day
FROM avalanche.core.fact_event_logs
where origin_from_address in (SELECT * FROM tab2)
GROUP BY 1
)
GROUP BY 1
Run a query to Download Data