arabianhorses-jZtVNacompare contract integrations
Updated 2023-07-03
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
tokens AS (
SELECT tokenSymbol, l1Address, starknetAddress, decimals
FROM (
VALUES('ETH', '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7', 18)
, ('BTC', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac', 8)
, ('DAI', '0x6b175474e89094c44da98b954eedeac495271d0f', '0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3', 18)
, ('USDT', '0xdac17f958d2ee523a2206206994597c13d831ec7', '0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8', 6)
, ('USDC', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8', 6)
, ('wstETH', '0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0', '0x05ef98e7dc5865f49bcec200df508d27669b3ef7f9d2439decd127350359f291', 18)
, ('rETH', '0xae78736cd615f374d3085123a210448e74fc6393', '0x0319111a5037cbec2b3e638cc34a3474e2d2608299f3e62866e9cc683208c610', 18)
) AS t(tokenSymbol, l1Address, starknetAddress, decimals)
)
, prices AS (
SELECT
p.HOUR
, p.TOKEN_ADDRESS AS l1Address
, t.starknetAddress AS starknetAddress
, t.tokenSymbol AS tokenSymbol
, p.DECIMALS AS decimals
, AVG(p.PRICE) AS price
FROM crosschain.core.ez_hourly_prices p
LEFT JOIN tokens t ON p.token_address = t.l1Address
WHERE p.TOKEN_ADDRESS IN (SELECT l1Address FROM tokens)
AND HOUR > '2022-05-02'
AND BLOCKCHAIN = 'ethereum'
GROUP BY 1,2,3,4,5
)
, address_edit AS (
Run a query to Download Data