BlockTrackerswap overview
Updated 2024-07-28
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 data as (
select
block_timestamp,
tx_hash,
origin_from_address,
REGEXP_SUBSTR_ALL(SUBSTR(data, 3, len(data)), '.{64}') as segmented_data,
lower('0x' || substr(segmented_data[0]::string, 25, 40 ) :: string) as tokenA,
lower('0x' || substr(segmented_data[2]::string, 25, 40 ) :: string) as tokenB,
livequery.utils.udf_hex_to_int(segmented_data[1]::string) :: int as amountA,
livequery.utils.udf_hex_to_int(segmented_data[3]::string) :: int as amountB
from kaia.core.fact_event_logs
where
contract_address = '0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654'
and topics[0] = '0x022d176d604c15661a2acf52f28fd69bdd2c755884c08a67132ffeb8098330e0'
and TX_SUCCEEDED = 'TRUE'
and block_timestamp::date >= '2024-02-22'
--and tx_hash = '0xa7642a98fb504458557ba7fb0c9c19ca355009ad05b439f116f79828e1c80cb5'
)
,
token_info as (
select
token_address,
symbol,
decimals
from kaia.price.ez_asset_metadata
group by all
)
,
prices as (
select
date_trunc('day', hour) as date,
symbol,
median(price) as usd_price
from kaia.price.ez_prices_hourly
group by 1 , 2
)
QueryRunArchived: QueryRun has been archived