Afonso_DiazGrouping users
Updated 2025-02-10
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
pricet as (
select
hour::date as date,
token_address,
avg(price) as token_price_usd
from
avalanche.price.ez_prices_hourly
group by 1, 2
union all
select
hour::date as date,
'0x0000000000000000000000000000000000000000' as token_address,
avg(price) as token_price_usd
from
avalanche.price.ez_prices_hourly
where
token_address = '0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'
group by 1, 2
),
swaps as (
select
tx_hash,
block_timestamp,
origin_from_address as swapper,
decoded_log:srcAsset::string as token_in,
decoded_log:srcAmount::bigint / pow(10, iff(token_in = '0x0000000000000000000000000000000000000000', 18, a.decimals)) as amount_in,
iff(token_in = '0x0000000000000000000000000000000000000000', 'AVAX', a.symbol) as symbol_in,
decoded_log:destAsset::string as token_out,
decoded_log:destAmount::bigint / pow(10, iff(token_out = '0x0000000000000000000000000000000000000000', 18, b.decimals)) as amount_out,
iff(token_out = '0x0000000000000000000000000000000000000000', 'AVAX', b.symbol) as symbol_out
from
QueryRunArchived: QueryRun has been archived