Tony_IntelveJoe staking
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
›
⌄
select
--sum(volume) over (partition by action order by date) as cumulative_volume,
sum(amount) over (partition by action order by date) as cumulative_amount,
date,
action
from (
select
sum(amount) as amount,
action,
date
from (
select
--sum(case when s.origin_function_signature = '0x2e1a7d4d' then (-s.amount/pow(10,18)*p.price)
--when s.origin_function_signature = '0xb6b55f25' then (s.amount/pow(10,18)*p.price) end) as volume,
sum(case when s.from_address = '0x25d85e17dd9e544f6e9f8d44f99602dbf5a97341' then (-s.RAW_AMOUNT/pow(10,18))
when s.to_address = '0x25d85e17dd9e544f6e9f8d44f99602dbf5a97341' then (s.RAW_AMOUNT/pow(10,18)) end) as amount,
case when s.from_address = '0x25d85e17dd9e544f6e9f8d44f99602dbf5a97341' then 'unstaking'
when s.to_address = '0x25d85e17dd9e544f6e9f8d44f99602dbf5a97341' then 'staking' end as action,
date_trunc('day', s.block_timestamp) as date
from avalanche.core.fact_token_transfers s
--join avalanche.core.fact_hourly_token_prices p
--on s.contract_address = p.token_address
--and date_trunc('hour', s.block_timestamp) = p.hour
where s.contract_address = lower('0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd')
and s.block_timestamp::date >= '2022-02-24'
group by 2, 3
union all
select
0 as amount,
'staking' as action,
date_trunc('day', block_timestamp) as date
from avalanche.core.fact_token_transfers
where block_timestamp::date >= '2022-02-24'
Run a query to Download Data