DOCS

Mechanics

CHORUS is a batch-clearing exchange. The rules live in code; the frontend only previews them.

01 · Clearing algorithm

At the end of each epoch, find a single clearing price P: the largest volume that can match orders willing to buy at ≥ P against orders willing to sell at ≤ P. Every fill prints at that price — whatever your limit, the fill price is the same. That's the single pitch.

// bids sorted high-to-low, asks low-to-high
// find the largest P where willing buy (limit>=P) and sell (limit<=P) can match
export function indicativeClear(bids: Order[], asks: Order[]) {
  const prices = [...new Set([...bids, ...asks].map(o => o.limit))]
    .sort((a, b) => a - b);
  let best = null;
  for (const p of prices) {
    const buy  = bids.filter(o => o.limit >= p).reduce((s, o) => s + o.qty, 0);
    const sell = asks.filter(o => o.limit <= p).reduce((s, o) => s + o.qty, 0);
    const filled = Math.min(buy, sell);
    if (!best || filled > best.filled) best = { price: p, filled };
  }
  return best; // i.e. "the price the book would print if it closed now"
}

Note: on the frontend this calculation only previews the indicative clearing price. On-chain, clearing must run inside the settlement transaction — the frontend result doesn't count.

02 · Why gas can't buy a better price

In an AMM or order book, fill order sets the price — paying more gas to jump the queue gets you an earlier, better price. In CHORUS, every order in an epoch fills at one price; arrival order only affects whether you fill, never the fill price — front-running is pointless.

AMM timeline
P₀P₁P₂P₃AMM: fills one by one t₀ → t₃, price drifts each time · gas sets the order
CHORUS single print
PRINT · one priceCHORUS: every order in an epoch → one print line

03 · Current rules (v1 demo)

04 · Risks

  • · Unaudited: the contracts have not been security-audited and may contain unknown bugs.
  • · Permissionless tokens: anyone can open a market or launch a token, and the token itself may be worthless.
  • · Not investment advice: this demo and its docs are not investment, financial, or legal advice.
  • · Compliance: arbitrary markets plus token launches can easily be read as unregistered securities or a scam launchpad; doing this for real needs lawyers, not a frontend.
Back to BoardLaunch Token