alirsopensea fees -part-04
    Updated 2022-08-01
    SELECT
    CONCAT(RANK() OVER(ORDER BY n_tx DESC), '- ', to_address) as to_address,
    n_tx
    FROM (
    SELECT
    to_address,
    COUNT(tx_id) as n_tx
    FROM (
    SELECT
    TRUNC(block_timestamp, 'day') as date,
    tx_id,
    event_inputs:to::string as to_address,
    MAX(IFF(event_inputs:tokenId IS NOT NULL, contract_address, '')) as contract_address,
    MAX(IFF(event_inputs:tokenId IS NOT NULL, event_inputs:tokenId, -1)) as token_id
    FROM
    polygon.events_emitted
    WHERE
    tx_to_address = '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d' --opensea contract
    AND event_name = 'Transfer'
    AND contract_name = 'weth'
    AND event_inputs:from = '0xf715beb51ec8f63317d66f491e37e7bb048fcc2d'
    AND date>='2022-01-01'
    GROUP BY 1,2,3
    )
    GROUP BY 1
    ORDER BY 2 DESC
    LIMIT 9
    )
    Run a query to Download Data