top of page
Search

Bridge Aggregator: Bungee Exchange

  • Writer: K Faz
    K Faz
  • Mar 3, 2023
  • 5 min read

Using Dune Analytics to analyze Bungee Exchange


The technology behind cryptocurrency bridging is based on distributed ledger technology, meaning that each bridge node is responsible for verifying and validating the transactions taking place. In order to ensure that all transactions are secure, bridge aggregators employ a variety of security measures such as multi-signature wallets, secure messaging protocols, and encryption. They also use distributed ledger technology to prevent double spending and other malicious activities. By employing these measures, bridge aggregators are able to provide users with a secure and efficient way to transfer their cryptocurrencies between different blockchains.


Bungee exchange is cross-chain bridge aggregator. Similar to DEX aggregators that search for the best routes for trades across the various AMM's, this cross-chain bridge aggregator should search for the most cost and time-efficient bridge.


Bungee exchange has integrated various bridges such as Multichain, Stargate, Hop, Across, Cbridge (by Celler) and others. They are backed by leading industry investors including Framework, Maven11 and Coinbase Ventures. Their API has been integrated by more than 30 apps including Zapper and Zerion.



Taking a look at Bungee Exchange Stats


Volume (Daily, 7D MA and Cumulative)












with chain_ids(blockchain, id) as

(

values

('ethereum', 1), ('optimism', 10), ('polygon', 137), ('avalanche_c', 43114),

('arbitrum', 42161), ('gnosis', 100), ('fantom', 250), ('bnb', 56),

('moonriver', 1285), ('moonbeam', 1284), ('celo', 42220), ('okex', 66),

('fuse' , 122), ('harmoney', 1666600000)

)

, tokens as (

with missed_tokens(blockchain, contract_address, decimals, symbol) as

(

values

('arbitrum', '0x0000000000000000000000000000000000000000', 18, 'ETH'), --ETH

('arbitrum', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 18, 'ETH'), --ETH

('optimism', '0x0000000000000000000000000000000000000000', 18, 'ETH'), --ETH

('optimism', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 18, 'ETH'), --ETH

('ethereum', '0x0000000000000000000000000000000000000000', 18, 'ETH'), --ETH

('gnosis', '0x0000000000000000000000000000000000000000', 18, 'XDAI'),--XDAI

('avalanche_c', '0x0000000000000000000000000000000000000000', 18, 'AVAX'),

('avalanche_c', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 18, 'AVAX'),

('bnb', '0x0000000000000000000000000000000000000000', 18, 'BNB'),

('bnb', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 18, 'BNB'),

('polygon', '0x0000000000000000000000000000000000000000', 18, 'MATIC'),

('polygon', '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', 18, 'MATIC')

)

select blockchain, contract_address, decimals, symbol from tokens.erc20

union

select blockchain, contract_address, decimals, symbol from missed_tokens

union

select blockchain, contract_address, decimals, symbol from prices.tokens where blockchain = 'polygon'

)

, prices as (

select blockchain, symbol, minute, avg(price) as price

from prices.usd_forward_fill

where minute > '2021-12-4' --and blockchain in ('ethereum', 'polygon', 'bnb', 'gnosis', 'avalanche_c', 'arbitrum', 'optimism')

-- and symbol not in ('BIFI', 'LIT', 'PAR', 'GTC', 'DG', 'MON', 'BANK', 'STACK', 'IMX', 'VEST', 'LOOT', 'DEC', 'WAIT', 'DUCK', 'TIME', 'RADAR', 'OHM', 'NCT', 'SYN',

--'ISLA')

group by 1,2,3

)

