StangFAST01 copy
    Updated 2023-06-25
    -- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/bb68fbcc-21c9-4e37-a8ee-0206ecfa73f6

    -- with

    -- horizon AS
    -- (
    -- SELECT
    -- a.signer_id AS address
    -- FROM
    -- near.horizon.fact_decoded_actions a
    -- WHERE
    -- a.method_name = 'add_project'
    -- )
    SELECT
    date_trunc( '{{period}}' , a.block_timestamp ) AS date

    , count( DISTINCT a.tx_signer ) AS users
    , count( DISTINCT a.tx_hash ) AS transactions
    , sum( a.transaction_fee / 1e24 ) AS fees

    , sum( users ) over ( ORDER BY date ASC ) AS total_users
    , sum( transactions ) over ( ORDER BY date ASC ) AS total_transactions
    , sum( fees ) over ( ORDER BY date ASC ) AS total_fees
    FROM
    near.core.fact_transactions a

    JOIN
    near.core.dim_address_labels b
    ON a.tx_receiver = b.address

    WHERE
    date >= dateadd( 'year' , -{{year}} , current_date )
    AND date < dateadd( '{{period}}' , -1 , current_date )
    AND b.project_name IS NOT NULL
    AND b.address != 'near'
    Run a query to Download Data