Paper · Protocol engineering · 2024

Modular market design: separate the moving parts

Reusable infrastructure for pricing, fees, permissions, and liquidity management.

An exchange is a collection of decisions. How are assets priced? Where is liquidity held? Who can interact with it? How are fees determined? Which data can another application rely on?

Putting every answer into one large contract makes a particular design straightforward to describe, but difficult to change. A new pricing rule can become a new exchange implementation, with repeated accounting logic and another large review surface.

Separate mechanism from infrastructure

Our modular exchange framework organizes exchange behavior into specialized modules around a pool. Pricing, fee calculation, verification, and liquidity storage have distinct responsibilities. This allows a developer to explore a market mechanism without rebuilding every surrounding component.

A pricing module can express a particular asset relationship. A fee module can react to conditions that the pricing mechanism does not model. An access verifier can define who may perform an operation. A vault arrangement can determine how reserves are held and used.

Interfaces carry the safety assumptions

Modularity does not eliminate complexity. It moves part of that complexity into the relationships between components. Each interface needs an explicit description of who calls it, what information it receives, and which invariants it must preserve.

Useful questions include whether a callback can re-enter another component, whether a fee is computed before or after a state change, and whether token behavior matches the assumptions of the accounting code. Composition needs testing in addition to review of each individual module.

Build for the asset’s actual behavior

A redeemable staking asset has different mechanics from an ordinary token pair. A balance that rebases is different from a balance that changes only through transfers. An external quoting service introduces different timing assumptions from a reserve-based curve.

The benefit of a modular foundation is that these differences can be represented deliberately. HOT explored the combination of quoted and automated execution. The liquid staking marketplace used asset-specific redemption mechanics. Both illustrate why the surrounding infrastructure should support several kinds of market behavior.

A useful abstraction makes a new design smaller without making its assumptions harder to see.

What this means for software delivery

For a development team, the first output should be a responsibility map. Identify the stable core, isolate the behavior likely to change, and specify the boundaries between them. Then test both the components and the complete system under adverse inputs.

The lesson extends beyond exchanges. Payment infrastructure, workflow engines, and data platforms also benefit from reusable foundations with explicit extension points. The aim is not maximum configurability; it is a system that can evolve without repeatedly rebuilding the parts that already work.

Sources and context

Edited from our 2024 technical materials on the modular exchange framework that the liquid staking marketplace runs on.

This edition: .

Proof of work