tarzanmoradiniaAddresses that users acquire their first SUSHI
    Updated 2022-06-22
    with useraddress as (
    select ORIGIN_TO_ADDRESS,
    min(block_timestamp) as mindate -- minimum date of depositin for each account
    FROM ethereum.core.fact_token_transfers
    WHERE CONTRACT_ADDRESS='0x6b3595068778dd592e39a122f4f5a5cf09c90fe2'--sushi token address
    group by 1
    ),
    findsource as ( --find wallets that send token for first wallets
    select ORIGIN_TO_ADDRESS as wallet,
    ORIGIN_FROM_ADDRESS, BLOCK_TIMESTAMP as fundtime, TX_HASH
    from ethereum.core.fact_token_transfers
    ),
    findaddress as (
    select f.ORIGIN_FROM_ADDRESS as source_address,
    count(distinct f.TX_HASH) as source_wallet
    from useraddress u INNER join findsource f
    on u.mindate = f.fundtime
    group by 1
    order by 2 DESC
    ),
    label as ( --give labels to wallets addresses
    select ADDRESS_NAME as name,
    ADDRESS as addresss,
    LABEL_TYPE as Label_type
    from ethereum.core.dim_labels
    )
    select
    l.name,
    l.addresss as "Source Wallet Address",
    r.source_wallet as "Charged Wallets",
    l.Label_type
    from findaddress r INNER join label l
    on r.source_address = l.addresss
    order by 3 DESC
    limit 20
    Run a query to Download Data