Sbhn_NPinner-yellow
    Updated 2025-01-28
    with deposit as (select date_trunc('day',block_timestamp) as date,
    sum(amount_usd) as deposited
    from avalanche.core.ez_token_transfers
    where to_address in ('0xe3c983013b8c5830d866f550a28fd7ed4393d5b7',
    '0x203e9101e09dc87ce391542e705a07522d19df0d',
    '0xa53e127bfd9c4d0310858d9d5fcdf1d2617d4c41',
    '0x1d8bd363922465246a91b7699e7b32babf5fef62',
    '0x8f1dea444380a2ddc5e6669f508d235401caee5f',
    '0x0cec099933f0da490dff91724b02e2203faaf9af')
    and symbol in ('BTC.b','AUSD','SolvBTC','sAVAX','COQ','ggAVAX')
    and date >= '2024-10-07'
    group by 1),


    withdraw as (
    select date_trunc('day',block_timestamp) as date,
    sum(amount_usd) as withdrawn
    from avalanche.core.ez_token_transfers
    where from_address in ('0xe3c983013b8c5830d866f550a28fd7ed4393d5b7',
    '0x203e9101e09dc87ce391542e705a07522d19df0d',
    '0xa53e127bfd9c4d0310858d9d5fcdf1d2617d4c41',
    '0x1d8bd363922465246a91b7699e7b32babf5fef62',
    '0x8f1dea444380a2ddc5e6669f508d235401caee5f',
    '0x0cec099933f0da490dff91724b02e2203faaf9af')
    and symbol in ('BTC.b','AUSD','SolvBTC','sAVAX','COQ','ggAVAX')
    and date >= '2024-10-07'
    group by 1
    )

    select date,
    deposited,
    coalesce(withdrawn, 0) as withdrawn,
    deposited - coalesce(withdrawn, 0) as usd,
    sum(deposited - coalesce(withdrawn, 0)) over (order by date) as tvl
    from deposit
    left join withdraw using(date)
    QueryRunArchived: QueryRun has been archived