Sandeshnear proposal metrics
    Updated 2022-08-10
    with failed as (
    select tx_hash from near.core.fact_receipts
    where Parse_json(status_value):"Failure" is not null
    ),
    proposal as
    (select
    fc.tx_hash,
    fc.block_timestamp,
    fc.method_name,
    t.tx_receiver as platform,
    t.tx_signer as voter,
    PARSE_JSON(args):"action" as action,
    PARSE_JSON(args):"id" as proposal
    from near.core.fact_actions_events_function_call fc
    inner join near.core.fact_transactions t on fc.tx_hash=t.tx_hash
    where
    t.tx_hash not in (select * from failed)
    and
    fc.method_name in ('act_proposal')
    and platform in ('ref-finance.sputnik-dao.near','ref-community-board.sputnik-dao.near')
    )
    select 'number_of_proposals' as "param", max(proposal) as metric from proposal
    UNION
    select 'number_of_voters' as "param", (count (distinct voter)) as metric from proposal


    Run a query to Download Data