Afonso_DiazOvertime
Updated 2024-10-13
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
pricet as (
select
hour::date as date,
avg(price) as price_usd
from aptos.price.ez_prices_hourly
where symbol = 'APT'
group by 1
),
pricet2 as (
select
date_trunc('{{ period }}', hour) as dt,
avg(price) as price_usd
from aptos.price.ez_prices_hourly
where symbol = 'APT'
group by 1
),
main as (
select
tx_hash,
block_timestamp,
sender as user,
nvl(event_data:thAPT_staked, event_data:amount_unlocked)/1e8 as amount,
iff(event_resource = 'StakeThalaAPTEvent', 'Stake', 'Unstake') as event,
amount * price_usd as amount_usd
from aptos.core.fact_events
join aptos.core.fact_transactions
using (tx_hash)
left join pricet on block_timestamp::date = date
where success = 1
and payload_function in (
'0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::scripts::stake_thAPT',
'0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::scripts::request_unstake_APT'
QueryRunArchived: QueryRun has been archived