mo115Clipper daily - main pools
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
›
⌄
-- forked from Clipper Total @ https://flipsidecrypto.xyz/edit/queries/0b375ca0-c692-4ead-9382-22708c2c2763
with final as (with txs as (
--arbitrum
(with txso as (select date_trunc('day',BLOCK_TIMESTAMP) as date, ORIGIN_FROM_ADDRESS as wallet , TX_HASH as txs
from arbitrum.core.ez_decoded_event_logs
where EVENT_NAME='Swapped'
and CONTRACT_NAME ='ClipperDirect Pool Token'),
ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
from ethereum.core.fact_hourly_token_prices
where SYMBOL = 'WETH'
group by 1)
select date,wallet, txs , AMOUNT_USD,'arbitrum' as network
from txso w left join arbitrum.core.ez_token_transfers e on w.txs=e.TX_HASH
where FROM_ADDRESS in (select ORIGIN_FROM_ADDRESS
from arbitrum.core.ez_decoded_event_logs
where EVENT_NAME='Swapped'
and CONTRACT_NAME ='ClipperDirect Pool Token')
union
select w.date, wallet, txs ,(AMOUNT*price) as AMOUNT_USD,'arbitrum' as network
from txso w left join arbitrum.core.ez_eth_transfers e on w.txs=e.TX_HASH
left join ETH m on w.date=m.date
where ETH_FROM_ADDRESS in (select ORIGIN_FROM_ADDRESS
from arbitrum.core.ez_decoded_event_logs
where EVENT_NAME='Swapped'
and CONTRACT_NAME ='ClipperDirect Pool Token'))
UNION
--optimism
(with txso as (select date_trunc('day',BLOCK_TIMESTAMP) as date, ORIGIN_FROM_ADDRESS as wallet , TX_HASH as txs
from optimism.core.ez_decoded_event_logs
where EVENT_NAME='Swapped'
and CONTRACT_NAME ='ClipperDirect Pool Token'),
ETH as (select date_trunc ('day',HOUR) as date, avg(PRICE)as price
from ethereum.core.fact_hourly_token_prices
where SYMBOL = 'WETH'
Run a query to Download Data