permaryflaky-lavender
    Updated 2025-04-05
    WITH fmon_airdrop_events AS (
    SELECT
    tx_hash,
    '0x'||SUBSTRING(topics[1], 27) AS distributor_contract,
    '0x'||SUBSTRING(topics[2], 27) AS recipient_wallet,
    CAST(ethereum.public.udf_hex_to_int(data) AS NUMERIC) / 1e18 AS fmon_amount,
    block_timestamp
    FROM monad.testnet.fact_event_logs
    WHERE
    contract_address = lower('0x89e4a70de5F2Ae468B18B6B6300B249387f9Adf0') -- FMON Token Contract
    AND topics[0] = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' -- ERC-20 Transfer
    AND block_timestamp BETWEEN '2025-03-12 17:35:46' AND '2025-03-13 22:24:53'
    AND '0x'||SUBSTRING(topics[1], 27) = lower('0xdCf3c00e9F8A2FdaaF19Fe59050e80c433b509DC') -- Airdrop contract distributing FMON
    ),

    airdrop_tx_cost AS (
    SELECT
    tx_hash,
    MAX(tx_fee) AS tx_fee_mon -- Ensuring one fee per tx_hash
    FROM monad.testnet.fact_transactions
    WHERE tx_hash IN (SELECT DISTINCT tx_hash FROM fmon_airdrop_events)
    GROUP BY tx_hash
    ),

    total_tx_cost AS (
    SELECT
    SUM(tx_fee_mon) AS total_gas_cost_mon,
    COUNT(tx_hash) AS total_tx_hash
    FROM airdrop_tx_cost
    )

    SELECT
    COUNT(DISTINCT recipient_wallet) AS unique_recipients,
    COUNT(DISTINCT tx_hash) AS total_txns,
    SUM(fmon_amount) AS total_fmon_airdropped,
    (SELECT total_gas_cost_mon FROM total_tx_cost) AS total_gas_cost_mon,
    Last run: 21 days ago
    UNIQUE_RECIPIENTS
    TOTAL_TXNS
    TOTAL_FMON_AIRDROPPED
    TOTAL_GAS_COST_MON
    AVG_GAS_PER_RECIPIENT
    AVG_GAS_PER_TXN
    AVG_RECIPIENTS_PER_TXN
    1
    999197295400000132892332.061726.4740940240.0017278615675.8524545563387.108475
    1
    87B
    84s