LuqmanUntitled Query
    Updated 2022-08-31
    with profit as (
    with spending as (
    with bid_tx as (
    select
    tx_hash,
    block_timestamp,
    event_inputs:to as buyer
    from ethereum.core.fact_event_logs
    where 1 = 1
    and contract_name = 'CryptoPunksMarket'
    and origin_function_signature = '0x23165b75'
    and buyer is not null
    )
    ,hourly_price as (
    select
    hour,
    price as eth_price
    from ethereum.core.fact_hourly_token_prices
    where symbol = 'WETH'
    )
    ,acceptBid as (
    select
    buyer,
    h.hour,
    tokenflow_eth.hextoint(substr(input_data,11,64)) as punkIndex,
    tokenflow_eth.hextoint(substr(input_data,11+64,64))/pow(10,18) as price,
    eth_price*price as price_usd
    from ethereum.core.fact_transactions f
    join hourly_price h on h.hour = date_trunc('hour', f.block_timestamp)
    join bid_tx t on f.tx_hash = t.tx_hash
    )
    ,offered as (
    select
    buyer_address as buyer,
    tokenid as punkIndex,
    price,
    Run a query to Download Data