, bridges(blockchain, bridge_id, bridge) as (

values

('arbitrum', 1, 'Hop'), ('arbitrum', 2, 'Anyswap'), ('arbitrum', 10, 'Refuel'), ('arbitrum', 14, 'Cbridge'),

('arbitrum', 15, 'Hyphen'), ('arbitrum', 16, 'Hop'), ('arbitrum', 21, 'Stargate'), ('arbitrum', 5, 'Hop'),

('arbitrum', 6, 'Across'), ('arbitrum', 7, 'Cbridge'), ('arbitrum', 8, 'Across'), ('arbitrum', 9, 'Cbridge'),

('ethereum', 1, 'Hop'), ('ethereum', 11, 'Across'), ('ethereum', 12, 'Hyphen'), ('ethereum', 13, 'Cbridge'),

('ethereum', 14, 'Refuel'), ('ethereum', 17, 'Cbridge'), ('ethereum', 18, 'Hop'), ('ethereum', 19, 'Optimism'),

('ethereum', 2, 'Polygon'), ('ethereum', 20, 'Optimism'), ('ethereum', 25, 'Stargate'), ('ethereum', 3, 'Arbitrum'),

('ethereum', 4, 'Anyswap'), ('ethereum', 5, 'Hyphen'), ('ethereum', 8, 'Optimism'), ('ethereum', 9, 'Cbridge'),

('optimism', 1, 'Hop'), ('optimism', 12, 'Cbridge'), ('optimism', 13, 'Cbridge'), ('optimism', 14, 'Hyphen'),

('optimism', 15, 'Hop'), ('optimism', 20, 'Stargate'), ('optimism', 4, 'Hop'), ('optimism', 5, 'Across'),

('optimism', 6, 'Cbridge'), ('optimism', 7, 'Across'), ('optimism', 8, 'Cbridge'), ('optimism', 9, 'Refuel'),

('polygon', 1, 'Hop'), ('polygon', 10, 'Refuel'), ('polygon', 13, 'Across'), ('polygon', 14, 'Hyphen'),

('polygon', 17, 'Cbridge'), ('polygon', 19, 'Cbridge'), ('polygon', 2, 'Anyswap'), ('polygon', 20, 'Cbridge'),

('polygon', 21, 'Hop'), ('polygon', 28, 'Stargate'), ('polygon', 29, 'Stargate'), ('polygon', 3, 'Hyphen'),

('polygon', 7, 'Hop'), ('polygon', 8, 'Cbridge'), ('bnb', 1, 'Anyswap'), ('bnb', 11, 'Cbridge'),

('bnb', 14, 'Stargate'), ('bnb', 4, 'Across'), ('bnb', 6, 'Hyphen'), ('bnb', 7, 'Cbridge'),

('bnb', 8, 'Refuel'), ('gnosis', 1, 'Hop'), ('gnosis', 4, 'Hop'),

('gnosis', 5, 'Refuel'), ('gnosis', 8, 'Hop'), ('avalanche_c', 1, 'Anyswap'), ('avalanche_c', 11, 'Cbridge'),

('avalanche_c', 14, 'Stargate'), ('avalanche_c', 2, 'Hyphen'), ('avalanche_c', 4, 'Cbridge'), ('avalanche_c', 6, 'Hyphen'),

('avalanche_c', 7, 'Cbridge'), ('avalanche_c', 8, 'Refuel')

)

,tx_org as (

select call_block_time as block_time, 'arbitrum' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_arbitrum.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'ethereum' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_ethereum.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'polygon' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_polygon.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'optimism' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_optimism.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'bnb' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_bnb.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'gnosis' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_gnosis.Registry_call_outboundTransferTo where call_success

union

select call_block_time as block_time, 'avalanche_c' as src_chain,

_userRequest:receiverAddress as user, _userRequest:toChainId as dst_chain_id,

_userRequest:amount as raw_amount, _userRequest:middlewareRequest:id as middleware_id,

_userRequest:middlewareRequest:inputToken as m_in_token, _userRequest:bridgeRequest:id as bridge_id,

_userRequest:bridgeRequest:inputToken as b_in_token, contract_address, call_tx_hash as tx_hash

from socket_avalanche_c.Registry_call_outboundTransferTo where call_success

)

,txs as

(

select a.*, b.bridge, c.blockchain as dst_chain

from tx_org a left join bridges b on a.src_chain = b.blockchain and a.bridge_id = b.bridge_id

left join chain_ids c on a.dst_chain_id = c.id

)

,txs_ex1 as

(

select a.*, b.symbol as token_symbol, raw_amount/power(10, b.decimals) as amount

from txs a left join tokens b on a.src_chain = b.blockchain and a.m_in_token = b.contract_address

)

