BlockTrackermain (Cellana)
Updated 2024-05-23
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
token_info as (
select
token_address,
symbol,
name,
decimals
from aptos.core.dim_tokens
)
,prices as (
select
date_trunc('hour',hour) as hour,
symbol,
median(price) as price
from aptos.price.ez_hourly_token_prices
group by 1 , 2
)
, swaps as (
select
a.block_number,
a.block_timestamp,
a.tx_hash,
a.event_index,
b.sender as swapper,
event_data : pool :: string as pool_address,
event_data: from_token :: string as token_in,
event_data : to_token :: string as token_out,
event_data:amount_in :: float as amount_in_raw,
event_data:amount_out :: float as amount_out_raw
from aptos.core.fact_events a
join aptos.core.fact_transactions b using(tx_hash)
where
a.event_address = '0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1'
and a.event_resource ILIKE 'SwapEvent%'
and a.SUCCESS = 'TRUE'
and a.block_timestamp::date >= '2024-01-01'--dateadd(day, -90 , current_date())