SandeshUntitled Query
    Updated 2022-10-05
    -- reference https://app.flipsidecrypto.com/dashboard/W7KZ2_

    with nfts as (
    select address,
    address_name as nft_collection
    from optimism.core.dim_labels

    union ALL

    select column1 as address,
    column2 as NFT_Collection
    FROM (VALUES
    ('0x0110bb5739a6f82eafc748418e572fc67d854a0f','Early Optimists'),
    ('0xfa14e1157f35e1dad95dc3f822a9d18c40e360e2','Optimism Quest'),
    ('0xac3b9b3f5956b52c448158c0a07ddfa9d5c53a3b','OP Delegatooors'))),

    purchaset as (
    select buyer_address,
    nft_address,
    tokenid,
    min (block_timestamp::date) as purchase_date
    from optimism.core.ez_nft_sales t1 join nfts t2 on t1.nft_address = t2.address
    where nft_collection ilike '{{nft_collection}}'
    and origin_from_address != seller_address
    and block_timestamp between '{{start_date}}' and '{{end_date}}'
    and price_usd > 0
    group by 1,2,3),

    salet as (
    select seller_address,
    t1.nft_address,
    t1.tokenid,
    min (block_timestamp::date) as sale_date
    from optimism.core.ez_nft_sales t1 join nfts t2 on t1.nft_address = t2.address
    where nft_collection ilike '{{nft_collection}}'
    and block_timestamp between '{{start_date}}' and '{{end_date}}'
    Run a query to Download Data