mucryptospenders on uniswap
    Updated 2023-06-08
    with uniswap as (select
    block_timestamp,
    from_address,
    sum(tx_fee) as total_tx_fee_spent
    from ethereum.core.fact_transactions
    where block_timestamp >= sysdate() -interval '1 month'
    and to_address = '0xef1c6e67703c7bd7107eed8303fbe6ec2554bf6b' -- uniswap: universal router
    group by 1,2
    having total_tx_fee_spent > 0.05
    qualify row_number() over (order by total_tx_fee_spent desc) <=10)

    select
    contract_address,
    case
    when contract_address = '0x244b797d622d4dee8b188b03546acaabd0cf91a0' then 'FOUR'
    else symbol end as symbol,
    sum(amount) as volume,
    sum(amount_usd) as usd_volume,
    count(1) as transfer_count
    from ethereum.core.ez_token_transfers
    where block_timestamp >= sysdate() - interval '1 month'
    and has_price = 'true'
    and origin_from_address in (
    select from_address
    from uniswap)
    group by 1,2
    qualify row_number() over (order by transfer_count desc) <= 10
    order by transfer_count desc

    with list as (select
    sum(token_price * raw_amount/1e18) as amount_usd
    from ethereum.core.ez_token_transfers
    where contract_address = '0x244b797d622d4dee8b188b03546acaabd0cf91a0'
    and token_price is not null)

    select