maybeyonassablier_top_reciever_dist
    Updated 2022-04-20
    with
    recieve as (
    select
    block_timestamp,
    'out' as direction,
    from_address as user,
    contract_address,
    raw_amount/pow(10,decimals) as amount,
    symbol,
    price
    from ethereum_core.fact_token_transfers t
    join ethereum_core.fact_hourly_token_prices p
    on t.contract_address = p.token_address
    and date_trunc('hour',block_timestamp) = hour
    where to_address = lower('0xCD18eAa163733Da39c232722cBC4E8940b1D8888')
    ),
    top10 as (
    select
    user,
    sum(case when amount*price is not null then amount*price else 0 end) as usd_vol
    from recieve
    group by 1
    order by usd_vol desc
    limit 10
    )

    select
    user,
    symbol,
    sum(case when amount*price is not null then amount*price else 0 end) as usd_vol
    from recieve
    where user in (select user from top10)
    group by 1,2
    Run a query to Download Data