,transfers as

(

select a.*, a.amount * b.price as value

from txs_ex1 a left join prices b

on date_trunc('minute', a.block_time) = b.minute

and (a.src_chain = b.blockchain)

and (a.token_symbol = b.symbol

or (a.token_symbol = 'XDAI' and b.symbol = 'DAI')

or (a.token_symbol = 'MAI' and b.symbol = 'USDC')

or (a.token_symbol = 'USDt' and b.symbol = 'USDT')

or (a.token_symbol = 'DAI.e' and b.symbol = 'DAI')

or (a.token_symbol = 'BUSD.e' and b.symbol = 'BUSD')

or (a.token_symbol = 'LINK.e' and b.symbol = 'LINK')

or (a.token_symbol = 'WBTC.e' and b.symbol = 'WBTC')

or (a.src_chain not in('bnb', 'optimism') and a.token_symbol = 'ETH' and b.symbol = 'WETH')

)

)

--select * from transfers_tmp1 order by block_time limit 100

,daily as

(

select date_trunc('day', `block_time`) as `day`,

count(*) as `daily transfers`,

sum(`value`) as `daily volume`,

sum(if(bridge like '%Anyswap%', 1, 0)) as anyswap_count,

sum(if(bridge like '%Anyswap%', `value`, 0)) as anyswap_volume,

sum(if(bridge like '%Stargate%', 1, 0)) as stargate_count,

sum(if(bridge like '%Stargate%', `value`, 0)) as stargate_volume,

sum(if(bridge like '%Hyphen%', 1, 0)) as hyphen_count,

sum(if(bridge like '%Hyphen%', `value`, 0)) as hyphen_volume,

sum(if(bridge like '%Across%', 1, 0)) as across_count,

sum(if(bridge like '%Across%', `value`, 0)) as across_volume,

sum(if(bridge like '%Hop%', 1, 0)) as hop_count,

sum(if(bridge like '%Hop%', `value`, 0)) as hop_volume,

sum(if(bridge like '%Cbridge%', 1, 0)) as cbridge_count,

sum(if(bridge like '%Cbridge%', `value`, 0)) as cbridge_volume,

sum(if(bridge like '%Polygon%', 1, 0)) as polygon_count,

sum(if(bridge like '%Polygon%', `value`, 0)) as polygon_volume,

sum(if(bridge like '%Arbitrum%', 1, 0)) as arbitrum_count,

sum(if(bridge like '%Arbitrum%', `value`, 0)) as arbitrum_volume,

sum(if(bridge like '%Optimism%', 1, 0)) as optimism_count,

sum(if(bridge like '%Optimism%', `value`, 0)) as optimism_volume

from transfers

group by 1

)

select `day`, `daily volume`, `daily transfers`,

anyswap_volume, anyswap_count,

stargate_volume, stargate_count,

hyphen_volume, hyphen_count,

across_volume, across_count,

-- nxtp_volume, nxtp_count,

hop_volume, hop_count,

cbridge_volume, cbridge_count,

polygon_volume, polygon_count,

arbitrum_volume, arbitrum_count,

optimism_volume, optimism_count,

sum(`daily transfers`) over (order by `day`) as `cumulative transfers`,

avg(`daily volume`) over (order by `day` ROWS BETWEEN 6 PRECEDING AND 0 FOLLOWING) AS `7 Days MA`,

avg(`daily volume`) over (order by `day` ROWS BETWEEN 29 PRECEDING AND 0 FOLLOWING) AS `30 Days MA`,

sum(`daily volume`) over (order by `day`) as `cumulative volume`

from daily

order by 1 desc

 
 
 

Recent Posts

See All
Cosmos: Interconnected Blockchains

Cosmos is a decentralised ecosystem that offers communication between independent blockchain protocols. Hubs (e.g. the Cosmos Hub) act as...

 
 
 
ZK-EVMs

There have been many "ZK-EVM" projects making flashy announcements recently. Polygon open-sourced their ZK-EVM project, ZKSync released...

 
 
 

Comments


bottom of page