Architecture
DOME is a single Anchor 0.31 program. There is no off-chain service in the trading path.
Accounts
| Account | Seeds | Holds |
|---|---|---|
Pool | ["pool", mint_set] | Up to 16 mints and vaults, reserves, pending LP fees, tau, eight Bands |
Position | ["position", pool, owner, band] | One owner's radius in one band, fee checkpoints, fees owed |
| Vaults | associated token accounts of the pool | The pool's tokens, one per coin |
mint_set is the hash of the pool's mints in ascending order. Because the pool address is derived from it, one set of coins has exactly one pool. A second pool for the same coins cannot exist.
Pool is zero-copy (4,088 bytes plus the 8-byte discriminator); clients read it by byte offset, and a compile-time assertion keeps the layout fixed.
Instructions
| Instruction | Who | Purpose |
|---|---|---|
create_pool | anyone | Opens the pool for 2 to 16 mints with the same decimals |
open_position | anyone | Creates a position in one band |
add_liquidity / remove_liquidity | position owner | Adds or removes radius, moving every coin of the pool |
collect_fees | position owner | Pays fees in one coin |
close_position | position owner | Returns rent of an empty position |
swap | anyone | Any coin to any other |
Which mints can join
create_pool accepts SPL Token and Token-2022 mints. On Token-2022 it refuses a transfer hook, a non-zero transfer fee and non-transferable mints, because each could move or skim the pool's balances outside its accounting (MintExtension). Every coin of a pool must share the same decimals (DecimalsMismatch).
Arithmetic
All swap math is fixed point in 128 bits. MAX_VIRTUAL_RESERVE (2^58) and MAX_TOTAL_RADIUS (2^60) keep every product inside range; a trade that would leave it fails with CapExceeded instead of wrapping.
From paper to program
| Paper | Program |
|---|---|
| Sphere AMM | math::Geometry, per band |
| Ticks | eight fixed bands per pool (BAND_DEPEG_PPM) |
| Interior and boundary ticks | Band.boundary |
| Consolidation into a torus | math::trade over Pool.tau and the band book |
| Crossing ticks | trade split at each edge, Swapped.band_crossings |