Hessishlayerswap - monthly
Updated 2023-09-01
999
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 prices as (SELECT HOUR::date as datex,
case when symbol = 'USDT' then '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8'
when symbol = 'USDC' then '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8'
when symbol = 'DAI' then '0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3'
when symbol = 'WBTC' then '0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac'
when symbol = 'wstETH' then '0x042b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2'
when symbol = 'WETH' then '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7'
when symbol = 'rETH' then '0x0319111a5037cbec2b3e638cc34a3474e2d2608299f3e62866e9cc683208c610'
end as strk_add,TOKEN_ADDRESS,
case when symbol = 'WETH' then 'ETH' else SYMBOL end as token,
DECIMALS , avg(PRICE) as pr
from crosschain.price.ez_hourly_token_prices
where
BLOCKCHAIN = 'ethereum'
GROUP by 1,2,3,4,5) ,
bnb as (SELECT tx_hash, TO_ADDRESS as user, SYMBOL, AMOUNT, amount*avg(pr) as usd, BLOCK_TIMESTAMP as time, 'BNB chain' as chain
from bsc.core.ez_token_transfers
join prices on BLOCK_TIMESTAMP::date = datex and token = SYMBOL
WHERE
FROM_ADDRESS = '0x2fc617e933a52713247ce25730f6695920b3befe'
and AMOUNT > 0
GROUP by 1,2,3,4,6,7) ,
ava as (SELECT tx_hash, TO_ADDRESS as user, SYMBOL, AMOUNT, amount*avg(pr) as usd, BLOCK_TIMESTAMP as time, 'Avalanche' as chain
from avalanche.core.ez_token_transfers
join prices on BLOCK_TIMESTAMP::date = datex and token = SYMBOL
WHERE
FROM_ADDRESS = '0x2fc617e933a52713247ce25730f6695920b3befe'
and AMOUNT > 0
GROUP by 1,2,3,4,6,7),
pol as (SELECT tx_hash, TO_ADDRESS as user, SYMBOL, AMOUNT, amount*avg(pr) as usd, BLOCK_TIMESTAMP as time, 'Polygon' as chain
from polygon.core.ez_token_transfers
join prices on BLOCK_TIMESTAMP::date = datex and token = SYMBOL
WHERE
Run a query to Download Data