MasiDaily Numbers
    Updated 2025-05-13
    with tb1 as (select block_timestamp,
    tx_hash,
    from_address,
    origin_from_address,
    value as Collateral,
    regexp_substr_all(substr(input,11, len(input)), '.{64}') as segmented,
    left(input,10) as signiture,
    segmented[0] as raw1,
    segmented[1] as raw2,
    segmented[2] as raw3,
    segmented[3] as raw4,
    input,
    case when left(input,10) = '0x8f09162b' then livequery.utils.udf_hex_to_int(raw2)/pow(10,18)
    when left(input,10) = '0x8e54c119' then livequery.utils.udf_hex_to_int(raw3)/pow(10,18) end as borrow_amount
    from mezo.testnet.fact_traces
    where to_address = '0x20faea18b6a1d0fcdbccfffe3d164314744baf30'
    and origin_to_address = '0x20faea18b6a1d0fcdbccfffe3d164314744baf30'
    and left(input,10) in ('0x8f09162b','0x8e54c119')
    and TRACE_SUCCEEDED = 'TRUE'
    and TX_SUCCEEDED = 'TRUE'
    )

    select trunc(block_timestamp,'day') as day,
    count(distinct tx_hash) as transactions,
    count(distinct from_address) as wallets,
    sum(COLLATERAL) as "COLLATERAL Amount (BTC)",
    "COLLATERAL Amount (BTC)"/wallets as "Avg Collateral Per Wallet (BTC)",
    sum("COLLATERAL Amount (BTC)") over (order by day asc) as "Cumulative Collateral (BTC)",
    sum(BORROW_AMOUNT) as "Borrow Amount (mUSD)",
    "Borrow Amount (mUSD)"/wallets as "Avg Borrow Amount Per Wallet (mUSD)",
    sum("Borrow Amount (mUSD)") over (order by day asc) as "Cumulative Borrow Amount (mUSD)",
    avg(COLLATERAL) as "Avg COLLATERAL (BTC)",
    median(COLLATERAL) as "Median COLLATERAL (BTC)",
    max(COLLATERAL) as "Max COLLATERAL (BTC)",
    avg(BORROW_AMOUNT) as "Avg Borrow (mUSD)",
    median(BORROW_AMOUNT) as "Median Borrow (mUSD)",
    Last run: 19 days ago
    DAY
    TRANSACTIONS
    WALLETS
    COLLATERAL Amount (BTC)
    Avg Collateral Per Wallet (BTC)
    Cumulative Collateral (BTC)
    Borrow Amount (mUSD)
    Avg Borrow Amount Per Wallet (mUSD)
    Cumulative Borrow Amount (mUSD)
    Avg COLLATERAL (BTC)
    Median COLLATERAL (BTC)
    Max COLLATERAL (BTC)
    Avg Borrow (mUSD)
    Median Borrow (mUSD)
    Max Borrow (mUSD)
    1
    2025-05-13 00:00:00.0005624870.14740002220.0003026694518.0810824723899193.88006.558110883295780599.6494890.00026227761950.00018235250.00268498346938.067259786310050157
    2
    2025-04-19 00:00:00.00010349330.2558460040.000274218653810.8248432263868927.674146.760632369180851902.820.00024743327280.0001550.055977720313741.7095454552600700000
    3
    2025-04-23 00:00:00.0006585950.110773460.000186173882411.4724089991837344.563087.97405042191387008.990.00016834872350.0001550.0024952792.316960486200044938.94
    4
    2025-04-11 00:00:00.0004474070.2910296650.0007150606026.3692600875019397.2212332.671302211102566431.940.00065107307610.0001650.01839511229.076554812695.61332591.58
    5
    2025-03-31 00:00:00.00052520.025300435450.00048654683563.353450239409380.437872.70057692352283065.920.00048654683560.00015130.00999477057872.7005769232525.55180620
    6
    2025-04-26 00:00:00.000111310900.19573692560.000179575161111.9270015653679112.383375.332458716198883592.60.00017586426380.0001875942250.00155053305.5816531920651000000
    7
    2025-04-25 00:00:00.0009939790.17878116470.000182616102811.731264642519196.42573.234320735195204480.220.00018004145480.0001861389750.0013942536.955085599206013200
    8
    2025-04-12 00:00:00.0005885360.25392239570.00047373581296.6231824834347093.558110.249160448106913525.490.0004318408090.0001668550.0153937393.0162414972605.15278281.32
    9
    2025-04-16 00:00:00.0005424862.8747777180.00591518049110.26538367452016056.3107028.922427984172041869.270.0053040179310.0001751.84988748895970.5835793362966.9833466784.03
    10
    2025-05-08 00:00:00.0007727630.64108341290.000840214171616.9250125014806058.666298.897326343277696602.2994890.00083041892870.0001216052750.015203270526225.464585492200190222
    11
    2025-04-28 00:00:00.0008628450.26789648320.000317037258312.3309635154396535.985203.001159763205494856.610.00031078478330.000182596250.027267706985100.3897679812605.1490268.66
    12
    2025-04-01 00:00:00.00049470.027074242560.0005760477143.380524482451956.599616.09765957452735022.510.00055253556240.00017990.00994359223.6038775512603.34179692.44
    13
    2025-04-24 00:00:00.0005525160.080074476120.000155183093211.5524834751298274.832516.036492248192685283.820.00014506245670.0001550.0078000562351.9471557972000120000
    14
    2025-04-06 00:00:00.0004694170.11505005840.00027589942055.3133580611818774.344361.56916067185511064.140.00024530929290.00014999021130.01573983877.9836673772424.24284555.4
    15
    2025-04-15 00:00:00.0005694790.51835635170.0010821635737.3906059558937440.5418658.539749478120025812.970.00091099534570.00019106558510.0515707.2768717053000700000
    16
    2025-04-14 00:00:00.0003983680.17309020850.00047035382746.8722496032980480.628099.132119565111088372.430.00043490002130.0001750.03297488.6447738692966.98590001.44
    17
    2025-04-21 00:00:00.00010179360.19306179860.000206262605411.1971420282978193.753181.830929487186888465.060.00018983461030.0001550.0118487952928.4107669622000160000
    18
    2025-04-04 00:00:00.0004273790.35153151510.00092752378644.9757291225656576.3114925.00345646480196682.330.00082325881740.0001510.0846274629713247.2513114752424.241515000
    19
    2025-04-10 00:00:00.0005344170.21178826420.00050788552576.0782304223626352.948696.29002398197547034.720.00039660723640.00016014882880.01161258356790.9231086142514.69150000
    20
    2025-05-12 00:00:00.0004864220.37274048920.000883271301417.933682456158702.5514594.081872038291881405.8494890.00076695573910.0001950.2512672.2274691363328.813000000
    46
    8KB
    29s