saeedmzn[Bridges to Ink chain] - distribution
Updated 2025-01-14
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 eth_price as (
select date_trunc(day,hour)::date date ,
median (PRICE) usd_price
from crosschain.price.ez_prices_hourly
where symbol ='ETH'
and BLOCKCHAIN = 'ethereum'
and date_trunc(day,hour)::date >= '2024-12-01'
and TOKEN_ADDRESS is NULL
group by 1
),
min_index_deposits as (
select t.tx_hash ,
min(event_index) min_index
from ink.core.fact_transactions t left join eth_price on (block_timestamp::date= date)
left join ink.core.fact_event_logs e on (t.tx_hash = e.tx_hash)
where to_address = '0x4200000000000000000000000000000000000007'
and t.ORIGIN_FUNCTION_SIGNATURE='0xd764ad0b'
and t.TX_SUCCEEDED
group by 1
),
---------- deposits
deposits as (
select
t.block_timestamp::date date ,
('0x' || SUBSTRING(topics[ARRAY_SIZE(topics)-1], 27) ) wallet ,
t.value amount ,
t.value * usd_price amount_usd ,
t.tx_hash
from ink.core.fact_transactions t left join eth_price on (block_timestamp::date= date)
left join ink.core.fact_event_logs e on (t.tx_hash = e.tx_hash )
left join min_index_deposits i on (e.tx_hash = i.tx_hash )
where to_address = '0x4200000000000000000000000000000000000007'
and t.ORIGIN_FUNCTION_SIGNATURE='0xd764ad0b'
and e.event_index = i.min_index
and t.TX_SUCCEEDED
),
QueryRunArchived: QueryRun has been archived