DataBeingAverage Price Of Nouns Head Trait at Market
    Updated 2022-06-12
    with Nouns_attributes as (select
    block_number as mint_block,
    block_timestamp as mint_time,
    tx_hash as mint_hash,
    contract_address,
    tokenflow_eth.hextoint(topics[1])::integer 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 ethereum.core.fact_event_logs
    where block_number > 12000000
    and contract_address = '0x9c8ff314c9bc7f6e59a9d9225fb22946427edc03'
    and topics[0]::string = '0x1106ee9d020bfbb5ee34cf5535a5fbf024a011bd130078088cbf124ab3092478'
    order by tokenId desc),

    eth_price as (
    SELECT price, hour
    FROM ethereum.core.fact_hourly_token_prices
    WHERE symbol = 'WETH'
    )

    SELECT avg(s.PRICE_USD) as avg_usd, avg(s.price) as avg_price_eth, a.head
    FROM ethereum.core.ez_nft_sales as s
    RIGHT JOIN Nouns_attributes as a on a.tokenid = TRY_CAST(s.tokenid as INTEGER)
    WHERE NFT_ADDRESS = '0x9c8ff314c9bc7f6e59a9d9225fb22946427edc03'
    GROUP BY a.head
    HAVING avg_price_eth > 50
    Run a query to Download Data