Repositories
Ten repositories, in two groups by how they are consumed: Solidity through git submodules under
lib/, TypeScript through vendored npm tarballs. Each README is authoritative for its own contents
and status.
Three more carry the third design, Bivium Direct (v3), and depend on none of the ten: bivium-tbv-direct (its contracts and TypeScript packages, one monorepo), bivium-v3-frontend (the v3 app on v3.cai.finance, which consumes its SDK) and bivium-v3-doc (this documentation, the copy the v3 app publishes). All three are private.
The dependency graph
Two groups, two mechanisms. Solidity depends through git submodules under lib/, so a dependency
is pinned to a commit. TypeScript depends through vendored tarballs, so it is pinned to a hash.
bivium-protocol Core + Exchange + ratifiers + periphery
└── bivium-lending lib/ bivium-protocol
├── bivium-option lib/ bivium-protocol, bivium-lending
└── bivium-protocol-tbv lib/ bivium-protocol, bivium-lending
bivium-protocol-cli @bivium/protocol-sdk + CLI + MCP
└── frozen release tarball
├── bivium-protocol-mm quoting; also packs itself for ↓
├── bivium-curator vendors the SDK *and* mm
└── bivium-protocol-frontend app + the stack's offer relayer
bivium-tbv-direct v3: apps, pools, series + @bivium/direct-sdk and packages
└── SDK tarball
└── bivium-v3-frontend the v3 app (v3.cai.finance); publishes bivium-v3-doc at /docs
Two edges are not imports and so are not drawn. bivium-protocol-spot is read over HTTP by the curator and the mm, and nothing depends on its code. bivium-protocol-lean4 reads the contracts the other way round: it vendors and hash-checks a pinned copy of them rather than being depended on.
The frontend reads contracts and logs directly — no indexer, no backend holding protocol state — and carries the relayer, so there is no separate relayer repository on this stack.
Contracts
| Repo | Role | Depends on |
|---|---|---|
| bivium-protocol | The core, the Exchange, the ratifiers and the periphery. The only place series accounting lives. See Architecture. | — |
| bivium-lending | No-liquidation fixed-term lending: LendingSeries (terms → series), LendingController, AllowlistGate, LendingLens, and the Earn pool — vault/InvestModule, vault/HedgeDesk, vault/CollateralDutchBook. See Lending. |
protocol |
| bivium-option | Option strategies attached to lending, not a standalone option product: OptionSeries (human terms, the expiry/strike grid), CollarRouter (a borrower cuts financing cost), CollarFlashExerciser (a collar call's holder takes the profit without the strike), HedgeRouter (a lender buys credit and a put in one transaction). A plain call or put needs none of this, and a TBV loan's collar is TBV's own — see Four things are called options. |
protocol, lending |
| bivium-protocol-tbv | The Babylon TBV application: borrowing against whole BTC vaults with vaultBTC as collateral, the TBVBTC delivered leg, the keeper redemption book, TbvCallBook — covered calls and collars on whole vaults, one record per call — all under its own TbvController, and TbvCallBids beside the book, where a writer sells its call into a buyer's signed bid as the taker. Lending terms are encoded exactly as in bivium-lending, so a TBV market reads like any other market to lenders and lenses — and an Earn pool can lend on it, with the app as its redeemer, deployed from here by DeployTbvInvest. Also the fast peg-out contracts — FastPegOutBook (TBVBTC ⇄ native BTC through sell orders, bids and standing asks), the SPV payout verifiers and FastPegOutRouter (BTC ⇄ any Uniswap token) — see Native BTC swap. Replaces vault-contracts-bivium, the same application on the old core. See Lifecycle and Architecture. |
protocol, lending |
| bivium-tbv-direct | v3, a separate design. GroupEngine with one custody per collateral — TbvDirectApp (Babylon vaults, TBVBTC) and Erc20DirectApp (WBTC, cbBTC, tBTC) — each one contract lending against whole lots, with covered calls, collars and call spreads on the loan's own record and auto-repay; DirectEarnPool and DirectSeries for Senior / Junior passive lending; its own FastPegOutBook, FastPegOutRouter, payout verifiers and Erc20DeliveryRouter. Uses no Core, Exchange or controller. See Bivium Direct (v3) and Direct Earn. | — (Babylon's vault contracts, OpenZeppelin) |
Solidity dependencies are git submodules under lib/, so a dependency is pinned to a commit and
bumped deliberately.
Off-chain
| Repo | Role | Depends on |
|---|---|---|
| bivium-protocol-cli | The shared TypeScript workspace: @bivium/protocol-sdk, @bivium/protocol-cli, @bivium/protocol-mcp. The SDK is the stack's single definition of protocol types, ABIs, Offer encoding, signature domains, funding payloads and quote-grid search — and of pricing, so "fair" means one thing to a lender and to a curator. The CLI and MCP read and prepare; they never sign, broadcast or hold keys. See Tooling. |
— (pins upstream commits) |
| bivium-protocol-mm | A one-shot quote engine for lending credit — windows, funding budgets, spot policy, execution orchestration, and deliberately no protocol types of its own. Also a hedged option writer (fully collateralised puts and calls, hedged back-to-back on Deribit), and the library the curator consumes. And the fast peg-out market maker: the Bitcoin relay feeder, standing asks it keeps stocked and claims, and bids it posts and pays — see Native BTC swap. See Tooling. | SDK (tarball) |
| bivium-curator | The Earn pool's operations: harvest, epochs, a markout monitor that pauses the pool on its own bad fills, and buying back the put each rung's credit is short. Prices nothing itself and holds only a guardian key that can pause but not unpause and not move funds. See Curator. | SDK + mm (tarballs) |
| bivium-protocol-spot | The pair spot feed: a venue index per allowlisted token pair, in the units each tool reads, carrying the assertion that makes that index the pair's price. Fails closed rather than guess. A Cloudflare Worker, also runnable as a plain node server — which is what the live curator reads, because Deribit refuses Cloudflare's egress. See the price boundary. | — |
| bivium-protocol-frontend | The web app over both products, in Basic and Pro modes — and the stack's offer relayer, as Pages Functions over KV, including the fast peg-out book's sell orders, bids and payment descriptions. Its Swap page pairs a BTC wallet with the ETH wallet (Native BTC swap). Reads contracts and logs directly: no indexer, no backend holding protocol state. See Frontend. | SDK (tarball); reads contracts |
bivium-tbv-direct packages/ |
v3's off-chain side in the same monorepo: @bivium/direct-sdk (ABIs from the build, EIP-712 digests, pricing, SeriesMath), mm (LendBid, CallBid and novation quotes), keeper (planner, devnet peg-in relayer), cli, frontend planners and a reference web client. The SDK is held to the contracts by an ABI check and SeriesMath differential vectors in CI. See Direct integration. |
its own contracts |
| bivium-v3-frontend | The v3 app on v3.cai.finance — Borrow, Options, Earn, Swap and Portfolio over the Direct apps, pools and series, in Basic and Pro modes — and its relayer, including the Direct order book /api/direct-orders. Split out of bivium-protocol-frontend (its history continues that repo's feat/direct); vendors this documentation from bivium-v3-doc. See Direct integration. |
direct SDK (tarball); reads contracts |
| bivium-protocol-lean4 | Lean 4 models of the series ledger, machine-checked proofs about them, and a conformance harness that replays the same operation streams through the model and the real pinned Core and compares every field. Three claims, not one; see Verification. | — (vendors and hash-checks pinned source) |
TypeScript dependencies are vendored tarballs, not registry versions — see Integration for why, and for the release procedure.
Four things are called options
The word does the most damage of any in this stack, because it names four different things:
| What it is | Needs | |
|---|---|---|
| the core's series | the primitive itself. Every series is an option: a long is the right to pay the strike and take the locked asset. European and American are a later exerciseStart; lending is exerciseStart = 0 |
bivium-protocol |
bivium-option (singular) |
option strategies attached to lending, and nothing else | bivium-protocol and bivium-lending |
calls on vaults (TbvCallBook, bivium-protocol-tbv) |
records, never series: the right to buy specific whole vaults, as TBVBTC, for a strike inside the call's own exercise window (American or European, set per call) — covered calls and TBV collars. Not on the Exchange, and nothing about them is fungible; bought from a resting CallOffer or sold into a signed CallBid (TbvCallBids) |
bivium-protocol-tbv |
bivium-options (plural) |
a fork of the Valorem Options Clearinghouse carrying an older Bivium-financed call prototype. A different clearing system, not this core, not this stack | neither |
So a plain call or put does not go through bivium-option. It is a series, written straight on
the protocol — Core, Exchange, a ratifier and the Router are the whole deployment, which is why the
SDK can drive standard options with no lending addresses configured at all. The market maker's
hedged option writer works exactly this way, and so do puts on TBVBTC: the keeper-side claim is an
ordinary ERC-20, so a TBV lender's default hedge is a plain series.
bivium-option enters only when a strategy needs the lending position as a leg:
OptionSeriesturns human terms into series fields, plus the standard grid (nextExpiry,snapStrike) so that strikes and expiries land where a venue actually lists them — which is what makes an exact back-to-back hedge possible at all.CollarRouteris a borrower cutting financing cost: in one transaction it locks the borrower's lending long into a call series, sells that call into a market maker's bid, and pays the premium to the borrower, who keeps the call's short. It cannot serve a TBV loan: TBV's controller keeps L1 in the app, so TBV collars areTbvCallBookrecords instead (Lifecycle).CollarFlashExerciseris the call holder's way out in the window without holding the strike: it exercises the call (K − D, freeing L1), then L1 (D, freeing the collateral), sells the collateral through a swap adapter, pays K and sends the holder the profit. The protocol'sFlashExerciserrefuses nested series, and a collar call needs both exercises.HedgeRouteris the lender's side: buy lending credit and a put that opens at the lending maturity, in one transaction, under a total budget.
The repository holds itself to a rule worth repeating: options here are tools for lending, and each strategy must name its real surplus source and who receives it. The options product is built on exactly that: the calls traders buy are the collar calls borrowers sell, so the surplus source is the borrower's upside, sold to lower its rate (README). Plain calls and puts stay series on the core, quoted by the market maker for the Earn pools' and lenders' hedges, and are not listed on the options pages.
Roles carry over; two of the repos do not
The ops taxonomy has five roles, and reading it from the curator's README is where people go wrong, because two of the repos named there serve the old stack:
| Role | Old-stack repo | On this stack |
|---|---|---|
| CLOB market making | bivium-mm |
bivium-protocol-mm |
| Earn pool curation | — | bivium-curator |
| RFQ / solver | bivium-solver — a single-maker Sepolia solver for Router V3 |
no repo. The nearest equivalents are a resting Exchange ask and TBV's signed BorrowIntent, and neither is an auction: a lender fills it, nobody competes to price it |
| whole-lot vault keeper | bivium-keeper — the registered keeper for the vault-contracts-bivium preview |
contracts in bivium-protocol-tbv, runners in bivium-protocol-mm. Auto-repay is TbvAutoRepay; the peg-out keeper fills the redemption book (postRedemption / claimFill) and runs settleDelivered in BiviumVaultApp. On the testnet its BTC payments are simulated |
| maturity settlement | — | MaturitySettler (protocol periphery), run by bivium-protocol-mm |
Neither bivium-solver nor bivium-keeper references bivium-protocol, and both target old-stack
addresses. Do not wire either to anything here. The RFQ lane is unbuilt, not relocated. The
keepers, the peg-out keeper included, run as lanes of bivium-protocol-mm rather than a repo of
their own (Tooling). The contract lives with the product and the runner
with the market maker, whose key and loan-token balance a keeper needs anyway.
Not this stack
These serve the earlier bivium-core protocol, or a separate prototype, and are a different
codebase. Do not wire them to anything here, and do not treat their docs as describing this stack:
bivium-core, bivium-cli, bivium-mm, bivium-frontend, bivium-docs, bivium-keeper,
bivium-solver, bivium-options, vault-contracts-bivium.
Four name collisions catch people, and three of them differ by one word:
| This stack | Not this stack | |
|---|---|---|
bivium-protocol-cli |
bivium-cli |
the old CLI |
bivium-protocol-mm |
bivium-mm |
the old market maker |
bivium-protocol-frontend |
bivium-frontend |
the old app |
bivium-option |
bivium-options |
one letter: a Valorem fork, not this core |
| this repository | bivium-docs |
the old public documentation |
The rule for the first three is simple: when a name does not say protocol, it is the old
stack — with one exception: bivium-tbv-direct is new, and is the v3 design, not the old stack. The fourth is the dangerous one, because bivium-option and bivium-options differ by a
single s and both are about options. bivium-protocol-tbv likewise replaces
vault-contracts-bivium, which stays frozen with the old core.
Where each repo's own documentation lives
| Repo | Beyond its README |
|---|---|
| bivium-lending | docs/invest-module.md — the Earn pool design |
| bivium-curator | docs/invest-module-design.md — the same pool from the operator's side |
| bivium-protocol-cli | packages/sdk/OPERATIONS.md — the operation contract and config schema; docs/acceptance/ — dated acceptance records per SDK release; docs/standard-options.md |
| bivium-protocol-mm | docs/implementation.md; vendor/README.md — SDK provenance and upgrade procedure |
| bivium-curator | vendor/README.md — SDK and mm provenance |
| bivium-protocol | The design spec is a private document, referenced from the README |
| bivium-tbv-direct | docs/superpowers/specs/2026-10-26-direct-series-zcb-design.md — the DirectSeries design; docs/superpowers/reviews/ — its review pack; packages/web/deployments/sepolia.json — the Sepolia records, superseded series included |
Vendored from bivium-protocol-doc adde07689a26, synced 2026-10-27. Where this and a repository disagree about that repository, the repository wins.