saeedmzn[Euler] - overtime by type
    Updated 2025-04-14
    with euler_txns as (
    select
    tx_hash,
    block_timestamp::date date ,
    event_name type ,
    origin_from_address user ,
    UPPER(REGEXP_REPLACE(contract_name, '^EVK Vault e(.*?)ETH-[1-2]$', '\\1ETH')) symbol,
    case when type = 'Deposit' then ( decoded_log:assets) / 1e18
    when type = 'Repay' then ( decoded_log:assets) / 1e18
    when type = 'Borrow' then -( decoded_log:assets) / 1e18
    when type = 'Withdraw' then -( decoded_log:assets) / 1e18
    end as amount
    from swell.core.ez_decoded_event_logs
    where origin_to_address = '0x08739cbede6e28e387685ba20e6409bd16969cde'
    and event_name in ( 'Borrow','Deposit', 'Withdraw','Repay' )
    and UPPER(REGEXP_REPLACE(contract_name, '^EVK Vault e(.*?)ETH-1$', '\\1ETH')) is not null
    and block_timestamp::date >='2025-01-17'
    ),
    prices as (
    SELECT
    DATE_TRUNC(day, hour) date,
    symbol,
    median(price) price
    FROM ethereum.price.ez_prices_hourly join euler_txns using (symbol)
    where date_trunc(day,hour)::date >= '2025-01-17'
    GROUP BY 1,2
    ),
    final as (
    select * exclude price , amount*price amount_usd from euler_txns join prices using (date , symbol)
    )
    --'Borrow','Deposit', 'Withdraw','Repay'
    select
    date_trunc(week,date) ::date weekly ,
    type ,
    count (distinct tx_hash) num_txns ,
    count (distinct user) num_users ,
    Last run: 12 days ago
    WEEKLY
    TYPE
    NUM_TXNS
    NUM_USERS
    VOLUME_USD
    CUM_VOLUME_USD
    AVG_AMOUNT
    1
    2025-02-17 00:00:00.000Withdraw5025-2268554.44766999-29948043.7843924-39113.007718448
    2
    2025-02-24 00:00:00.000Borrow4219-837223.884811018-15627314.0226912-19933.90201931
    3
    2025-03-03 00:00:00.000Borrow4014-367059.270016541-15994373.2927078-9176.481750414
    4
    2025-01-27 00:00:00.000Withdraw15241-5379303.15020826-5381009.95757671-33411.820808747
    5
    2025-03-24 00:00:00.000Repay46161757326.693733614324469.145423938202.7542116
    6
    2025-01-20 00:00:00.000Withdraw22-8.5839255-1706.807368453-4.29196275
    7
    2025-02-10 00:00:00.000Repay90272810411.1556403710363681.971559430219.474791832
    8
    2025-01-27 00:00:00.000Repay80232645944.214284552645944.4259569532267.612369324
    9
    2025-02-10 00:00:00.000Withdraw11937-7973203.30931706-27679489.3367224-61807.777591605
    10
    2025-03-31 00:00:00.000Borrow498-186339.4993518-18987684.7606326-3327.491059854
    11
    2025-04-14 00:00:00.000Deposit446796.50522046747408020.52022431359.301044093
    12
    2025-03-03 00:00:00.000Deposit4916650993.58057319739176062.717677311224.027251262
    13
    2025-03-24 00:00:00.000Borrow5413-2095762.11371252-18801345.2612808-38810.409513195
    14
    2025-03-10 00:00:00.000Deposit13515386439.59033564439562502.3080132721.405565744
    15
    2025-04-07 00:00:00.000Deposit78284082494.9136666547401224.015003834597.414522599
    16
    2025-03-17 00:00:00.000Borrow3610-417241.071390204-16705583.1475683-11590.029760839
    17
    2025-02-17 00:00:00.000Repay23111189912.8715073511553594.843066847596.514860294
    18
    2025-01-13 00:00:00.000Withdraw11-1698.223442953-1698.223442953-1698.223442953
    19
    2025-02-03 00:00:00.000Borrow11335-3067583.05665745-12489044.5893785-24154.197296515
    20
    2025-03-24 00:00:00.000Withdraw6321-2816988.85145115-34747656.323318-40242.697877874
    53
    5KB
    11s