MasiBTC.b
    Updated 2025-03-15
    -- forked from AUSD @ https://flipsidecrypto.xyz/studio/queries/ec0ea703-21ce-402a-bf91-a5d92d272206

    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'),
    Last run: about 1 month ago
    DATE
    DEPOSIT
    WITHD
    CUM_DE
    CUM_WI
    TVL
    1
    2025-01-06 00:00:00.0000.106.74580858-6.037175710.70863287
    2
    2025-01-30 00:00:00.000-0.148216857.30464061-6.672429230.63221138
    3
    2024-11-18 00:00:00.000-0.377610211.54123492-1.255244260.28599066
    4
    2024-12-20 00:00:00.0000.62837371-0.57876.48079633-5.904681940.57611439
    5
    2024-10-23 00:00:00.0000.0002203700.58805362-0.215331180.37272244
    6
    2024-12-01 00:00:00.0000.01133793-1.015.38863907-4.691376010.69726306
    7
    2025-01-19 00:00:00.000-0.016776037.11603094-6.077164771.03886617
    8
    2024-10-15 00:00:00.0000.0034157800.28377029-0.210754980.07301531
    9
    2024-10-09 00:00:00.0000.01316-0.000009950.01316-0.000009950.01315005
    10
    2024-12-23 00:00:00.0000.011415506.58877392-5.91737620.67139772
    11
    2024-10-22 00:00:00.0000.0050922800.58783325-0.215331180.37250207
    12
    2024-12-06 00:00:00.0000.0003793205.6792316-5.080114940.59911666
    13
    2024-11-13 00:00:00.0000.0002303501.54123492-0.502634051.03860087
    14
    2024-12-17 00:00:00.0000.022105.74150188-5.261961450.47954043
    15
    2024-11-06 00:00:00.0000.00365804-0.021510.751009-0.462344050.28866495
    16
    2024-12-22 00:00:00.0000.00102081-0.012694266.57735842-5.91737620.65998222
    17
    2024-12-24 00:00:00.0000.0009506.58972392-5.91737620.67234772
    18
    2024-10-29 00:00:00.0000.00686675-0.213917370.71770967-0.429508510.28820116
    19
    2024-11-30 00:00:00.0001.49631938-0.10095.37730114-3.681376011.69592513
    20
    2024-10-25 00:00:00.0000.0770479600.69945606-0.215331180.48412488
    ...
    104
    8KB
    4s