Specterusdb blast trend
    Updated 2024-11-15

    WITH usdbm AS (
    --MINT
    SELECT
    Date_trunc('month', Block_timestamp) AS month,
    'Mint' AS Type,
    tx_hash,
    Amount_usd
    FROM blast.core.ez_token_transfers
    WHERE contract_address = '0x4300000000000000000000000000000000000003'
    AND from_address = '0x0000000000000000000000000000000000000000'

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

    SELECT
    month,
    type,
    COUNT(DISTINCT tx_hash) AS transaction,
    SUM(Amount_usd) AS amount_usd,
    SUM(SUM(Amount_usd)) OVER (ORDER BY month, type) AS cum_mint_burn,
    SUM(CASE WHEN type = 'Mint' THEN Amount_usd ELSE 0 END) -
    SUM(CASE WHEN type = 'Burn' THEN Amount_usd ELSE 0 END) AS net_supply
    FROM usdbm
    GROUP BY month, type
    ORDER BY month DESC;
    QueryRunArchived: QueryRun has been archived