Updated 2025-02-11
    SELECT
    --volume
    sum(AMOUNT_IN_USD) as volume,
    sum(case when direction = 'inbound' then AMOUNT_IN_USD else 0 end) as inbound_volume,
    sum(case when direction = 'outbound' then AMOUNT_IN_USD else 0 end) as outbound_volume,
    -- Transaction
    count(DISTINCT TX_HASH) as bridges,
    count(DISTINCT (iff(direction = 'inbound', RECEIVER, SENDER))) as users,
    count(case when direction = 'inbound' then TX_HASH end) as inbound_txs,
    count(case when direction = 'outbound' then TX_HASH end) as outbound_txs,
    -- Token metrics
    count(DISTINCT TOKEN_ADDRESS) as tokens_bridged,
    count(DISTINCT platform) as active_bridges,
    -- Average metrics
    volume/bridges as avg_vol_per_tx,
    bridges/users as avg_bridges_per_user,
    -- Chain metrics
    count(DISTINCT source_chain) as source_chains,
    count(DISTINCT destination_chain) as destination_chains
    FROM aptos.defi.ez_bridge_activity

    WHERE block_timestamp > CURRENT_DATE - INTERVAL '{{trading_period}} days'


    Last run: about 2 months ago
    VOLUME
    INBOUND_VOLUME
    OUTBOUND_VOLUME
    BRIDGES
    USERS
    INBOUND_TXS
    OUTBOUND_TXS
    TOKENS_BRIDGED
    ACTIVE_BRIDGES
    AVG_VOL_PER_TX
    AVG_BRIDGES_PER_USER
    SOURCE_CHAINS
    DESTINATION_CHAINS
    1
    568769605.898825198160638.000296370608967.898529808394267552420284198147035.831787861.8942941230
    1
    112B
    1s