adriaparcerisasCEL behavior of Celsius wallets over the past 90 days
    Updated 2022-07-29
    -- What are the top addresses swapping and transferring CEL?
    -- How have the CEL swap volumes changed over the past 90 days?
    -- How are Celsius wallets interacting with the CEL token?

    with
    addresses as (
    select * from crosschain.address_labels
    where address_name = 'celsius wallet'
    ),
    new_addresses as (
    select
    *
    from ethereum.core.fact_event_logs
    where (
    origin_from_address in (select address from addresses)
    or origin_to_address in (select address from addresses)
    ) and block_timestamp > CURRENT_DATE-90
    and event_name <> 'Approval'
    ),
    transfers as (
    SELECT
    trunc(block_timestamp,'day') as date,
    count(distinct tx_hash) as counts,
    sum(event_inputs:value/pow(10,decimals)) as token_volume
    from new_addresses x
    join ethereum.core.dim_contracts y on x.contract_address=y.address
    where event_name='Transfer' and contract_address='0xaaaebe6fe48e54f431b0c390cfaf0b017d09d42d' --and contract_name is not null
    group by 1
    ),
    swaps as (
    SELECT
    trunc(block_timestamp,'day') as date,
    count(distinct tx_hash) as counts,
    sum(event_inputs:value/pow(10,decimals)) as token_volume
    from new_addresses x
    join ethereum.core.dim_contracts y on x.contract_address=y.address
    Run a query to Download Data