duneanalytics / duneanalytics/spellbook

[CONTRIBUTION] Add BEX (Berachain native DEX) to dex.trades on berachain

Open
#9,640 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
1.4k
Avg merge
3d 16h
Merged PRs (30d)
22

Description

What I want to add BEX is Berachain's native DEX (a Balancer V2 fork) and is currently missing from dex.trades on berachain. The 3 protocols currently covered (kodiak, beraswap, burrbear) represent only ~$14M of weekly volume. BEX has significant additional volume that is completely invisible to the community.

Research I've done:

  1. The BEX mainnet Vault contract is 0x4Be03f781C497A489E3cB0287833452cA9B9E80B
  2. Dune has already decoded this contract as beraswap_berachain.vault_evt_swap, with live swap data confirmed today (May 2026)
  3. The decoded table has columns: poolId, tokenIn, tokenOut, amountIn, amountOut — identical to the standard Balancer V2 Swap event
  4. BEX uses the Balancer V2 Vault architecture, so balancer_compatible_v2_trades macro applies directly

Proposed implementation Create bex_berachain_base_trades.sql using balancer_compatible_v2_trades(blockchain='berachain', project='bex', version='2'), reading from beraswap_berachain.vault_evt_swap.

Question for the team:
Since the decoded source is named beraswap_berachain rather than bex_berachain, does the macro need a source alias, or should I reference beraswap_berachain directly as the source?

I'm ready to write the SQL as soon as this is confirmed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the proposed bex_berachain_base_trades.sql file and inspect the balancer_compatible_v2_trades macro, using the existing beraswap_berachain.vault_evt_swap source and its decoded Swap columns as the reference. Resolve whether the macro can reference that source directly or needs an alias; done means BEX swap activity is included in dex.trades on Berachain.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
blockchain, data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.