HadisehBAYC and Ape Staking 6
    Updated 2022-12-07
    with ape_token as ( select (block_timestamp) as date,
    to_address as user,
    RAW_AMOUNT/pow(10,18) as amount
    from ethereum.core.ez_token_transfers
    where contract_address = lower('0x4d224452801aced8b2f0aebe155379bb5d594381')
    and from_address = lower('0x025c6da5bd0e6a5dd1350fda9e3b6a614b205a1f')
    and date >= '2022-03-17')
    ,
    tb1 as (select
    user
    from ape_token
    )
    ,
    sell as ( select block_timestamp as date,
    origin_from_address,
    origin_to_address
    from ethereum.core.fact_token_transfers
    where tx_hash not in ( select tx_hash
    from ethereum.core.fact_event_logs
    where contract_address = lower('0x4d224452801aced8b2f0aebe155379bb5d594381')))

    select
    symbol_out as symbol,
    count(DISTINCT tx_hash) as total_transaction,
    sum(amount_in_usd) as total_swap_vol
    from ethereum.core.ez_dex_swaps
    where origin_from_address in (select user from ape_token)
    and symbol_in = 'APE'
    and block_timestamp >= '2022-03-17'
    and symbol_in is not null
    and symbol_out is not null
    and amount_in_usd is not null
    group by symbol
    order by total_transaction desc
    limit 5
    Run a query to Download Data