MOHAMAD23Cryptopunk Sales and Traders (dollar cast)
    Updated 2022-08-27
    with data_ as(
    select *
    from ethereum.core.ez_nft_sales
    where PROJECT_NAME = 'cryptopunks' AND EVENT_TYPE ='sale' and ORIGIN_FUNCTION_SIGNATURE ='0x8264fe98' and NFT_ADDRESS='0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb'
    ),
    input_ as (
    select SELLER_ADDRESS,TOKENID,PRICE as sell,PRICE_USD as s
    from data_
    ),
    output_ as (
    select BUYER_ADDRESS,TOKENID,PRICE as buy,PRICE_USD as b
    from data_
    ),
    profits as (
    select SELLER_ADDRESS ,(sell-buy) as profit,(s-b) as profit_usd
    from input_ join output_ on input_.TOKENID= output_.TOKENID and input_.SELLER_ADDRESS= output_.BUYER_ADDRESS
    where s is not null and b is not null
    )
    select sum (profit) as total_profit___ETH___,sum (profit_usd) as dollar_cast_total_profit,SELLER_ADDRESS as user_wallet
    from profits
    group by 3
    order by 2 desc
    limit 10
    Run a query to Download Data