Afonso_DiazRoute
Updated 2025-02-17
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
flow.price.ez_prices_hourly
where
blockchain = 'flow evm'
group by 1, 2
),
main as (
select
tx_hash,
block_timestamp,
origin_from_address as swapper,
decoded_log:tokenX::string as token_in,
decoded_log:tokenY::string as token_out,
decoded_log:amountX::bigint as amount_in_unadj,
decoded_log:amountY::bigint as amount_out_unadj,
amount_in_unadj / pow (10, b.decimals) as amount_in,
amount_out_unadj / pow (10, c.decimals) as amount_out,
b.symbol as symbol_in,
c.symbol as symbol_out,
amount_in * d.token_price_usd as amount_in_usd,
amount_out * e.token_price_usd as amount_out_usd,
nvl(amount_in_usd, amount_out_usd) as amount_usd
from
flow.core_evm.ez_decoded_event_logs
left join
flow.core_evm.dim_contracts b on b.address = decoded_log:tokenX::string
left join
flow.core_evm.dim_contracts c on c.address = decoded_log:tokenY::string