sepehrmhz8Untitled Query
    Updated 2022-11-25
    with cexs as (select * from ethereum.core.dim_labels where label_type ='cex' and label_subtype = 'hot_wallet'),
    maintable as (
    select block_timestamp ,
    contract_address,
    tx_hash,
    to_address,
    amount_usd
    from ethereum.core.ez_token_transfers where from_address in (select address from cexs)
    and amount_usd > 0 and block_timestamp >= '2022-11-06'

    union all

    select block_timestamp,
    '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' as contract_address,
    tx_hash,
    eth_to_address as to_address,
    amount_usd
    from ethereum.core.ez_eth_transfers where eth_from_address in (select address from cexs)
    and amount_usd > 0 and block_timestamp >= '2022-11-06'),

    swapt1 as (
    select t1.block_timestamp,origin_from_address
    from ethereum.core.ez_dex_swaps t1 join maintable t2 on t1.origin_from_address = t2.to_address and t2.contract_address = t1.token_in and t1.block_timestamp > t2.block_timestamp
    ),

    swapt2 as (select distinct origin_from_address, min(block_timestamp) as mindate from swapt1 group by 1),
    swapt3 as (select 'Swap' as type, count (distinct origin_from_address) as Users_Count from swapt2),

    nftt1 as (select t1.block_timestamp,buyer_address
    from ethereum.core.ez_nft_sales t1 join maintable t2 on t1.buyer_address = t2.to_address and t1.block_timestamp > t2.block_timestamp),

    nftt2 as (select distinct buyer_address, min(block_timestamp) as mindate from nftt1 group by 1),

    nftt3 as (select 'Buy NFT' as type, count (distinct buyer_address) as Users_Count from nftt2),
    Run a query to Download Data