cristinatintofifa tournament r8.4
    Updated 2022-11-17
    with flow_price as (
    select date_trunc('hour', timestamp) as hour,
    avg(price_usd) as price
    from flow.core.fact_prices
    where token_contract = 'A.1654653399040a61.FlowToken'
    and timestamp::date >= current_date - 30
    group by 1
    )

    select payer as wallet,
    sum(price*gas_limit/pow(10,9)) as fees,
    rank() over (order by fees desc) as ranking
    from flow.core.fact_transactions
    inner join flow_price on date_trunc('hour', block_timestamp) = hour
    and block_timestamp::date >= current_date - 30
    group by 1
    qualify ranking <11

    Run a query to Download Data