Afonso_DiazOvertime
Updated 2025-03-11
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
›
⌄
with
main as (
select
tx_hash,
block_timestamp,
event_name,
decoded_log:owner as user,
decoded_log:assets / 1e18 as amount_avusd,
decoded_log:shares / 1e18 as amount_savusd,
from
avalanche.core.ez_decoded_event_logs
where
tx_status = 'SUCCESS'
and origin_to_address = contract_address
and origin_to_address = '0x06d47f3fb376649c3a9dafe069b3d6e35572219e'
and event_name in ('Deposit', 'Withdraw')
)
select
date_trunc('{{ period }}', block_timestamp) as date,
event_name,
count(distinct tx_hash) as transactions,
count(distinct user) as users,
sum(amount_avusd) as volume_avusd,
sum(amount_savusd) as volume_savusd,
avg(amount_avusd) as average_amount_avusd,
avg(amount_savusd) as average_amount_savusd,
sum(volume_avusd) over (partition by event_name order by date) as cumulative_volume_avusd,
sum(volume_savusd) over (partition by event_name order by date) as cumulative_volume_savusd
from
main
group by 1, 2
order by 1, 2
QueryRunArchived: QueryRun has been archived