MLDZMNmean6.1
    Updated 2022-09-02
    with tb1 as (select
    ADDRESS_NAME as tokens,
    CONTRACT_ADDRESS,
    sum(RAW_AMOUNT) as amount_open,
    count(distinct ORIGIN_FROM_ADDRESS) as distinct_users,
    count(distinct TX_HASH) as count_open
    from polygon.core.fact_token_transfers x
    join flipside_prod_db.polygon.labels y on x.CONTRACT_ADDRESS=y.ADDRESS
    where ORIGIN_TO_ADDRESS='0x059d306a25c4ce8d7437d25743a8b94520536bd5' and ORIGIN_FUNCTION_SIGNATURE='0x72ada4c5'
    group by 1,2)

    select
    tokens,
    case when CONTRACT_ADDRESS='0x2791bca1f2de4661ed88a30c99a7a9449aa84174' then amount_open/1e6
    when CONTRACT_ADDRESS='0xc2132d05d31c914a87c6611c10748aeb04b58e8f' then amount_open/1e6
    else amount_open/1e18
    end as volume,
    distinct_users,
    count_open
    from tb1
    group by 1,2,3,4 having volume is not null
    Run a query to Download Data