Skip to content
Regulated DeFi · tokenized real-world assets (RWAs)

Swarm Markets: a BaFin-regulated DEX for tokenized assets

Protofire built Swarm Markets' on-chain DEX core on a fork of Balancer, added the subgraph data layer the interface reads from, and contributed to Swarm's dOTC block-trading contracts. Swarm Markets is a Berlin-based, BaFin-regulated venue where tokenized stocks and gold trade next to crypto and every wallet is KYC-verified (source: Swarm Markets).

Rather than write a regulated exchange's AMM from scratch, a multi-year audit liability, Protofire forked Balancer's weighted-pool contracts, audited and in production since 2020, so Swarm inherited that hardening instead of restarting it. The verifiable output is public: the forked core and subgraph repositories, both created February 2021.

Snapshot
Client
Swarm Markets
Sector
Regulated DeFi / tokenized real-world assets (RWAs)

Protofire owned the on-chain half of a product whose compliance and licensing Swarm keeps.

01

Why building the AMM from scratch was the wrong risk

Swarm's BaFin license and KYC permissioning are its own product. But compliance does not trade anything by itself: underneath the permissioning sits an automated market maker that has to price swaps, hold liquidity in pools, and settle on-chain, for assets regulators watch closely.

For a regulated venue, a bespoke AMM written from zero is the largest single source of technical and audit risk: every line of custom pool math is new attack surface a smart contract audit has to cover, and a regulated operator cannot ship unreviewed code that holds user funds. The pragmatic path is to build on an AMM design the industry has already audited and run in production, then add only what the product needs: configurable pools an operator can govern, a data layer fast enough to power a live trading interface, and a way for institutions to move size without walking the public order book.

02

How Protofire built Swarm's DEX on a Balancer core

The swarm-markets-balancer-core repository, Protofire's fork of balancer/balancer-core created in February 2021, holds its Solidity commit history on the pool contracts, including the configurable pool parameters a regulated operator needs to govern. The fork also carries a full Trail of Bits security audit and Echidna and Manticore test harnesses, so the Swarm-specific changes shipped against the same review bar as the upstream code.

The exchange settled on Polygon rather than Ethereum mainnet, which kept a swap in the range of a few cents ($0.05 to $0.10) instead of the several dollars ($5 to $10) a comparable mainnet trade cost, roughly a 98% lower transaction fee.

So the interface can read chain state quickly, Protofire built the exchange's data layer as a subgraph on The Graph. The swarm-markets-subgraph repository, forked from balancer/balancer-subgraph, indexes the pools, swaps, transactions, and user balances the front end depends on.

For institutional flow, Protofire also contributed to Swarm's decentralized OTC (dOTC) block-trading contracts, which let large trades execute on-chain with private offers and configurable order terms instead of moving the public pools. Across the engagement, Protofire owned the on-chain half of a product whose compliance and licensing Swarm keeps.

03

Results

Protofire delivered the on-chain engineering behind Swarm's exchange. The verifiable output is public code, not a marketing metric:

Swarm Markets separately reports the exchange's business traction: over 7,000 KYC-verified users, 50+ trading pairs including tokenized Apple, Tesla, and gold, and monthly trading volume that grew from under $1M to over $15M within six months of launch (source: Swarm Markets).

DEX core
built on a fork of Balancer, with Protofire's Solidity history, configurable pool parameters, and a Trail of Bits audit in swarm-markets-balancer-core
Subgraph data layer
powering the trading interface, in swarm-markets-subgraph
dOTC block-trading contracts
for institutional-size trades, contributed by Protofire (scope not covered by the two public repositories above)

Technology stack

Solidity (Balancer fork)The Graph subgraphs (TypeScript)EchidnaManticore

FAQ

Did Protofire build Swarm Markets?
No. Swarm Markets is the licensed, BaFin-regulated operator and owns the product, its compliance, and its KYC and permissioning layer. Protofire built the on-chain engineering underneath it: the AMM DEX core (forked from Balancer) and the subgraph data layer, and it contributed to the dOTC block-trading contracts.
Did Protofire write the Balancer AMM?
No. Balancer authored the core AMM contracts. Protofire forked that codebase and built Swarm's exchange on top of it, carrying the fork forward with Swarm-specific Solidity and subgraph work so it inherited years of audit and production hardening instead of restarting it. The forks are public under the Protofire GitHub org.
Where can I verify what Protofire built?
In the public repositories: swarm-markets-balancer-core for the DEX core, including its Trail of Bits audit, and swarm-markets-subgraph for the data layer. Business metrics such as its 7,000+ user count and its monthly trading volume come from Swarm Markets and are not something a code repository can verify.

Book a call with Alejandro Losa

Schedule a call with our Web3 Solution Architect to receive practical recommendations and a prompt proposal for upgrading your solution.

Protofire 2026. All rights reserved

Message us on Telegram