TheLaughingManspecial gas - over time contract interactor
    Updated 2025-02-20
    -- forked from special gas - over time only orig_func @ https://flipsidecrypto.xyz/studio/queries/618a596f-664b-4202-95a6-e30455821345

    -- forked from special gas - over time copy @ https://flipsidecrypto.xyz/studio/queries/44b3d4e4-ed24-4080-823a-8c2bd6be1c46

    -- forked from special gas - over time @ https://flipsidecrypto.xyz/studio/queries/f4d9a46a-86d0-400e-a6f8-ae8e30a6c748

    -- forked from special gas - overview @ https://flipsidecrypto.xyz/studio/queries/a3005985-08d8-45d0-9508-af694e68c37f

    with gas_base as (
    SELECT
    block_timestamp
    , tx_hash
    , to_address as wallet
    , VALUE as amount
    --, row_number() OVER (partition by to_address ORDER BY tx_hash DESC) as rank
    from monad.testnet.fact_traces
    WHERE 1=1
    --AND tx_hash = '0xdac05244373d466d547690ecaf151b3a3a1d6365a520c68528e8a83681dc7351'
    AND from_address = '0x9fb480a193c250bf8ece39df5d9d728e21026b34'
    AND TX_SUCCEEDED
    AND trace_index>=1
    --AND block_number<4000000
    )

    SELECT
    date_trunc('minute', block_timestamp) as dmin
    , COUNT(distinct wallet) as users
    , COUNT(distinct tx_hash) as txns
    , SUM(amount) as total_mon
    , SUM(total_mon) OVER (ORDER BY dmin ASC) as mon_cumulative
    , SUM(users) OVER (ORDER BY dmin ASC) as users_cumulative
    , SUM(txns) OVER (ORDER by dmin ASC) as txns_total
    from gas_base
    GROUP BY 1
    ORDER BY 1 ASC
    QueryRunArchived: QueryRun has been archived