hessShare of Active Days
Updated 2024-10-03
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 data_base as (Select VALUE:"TOKEN_ADDRESS"::string as tok_address,
value:"SYMBOL"::string as symbol,
value:"DECIMALS"::string as decimals
from (
SELECT livequery.live.udf_api(
'https://flipsidecrypto.xyz/api/v1/queries/da470a00-4118-4a21-ba0c-47dea1710db6/data/latest') as resp
)
,LATERAL FLATTEN (input => resp:data)
)
,
kaia_base as (select trunc(block_timestamp,'day') as daily,
tx_hash,
origin_from_address,
'0x' || SUBSTRING(topics[1], 27, 40) AS token_in,
'0x' || SUBSTRING(topics[2], 27, 40) AS token_out,
REGEXP_SUBSTR(data, '.{64}', 3, 1) AS part1,
REGEXP_SUBSTR(data, '.{64}', 3, 2) AS part2,
REGEXP_SUBSTR(data, '.{64}', 3, 3) AS part3,
REGEXP_SUBSTR(data, '.{64}', 3, 4) AS part4,
livequery.utils.udf_hex_to_int(part2) AS amount_in,
livequery.utils.udf_hex_to_int(part3) AS amount_out,
topics,
contract_address,
data
from kaia.core.fact_event_logs
where topics[0]::string = '0x0fe977d619f8172f7fdbe8bb8928ef80952817d96936509f67d66346bc4cd10f'
and block_timestamp::Date >= '2024-01-01'
)
,
token_names as ( select daily,
tx_hash,
origin_from_address,
token_in,
amount_in,
case when b.decimals is null then amount_in/pow(10,18) else amount_in/pow(10,b.decimals) end as amt_in,
b.symbol as token_in_name,
QueryRunArchived: QueryRun has been archived