binhachonSecondary Sales Activity - Trait
    Updated 2022-06-18
    with mint_txs as (
    select
    *
    from ethereum.core.fact_event_logs
    where 1=1 --tx_hash = '0x0a1b28917c4841a565a88e38e7c52fbe62349d6703c15fb1bfbb542ef43f119a'
    and block_number > 13736710
    and contract_address = '0x4b10701bfd7bfedc47d50562b76b436fbb5bdb3b'
    ),
    mint_list as (
    select
    block_number as mint_block,
    block_timestamp as mint_time,
    tx_hash as mint_hash,
    contract_address,
    tokenflow_eth.hextoint(topics[1])::string as tokenid,
    tokenflow_eth.hextoint(substr(data,3,64)) as background,
    tokenflow_eth.hextoint(substr(data,67,64)) as body,
    tokenflow_eth.hextoint(substr(data,131,64)) as accessory,
    tokenflow_eth.hextoint(substr(data,195,64)) as head,
    tokenflow_eth.hextoint(substr(data,259,64)) as glasses
    from mint_txs
    where topics[0]::string = '0x1106ee9d020bfbb5ee34cf5535a5fbf024a011bd130078088cbf124ab3092478'
    ),
    sales_transactions as (
    select
    tokenid::string as tokenid,
    min(block_timestamp) as min_time
    from ethereum.core.ez_nft_sales
    where nft_address = '0x4b10701bfd7bfedc47d50562b76b436fbb5bdb3b'
    group by 1
    ),
    first_sales as (
    select
    mint_list.*,
    coalesce(min_time, getdate()) as first_sales,
    datediff('hour', mint_time, first_sales) as number_of_hours
    Run a query to Download Data