Pine AnalyticsOptimism copy
    Updated 2025-02-17
    select
    day,
    sum(total_supply) AS total_supply

    from (
    select
    *
    from (
    select
    date(block_timestamp) as day,
    'USDC' as token,
    sum(
    case when from_address like '0x0000000000000000000000000000000000000000' then RAW_AMOUNT
    when to_address like '0x0000000000000000000000000000000000000000' then -RAW_AMOUNT
    else 0 end
    ) / power(10, 6) as net_supply,
    sum(net_supply) over (order by day) as total_supply

    from optimism.core.fact_token_transfers
    where contract_address like lower('0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85')
    group by 1,2
    order by 1 desc
    )
    where day > '2024-01-01'

    union all

    select
    *
    from (
    select
    date(block_timestamp) as day,
    'USDT' as token,
    sum(
    case when from_address like '0x0000000000000000000000000000000000000000' then RAW_AMOUNT
    when to_address like '0x0000000000000000000000000000000000000000' then -RAW_AMOUNT
    QueryRunArchived: QueryRun has been archived