andre4avalanche bridges
    Updated 2025-05-20
    WITH
    -- bridging actviity
    bridge_activity AS (
    SELECT
    DATE_TRUNC('week', block_timestamp) AS time,
    token_symbol,
    bridge_address,
    tx_hash,
    amount_usd AS volume_bridged
    FROM avalanche.defi.ez_bridge_activity
    WHERE DATE_TRUNC('week', block_timestamp) < DATE_TRUNC('week', CURRENT_DATE)
    ),
    -- all tokens. It cna be done by token later
    aggregated_activity AS (
    SELECT
    time,
    COUNT(DISTINCT tx_hash) AS bridges,
    COUNT(DISTINCT bridge_address) AS active_users,
    SUM(volume_bridged) AS volume_bridged,
    AVG(volume_bridged) AS avg_volume_bridged
    FROM bridge_activity
    GROUP BY 1
    ),
    -- needed? Lets see
    cumulative_totals AS (
    SELECT
    time,
    bridges,
    SUM(bridges) OVER (ORDER BY time) AS total_bridges,
    volume_bridged,
    SUM(volume_bridged) OVER (ORDER BY time) AS total_volume_bridged,
    avg_volume_bridged
    FROM aggregated_activity
    ORDER BY time DESC
    )
    SELECT * FROM cumulative_totals order by time desc

    Last run: 2 months ago
    TIME
    BRIDGES
    TOTAL_BRIDGES
    VOLUME_BRIDGED
    TOTAL_VOLUME_BRIDGED
    AVG_VOLUME_BRIDGED
    1
    2025-05-12 00:00:00.00051236370146140123713.8311682622655.7527676.024852854
    2
    2025-05-05 00:00:00.00064656365023190206685.7611542498941.9229780.285855644
    3
    2025-04-28 00:00:00.00067706358558150908999.4111352292256.1622423.328292719
    4
    2025-04-21 00:00:00.00066166351788161124737.1811201383256.7524423.94075792
    5
    2025-04-14 00:00:00.00050466345172169899182.8611040258519.5733596.832679454
    6
    2025-04-07 00:00:00.0005675634012668832311.7810870359336.7111958.358544128
    7
    2025-03-31 00:00:00.0004433633445170467647.4210801527024.9315846.109156735
    8
    2025-03-24 00:00:00.0004487633001897847552.7310731059377.5121690.878459322
    9
    2025-03-17 00:00:00.0004273632553152107401.0210633211824.7811864.162345173
    10
    2025-03-10 00:00:00.0005684632125896764804.8110581104423.7616538.165238421
    11
    2025-03-03 00:00:00.00096496315574126849993.2210484339618.959944.339386955
    12
    2025-02-24 00:00:00.00068826305925139896445.4110357489625.7319080.257148118
    13
    2025-02-17 00:00:00.00062026299043185346476.8510217593180.3229266.773543344
    14
    2025-02-10 00:00:00.00076196292841116938042.1710032246703.4714253.783784739
    15
    2025-02-03 00:00:00.000130036285222125884922.969915308661.39597.081875429
    16
    2025-01-27 00:00:00.000136356272219142372739.579789423738.3400110435.588915195
    17
    2025-01-20 00:00:00.000124336258584253945822.349647050998.7700119688.7751853
    18
    2025-01-13 00:00:00.000106666246151506340807.619393105176.4300147921.711869203
    19
    2025-01-06 00:00:00.00072156235485112905508.868886764368.8200116035.436565829
    20
    2024-12-30 00:00:00.00072296228270163220536.428773858859.9623518.809282421
    ...
    190
    15KB
    2s