farid-c9j0VMUntitled Query
Updated 2023-01-15Copy 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
›
⌄
with opti_tx as ( select *
from ethereum.core.fact_event_logs
where event_name = 'Swap'
and block_timestamp::date > CURRENT_DATE - 30 and block_timestamp::date<= CURRENT_DATE-1
)
,
opti_label as (
select ADDRESS as token, PROJECT_NAME
from ethereum.core.dim_labels
where label_type = 'dex' and project_name ilike '%uniswap%'
-- and LABEL_SUBTYPE = 'swap_contract'
)
,
opti_swaps as ( select date(BLOCK_TIMESTAMP) as date , tx_hash as tx , origin_from_address as swapper,PROJECT_NAME as project
from ethereum.core.fact_event_logs a join opti_label b on a.ORIGIN_TO_ADDRESS = b.token
where tx_hash in ( select tx_hash from opti_tx) and origin_from_address = EVENT_INPUTS:from
and block_timestamp::date > CURRENT_DATE - 30 and block_timestamp::date<= CURRENT_DATE-1
)
select project, count(DISTINCT(swapper)) as total_user, count(DISTINCT(tx)) as total_swaps
from opti_swaps
group by 1
Run a query to Download Data