SpiltadavidDaily Functions' Count
Updated 2023-02-02Copy Reference Fork
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
›
⌄
with chat1 as (select count(distinct TX_HASH) , METHOD_NAME ,case
when METHOD_NAME in ('deposit_and_stake' , 'stake' , 'stake_all') then 'STAKING'
when METHOD_NAME in ('unstake' , 'unstake_all') then 'UNSTAKING' end as functions
from near.core.fact_actions_events_function_call
where METHOD_NAME in ('deposit_and_stake','stake','stake_all','unstake','unstake_all')
and BLOCK_TIMESTAMP::date > CURRENT_DATE - interval '3 month'
group by 2,3)
, chat2 as (select block_timestamp::date , count(distinct TX_HASH) ,case
when METHOD_NAME in ('deposit_and_stake' , 'stake' , 'stake_all') then 'STAKING'
when METHOD_NAME in ('unstake' , 'unstake_all') then 'UNSTAKING' end as functions
from near.core.fact_actions_events_function_call
where METHOD_NAME in ('deposit_and_stake','stake','stake_all','unstake','unstake_all')
and BLOCK_TIMESTAMP::date > CURRENT_DATE - interval '3 month'
group by 1,3)
, chart3 as ( select block_timestamp::date as dt , count(distinct TX_HASH) as swaps , count(distinct TRADER) as wallets ,count(distinct POOL_ID) as pools,
sum(swaps) over (order by dt) as cum_swaps,sum(wallets) over (order by dt) as cum_wallets
from near.core.ez_dex_swaps
where platform = 'v2.ref-finance.near'
and BLOCK_TIMESTAMP::date > CURRENT_DATE - interval '3 month'
group by 1)
select * from chat2
Run a query to Download Data