hbd1994Overview
Updated 2024-08-11
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 eth_hourly_price as (
SELECT
resp:data:ethereum:usd as price
from (
select livequery.live.udf_api('https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd') as resp)),
base as (
(select
BLOCK_TIMESTAMP,
case
when ORIGIN_FUNCTION_SIGNATURE = '0x0e752702' then 'Repay'
when ORIGIN_FUNCTION_SIGNATURE = '0xc5ebeaec' then 'Borrow'
when ORIGIN_FUNCTION_SIGNATURE = '0xa0712d68' then 'Deposit'
when ORIGIN_FUNCTION_SIGNATURE = '0x852a12e3' then 'Withdraw'
end as action,
'USDB' as asset,
case
when ORIGIN_TO_ADDRESS = '0xf9b3b455f5d900f62bc1792a6ca6e1d47b989389' then value
when ORIGIN_TO_ADDRESS = '0x9aecedcd6a82d26f2f86d331b17a1c1676442a87' then ethereum.public.udf_hex_to_int( DATA )/pow(10,18)
end as amount,
'0x' || substr(topics[1],27,40) as asset_FROM_ADDRESS,
'0x' || substr(topics[2],27,40) as asset_TO_ADDRESS,
ORIGIN_FROM_ADDRESS,
ORIGIN_TO_ADDRESS,
tx_hash
from blast.core.fact_event_logs
join blast.core.fact_transactions using (tx_hash)
where ORIGIN_TO_ADDRESS in ('0x9aecedcd6a82d26f2f86d331b17a1c1676442a87')
and contract_address = '0x4300000000000000000000000000000000000003'
and TX_STATUS = 'SUCCESS'
and TOPICS[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef')
union all
((select
BLOCK_TIMESTAMP,
case
QueryRunArchived: QueryRun has been archived