sinahosseinzadeh2023-04-08 07:01 PM
    Updated 2023-04-08
    WITH whales AS (
    SELECT DISTINCT trader
    FROM flow.core.ez_swaps
    WHERE block_timestamp >= CURRENT_DATE - 90
    AND ((token_out_contract = 'A.1654653399040a61.FlowToken' AND token_out_amount >= 6600)
    OR (token_in_contract = 'A.1654653399040a61.FlowToken' AND token_in_amount >= 6600))
    ),
    whale_tx AS (
    SELECT tx_id AS tx
    FROM flow.core.fact_transactions
    JOIN whales
    ON proposer = trader
    WHERE block_timestamp >= CURRENT_DATE - 30
    )
    SELECT event_type
    , COUNT(DISTINCT tx_id) as num
    , row_number() over(ORDER BY num desc) as rank
    FROM flow.core.fact_events
    WHERE block_timestamp >= CURRENT_DATE - 30
    AND tx_succeeded = TRUE
    AND tx_id IN (SELECT tx FROM whale_tx)
    GROUP BY event_type
    ORDER BY rank
    limit 10
    Run a query to Download Data