damidezusdb blast
    Updated 2024-11-15
    WITH usdbm AS (
    --MINT
    SELECT
    'Mint' AS Type,
    Amount_usd
    FROM blast.core.ez_token_transfers
    WHERE contract_address = '0x4300000000000000000000000000000000000003'
    AND from_address = '0x0000000000000000000000000000000000000000'

    UNION ALL
    --Burn
    SELECT
    'Burn' AS Type,
    Amount_usd
    FROM blast.core.ez_token_transfers
    WHERE contract_address = '0x4300000000000000000000000000000000000003'
    AND to_address = '0x0000000000000000000000000000000000000000'
    )

    -- Calculate total minted and burned amounts
    SELECT type,
    SUM(Amount_usd) AS amount
    FROM usdbm
    GROUP BY type

    -- Calculate net supply (Minted - Burned)
    UNION ALL

    SELECT 'Supply' AS type,
    SUM(CASE WHEN type = 'Mint' THEN Amount_usd ELSE 0 END) -
    SUM(CASE WHEN type = 'Burn' THEN Amount_usd ELSE 0 END) AS net
    FROM usdbm
    ORDER BY amount asc;


    QueryRunArchived: QueryRun has been archived