freemartianEngagement Level
    Updated 2022-11-10
    with source_mints as (
    select
    tx_hash,
    block_timestamp,
    contract_address as collection,
    event_inputs:_to as minter,
    event_inputs:_id as NFTid
    from polygon.core.fact_event_logs
    where origin_function_signature in ('0x5a86c41a', '0x669f5a51')
    and event_inputs:_from = '0x0000000000000000000000000000000000000000'
    and event_name = 'TransferSingle'
    and tx_status = 'SUCCESS'),

    sales as (
    select
    tx_hash,
    event_inputs:_from as seller,
    event_inputs:_to as buyer,
    event_inputs:_id
    from polygon.core.fact_event_logs
    where contract_address in (select collection from source_mints)
    and event_inputs:_from != '0x0000000000000000000000000000000000000000'
    and event_inputs:_to != '0x0000000000000000000000000000000000000000'
    and event_name = 'TransferSingle'
    and tx_status = 'SUCCESS')

    select
    origin_from_address, count(distinct l.tx_hash) as interaction,
    case when interaction >= 1 and interaction < 10 then 'low'
    when interaction >= 10 and interaction < 30 then 'medium'
    when interaction >= 30 and interaction < 70 then 'good'
    when interaction >= 70 and interaction < 100 then 'high'
    when interaction >= 100 then 'expert'
    end as engagement_level
    from source_mints m inner join polygon.core.fact_event_logs l on origin_from_address = minter
    where l.block_timestamp > m.block_timestamp
    Run a query to Download Data