0xaimanwavault
    Updated 2023-05-19
    WITH first_interactions AS (
    SELECT
    DATE_TRUNC('month', MIN(block_timestamp)) AS month,
    from_address
    FROM
    avalanche.core.ez_token_transfers
    WHERE
    contract_address = '0xd26e504fc642b96751fd55d3e68af295806542f5'
    AND to_address = '0x0000000000000000000000000000000000000000'
    GROUP BY
    from_address
    ),
    monthly_summary AS (
    SELECT
    TO_CHAR(ft.month, 'YYYY-MM') AS "Month",
    COUNT(*) AS "Number of New Depositor",
    SUM(total_transactions) AS "Total Transactions",
    SUM(total_amount) AS "Volume Deposited",
    SUM(COUNT(*)) OVER (ORDER BY ft.month) AS "Cumulative New Depositor",
    SUM(SUM(total_transactions)) OVER (ORDER BY ft.month) AS "Cumulative Total Transactions",
    SUM(SUM(total_amount)) OVER (ORDER BY ft.month) AS "Cumulative Total Volume"
    FROM
    first_interactions ft
    JOIN (
    SELECT
    from_address,
    COUNT(*) AS total_transactions,
    SUM(raw_amount / 10e17) AS total_amount
    FROM
    avalanche.core.ez_token_transfers
    WHERE
    contract_address = '0xd26e504fc642b96751fd55d3e68af295806542f5'
    AND to_address = '0x0000000000000000000000000000000000000000'
    GROUP BY
    from_address
    ) t ON ft.from_address = t.from_address
    Run a query to Download Data