Moevvv 3*
Updated 2023-04-15
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 op as (with tb1 as (select
*
from optimism.core.fact_token_transfers
where ORIGIN_TO_ADDRESS='0xe592427a0aece92de3edee1f18e0157c05861564' and ORIGIN_FUNCTION_SIGNATURE='0x414bf389'
),
prices as (select
HOUR::date as days,TOKEN_ADDRESS,avg(price) as price,decimals
from optimism.core.fact_hourly_token_prices
group by 1,2,4
),
tb2 as (select
BLOCK_TIMESTAMP,TX_HASH,ORIGIN_FROM_ADDRESS,ORIGIN_TO_ADDRESS,CONTRACT_ADDRESS,SYMBOL as token1,
FROM_ADDRESS, TO_ADDRESS,RAW_AMOUNT
from tb1 x
join optimism.core.dim_contracts y on x.CONTRACT_ADDRESS=y.ADDRESS
where ORIGIN_FROM_ADDRESS=FROM_ADDRESS
),
tb3 as (select
*,
SYMBOL as token2
from tb1 z
join optimism.core.dim_contracts c on z.CONTRACT_ADDRESS=c.ADDRESS
where ORIGIN_FROM_ADDRESS=TO_ADDRESS
),
swaps as (select
tb2.*,tb3.token2
from
tb2,tb3 where tb2.tx_hash = tb3.tx_hash
)
,tot as (select
Run a query to Download Data