Updated 2024-08-19
    WITH

    number_of_transactions AS (
    SELECT
    DATE_TRUNC('{{Time_Frame}}', TIMESTAMP) AS timeframe
    , COUNT(DISTINCT(TX_HASH)) AS numberOfTXNs
    , SUM(COUNT(DISTINCT(TX_HASH))) OVER(ORDER BY DATE_TRUNC('{{Time_Frame}}', TIMESTAMP)) AS cumulativeNumberOfTXNs
    , SUM(ACTUAL_FEE/POW(10,18)) AS feeInETH
    , SUM(SUM(ACTUAL_FEE/POW(10,18))) OVER(ORDER BY DATE_TRUNC('{{Time_Frame}}', TIMESTAMP)) AS cumulativeFeeInETH
    , AVG(ACTUAL_FEE/POW(10,18)) AS avgFee
    , COUNT(DISTINCT(CONTRACT)) AS numberOfActiveUsers
    FROM external.tokenflow_starknet.decoded_transactions
    WHERE CHAIN_ID = 'mainnet'
    --AND TX_HASH = '0x07365305d71c57200eaf8ef5f2baafe7b567daf4f7cc99fc2e61a9fe04498c51'
    GROUP BY 1
    ORDER BY 1
    --LIMIT 100
    )

    , developer_activity AS (
    SELECT
    DATE_TRUNC('{{Time_Frame}}', TIMESTAMP) AS timeframe
    , COUNT(DISTINCT(PARAMETERS[0]:value)) AS numberOfDeployedContracts
    , SUM(COUNT(DISTINCT(PARAMETERS[0]:value))) OVER(ORDER BY DATE_TRUNC('{{Time_Frame}}', TIMESTAMP)) AS CumulativeNumberOfDeployedContracts
    FROM external.tokenflow_starknet.decoded_events
    WHERE CHAIN_ID = 'mainnet'
    AND NAME = 'ContractDeployed'
    AND TX_HASH NOT IN (
    SELECT
    TX_HASH
    FROM external.tokenflow_starknet.decoded_events
    WHERE NAME IN ('AccountCreated', 'account_deployed'
    , 'AccountInitialized', 'account_created', 'account_initialized')
    AND CHAIN_ID = 'mainnet'

    )
    QueryRunArchived: QueryRun has been archived