banbannardAvalanche Free Square Question 4
Updated 2022-11-29Copy 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
›
⌄
with base2 as (select tx_hash
from avalanche.core.fact_event_logs
where event_name = 'Swap'
--and origin_to_address in (select address from base)
and block_timestamp >= '2022-06-15'),
base3 as (select block_timestamp,
event_inputs:from as swapper,
event_inputs:value/1e6 as swap_size
from avalanche.core.fact_event_logs
where (contract_address ilike '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E' or contract_address ilike '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664')
and event_name = 'Transfer'
and tx_hash in (select tx_hash from base2)
and event_inputs:value > 0),
base12 as (select tx_hash
from ethereum.core.fact_event_logs
where event_name = 'Swap'
--and origin_to_address in (select address from base1)
and block_timestamp >= '2022-06-15'),
base13 as (select block_timestamp,
event_inputs:from as swapper,
event_inputs:value/1e6 as swap_size
from ethereum.core.fact_event_logs
where contract_address ilike '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'
and event_name = 'Transfer'
and tx_hash in (select tx_hash from base12)
and event_inputs:value > 0)
select
date_trunc('day', block_timestamp) as day,
count(distinct(swapper)),
sum(swap_size),
'Ethereum'
from base13
Run a query to Download Data