amelia-leessssssss
    Updated 2022-11-16
    with price as ( SELECT TIMESTAMP::DATE as TIME, avg (PRICE_USD) as Price from flow.core.fact_prices WHERE TOKEN_CONTRACT = 'A.1654653399040a61.FlowToken' GROUP by 1 ),

    top10 as (select
    PROJECT_NAME,

    count(distinct tx_id) as TXN,
    count(distinct DELEGATOR) as Users,
    sum(amount) as Amounts
    from flow.core.ez_staking_actions s
    LEFT JOIN price on TIME = block_timestamp::DATE
    LEFT JOIN flow.core.dim_validator_labels v ON v.NODE_ID = s.NODE_ID
    where action LIKE '%Committed%'
    and TX_SUCCEEDED = 'TRUE' and block_timestamp >= '2022-01-01' and block_timestamp < CURRENT_DATE
    group by 1 ORDER by Amounts DESC limit 10)

    select
    date_trunc('week',block_timestamp) as date,
    PROJECT_NAME,

    count(distinct tx_id) as TXN, sum (TXN) over (partition by PROJECT_NAME order by date ) as cum_TXN,
    count(distinct DELEGATOR) as Users, sum (Users) over (partition by PROJECT_NAME order by date ) as cum_Users,

    count(distinct s.node_id) as Nodes, sum (Nodes) over (partition by PROJECT_NAME order by date ) as cum_Nodes,
    Run a query to Download Data