hessSales Breakdown based on Sellers
    Updated 2022-09-17
    with tx_hash_op as ( select tx_hash
    from optimism.core.fact_event_logs
    where CONTRACT_ADDRESS = '0x998ef16ea4111094eb5ee72fc2c6f4e6e8647666')
    ,
    op_wop_eth_sales as ( select tx_hash
    from optimism.core.fact_event_logs
    where contract_address = '0x4200000000000000000000000000000000000006')
    ,
    op_data_ as ( select date(block_timestamp) as date, tx_hash, EVENT_INPUTS:from as seller, EVENT_INPUTS:to as buyer, contract_address as collection,EVENT_INPUTS[0]:tokenid as token
    from optimism.core.fact_event_logs
    where event_name = 'Transfer' and tx_hash in ( select tx_hash from tx_hash_op)
    )
    ,
    op_eth_sale as (select date, a.tx_hash , 'ETH' as symbol , seller, buyer, collection,token , eth_value as amount
    from op_data_ a join optimism.core.fact_transactions b on a.tx_hash = b.tx_hash
    where eth_value != 0)
    ,
    op_nft_z as ( select date(BLOCK_TIMESTAMP) as date, tx_hash , CURRENCY_SYMBOL as symbol, seller_address as seller, buyer_address as buyer,
    nft_address as collection , price as amount, tokenid as token
    from optimism.core.ez_nft_sales
    where tx_hash not in ( select tx_hash from tx_hash_op) and event_type = 'sale')
    ,
    op_nft as ( select *
    from op_nft_z)
    ,
    op_sale as ( select date(block_timestamp) as date, tx_hash , 'OP' as symbol , EVENT_INPUTS:from as seller, EVENT_INPUTS:to as buyer,
    CONTRACT_ADDRESS as collection , EVENT_INPUTS:tokenId as token
    FROM optimism.core.fact_event_logs
    where event_name = 'Transfer' and CONTRACT_ADDRESS != '0x4200000000000000000000000000000000000042' and contract_address != '0x4200000000000000000000000000000000000006'
    and tx_hash not in ( select tx_hash from op_eth_sale) and tx_hash in (select tx_hash from tx_hash_op))
    ,
    op_data as ( select date, a.tx_hash , symbol , seller, buyer, collection ,token, raw_amount/pow(10,18) as amount
    from optimism.core.fact_token_transfers a join op_sale b on a.tx_hash = b.tx_hash)
    ,
    op_weth as ( select tx_hash
    from optimism.core.fact_event_logs
    Run a query to Download Data