Afonso_DiazTotal
Updated 2025-02-24
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,
'0x55acee547df909cf844e32dd66ee55a6f81dc71b' as token_contract,
avg(price) as token_price_usd
from
crosschain.price.ez_prices_hourly
where
blockchain = 'ethereum'
and token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
group by 1, 2
),
main as (
select
tx_hash,
block_timestamp,
to_address as user,
contract_address as token_address,
case contract_address
when '0x55acee547df909cf844e32dd66ee55a6f81dc71b' then 'WETH'
when '0xe2053bcf56d2030d2470fb454574237cf9ee3d4b' then 'USDC.e'
when '0x9025095263d1e548dc890a7589a4c78038ac40ab' then 'USDT'
end as symbol,
iff(contract_address = '0x9025095263d1e548dc890a7589a4c78038ac40ab', raw_amount / 1e6, amount) as amnt,
case
when amount_usd is not null then amount_usd
when contract_address in ('0xe2053bcf56d2030d2470fb454574237cf9ee3d4b', '0x9025095263d1e548dc890a7589a4c78038ac40ab') then amnt
else amnt * token_price_usd
end as amount_usd
from
kaia.core.ez_token_transfers a
left join
pricet on block_timestamp::date = date and pricet.token_contract = contract_address
QueryRunArchived: QueryRun has been archived