FatemeTheLadyTop 10 destenitions
    Updated 2022-08-01
    WITH bridge_tx AS (
    SELECT block_timestamp AS bridge_date, origin_from_address as bridger
    FROM ethereum.core.fact_event_logs
    WHERE (ORIGIN_TO_ADDRESS=lower('0x401f6c983ea34274ec46f84d70b31c151321188b') or
    ORIGIN_TO_ADDRESS=lower('0xa0c68c638235ee32657e8f720a23cec1bfc77c77'))
    AND origin_function_signature IN ('0x4faa8a26' , '0xe3dec8fb')
    ),
    tx_time AS (
    SELECT bridger, MIN(block_timestamp) AS blocktime
    FROM polygon.core.fact_transactions a JOIN bridge_tx b ON a.from_address = b.bridger
    WHERE block_timestamp >= bridge_date
    GROUP BY 1
    ),
    tx_data AS (
    SELECT from_address, block_timestamp, tx_hash, to_address
    FROM polygon.core.fact_transactions
    ),
    first_tx AS(
    SELECT bridger, blocktime, tx_hash, to_address
    FROM tx_time a JOIN tx_data b ON a.blocktime = b.block_timestamp AND a.bridger=b.from_address
    ),
    final_data AS (
    select bridger,
    blocktime,
    tx_hash,
    to_address,
    project_name,
    --ADDRESS_NAME,
    label_type
    FROM first_tx a
    JOIN polygon.core.dim_labels b ON a.to_address = b.address
    WHERE NOT address_name LIKE '%canonical%'
    )
    SELECT project_name as "Project Name", label_type as "Type of Actions" --ADDRESS_NAME as "Address Name"
    , COUNT(bridger) as "Number of bridgers" FROM final_data
    Run a query to Download Data