MasiAUSD
    Updated 2025-03-15
    with tb0_price as ( select trunc(hour,'day') as date,
    case when token_address = lower('0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be') then 'sAVAX'
    when token_address = lower('0x152b9d0FdC40C096757F570A51E494bd4b943E50') then 'BTC.b'
    when token_address = lower('0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E') then 'AUSD'
    when token_address = lower('0x420FcA0121DC28039145009570975747295f2329') then 'COQ' end as symbol,
    avg(price) as avg_price
    from avalanche.price.ez_prices_hourly
    where date = current_date
    and token_address in (lower('0x2b2c81e08f1af8835a78bb2a90ae924ace0ea4be'),
    lower('0x152b9d0FdC40C096757F570A51E494bd4b943E50'),
    lower('0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E'),
    lower('0x420FcA0121DC28039145009570975747295f2329'))
    group by 1,2
    UNION
    select trunc(hour,'day') as date,
    case when token_address = lower('0x152b9d0FdC40C096757F570A51E494bd4b943E50') then 'SolvBTC' end as symbol,
    avg(price) as avg_price
    from avalanche.price.ez_prices_hourly
    where date = current_date
    and token_address = lower('0x152b9d0FdC40C096757F570A51E494bd4b943E50')
    group by 1,2 )
    ,
    tb1 as ( select trunc(block_timestamp,'day') as day,
    symbol,
    count(DISTINCT tx_hash) as deposit_tx,
    count(DISTINCT origin_from_address) as depositor,
    sum(amount) as deposit_amount
    from avalanche.core.ez_token_transfers
    where origin_to_address in (lower('0xE3C983013B8c5830D866F550a28fD7Ed4393d5B7'),
    lower('0x203E9101e09dc87ce391542E705a07522d19dF0d'),
    lower('0xa53E127Bfd9C4d0310858D9D5Fcdf1D2617d4C41'),
    lower('0x420FcA0121DC28039145009570975747295f2329'),
    lower('0x1D8bd363922465246A91B7699e7B32BAbf5FEF62'))
    and to_address in (lower('0xE3C983013B8c5830D866F550a28fD7Ed4393d5B7'),
    lower('0x203E9101e09dc87ce391542E705a07522d19dF0d'),
    lower('0xa53E127Bfd9C4d0310858D9D5Fcdf1D2617d4C41'),