TheLaughingManspecial gas - leaderboard
    Updated 2025-02-19
    -- 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
    tx_hash
    , block_number
    , block_timestamp
    , 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 origin_to_address = '0x9fb480a193c250bf8ece39df5d9d728e21026b34'
    AND origin_function_signature = '0x7a53bcfc'
    AND TX_SUCCEEDED
    AND trace_index>=1
    AND block_number<4000000
    )

    , aggr as (
    SELECT
    wallet
    , SUM(amount) as mon_gas_totals
    , COUNT(DISTINCT tx_hash) as payout_txns
    , rank() OVER (order BY mon_gas_totals DESC) as rank
    from gas_base
    GROUP BY 1
    ORDER BY 2 DESC
    )

    SELECT * from aggr
    ORDER BY 2 DESC
    LIMIT 100
    QueryRunArchived: QueryRun has been archived