freemartianHot Potato Traits
    Updated 2022-06-21
    with traits as (
    select
    TRY_CAST(tokenflow_eth.hextoint(topics[1]) as FLOAT) as id,
    tokenflow_eth.hextoint(substr(data,131,64)) as accessory,
    tokenflow_eth.hextoint(substr(data,195,64)) as head,
    tokenflow_eth.hextoint(substr(data,3,64)) as background,
    tokenflow_eth.hextoint(substr(data,259,64)) as glasses,
    tokenflow_eth.hextoint(substr(data,67,64)) as body
    from ethereum.core.fact_event_logs
    where contract_address = '0x4b10701bfd7bfedc47d50562b76b436fbb5bdb3b'
    and topics[0]::string = '0x1106ee9d020bfbb5ee34cf5535a5fbf024a011bd130078088cbf124ab3092478'
    ),
    lilnoun as (
    select event_inputs:nounId as Token_ID, Block_timestamp as mint_time
    from ethereum.core.fact_event_logs
    where origin_to_address = '0x55e0f7a3bb39a28bd7bcc458e04b3cf00ad3219e'
    and event_name = 'AuctionSettled'),


    sale as (
    select TOKENID, timestampdiff('hour', mint_time, block_timestamp) as difference, mint_time
    from ethereum.core.ez_nft_sales s
    inner join lilnoun ln on ln.Token_ID = s.TOKENID
    where nft_address = '0x4b10701bfd7bfedc47d50562b76b436fbb5bdb3b')

    select
    TOKENID, accessory, head, background, glasses, body, count(TOKENID) as repeated
    from traits inner join sale on sale.TOKENID = traits.id
    where difference < 24
    group by accessory, head, background, glasses, body, TOKENID
    Run a query to Download Data