ibcflanAnalyzing all user types in the ION/WETH Aerodrome Flywheel
    Updated 2024-09-08
    --SELECT COUNT(DISTINCT DECODED_LOG:voter) as voter_count
    --FROM base.core.ez_decoded_event_logs
    --WHERE contract_address = '0x16613524e02ad97edfef371bc883f2f5d6c480a5' -- Aerodrome Voter contract
    -- AND event_name = 'Voted'
    --AND decoded_log:pool = '0x0fac819628a7f612abac1cad939768058cc0170c'
    --AND block_timestamp >= '2024-07-01'
    WITH voters AS (
    SELECT DISTINCT DECODED_LOG:voter AS address
    FROM base.core.ez_decoded_event_logs
    WHERE contract_address = '0x16613524e02ad97edfef371bc883f2f5d6c480a5' -- Aerodrome Voter contract
    AND event_name = 'Voted'
    AND decoded_log:pool = '0x0fac819628a7f612abac1cad939768058cc0170c'
    AND block_timestamp >= '2024-07-01'
    ),
    lp_holders AS (
    SELECT DISTINCT
    CASE
    WHEN DECODED_LOG:from = '0x0000000000000000000000000000000000000000' THEN DECODED_LOG:to
    ELSE DECODED_LOG:from
    END AS address
    FROM base.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = '0x0fac819628a7f612abac1cad939768058cc0170c' -- ION/WETH LP Pool
    AND EVENT_NAME = 'Transfer'
    AND block_timestamp >= '2024-07-01'
    ),
    gauge_lockers AS (
    SELECT DISTINCT DECODED_LOG:from AS address
    FROM base.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = '0x0fac819628a7f612abac1cad939768058cc0170c' -- ION/WETH LP Pool
    AND EVENT_NAME = 'Transfer'
    AND DECODED_LOG:to = '0x9b42e5f8c45222b2715f804968251c747c588fd7' -- ION/WETH Gauge
    AND block_timestamp >= '2024-07-01'
    ),
    ion_sellers AS (
    SELECT DISTINCT DECODED_LOG:sender AS address
    FROM base.core.ez_decoded_event_logs
    QueryRunArchived: QueryRun has been archived