Proof
Golden vectors, the withdrawal guard, and the stated limits. Every number in the table is recomputed from the engine at page load — a parity failure in lib/spanMath.ts fails the vitest suite, not the display.
Golden vectors — the exact test cases
| Vector | Book | Isolated IM (what to post alone) | Net IM (what to post netted) | Collateral saved |
|---|---|---|---|---|
| GV-01 | $100,000 LP, $95,000 short (the demo book) | $147,500 | $10,000 | 9,322 bps, 93.22% |
| GV-02 | $100,000 LP, $80,000 short | $140,000 | $13,750 | 9,017 bps, 90.17% |
| GV-03 | $100,000 LP, unhedged | $100,000 | $33,750 | 6,625 bps, 66.25% |
Withdrawal guard — v4 hook, beforeRemoveLiquidity
The owner of the GV-01 book withdraws $80,000 of LP notional. The engine evaluates the surviving book and the PoolManager call reverts on the unsafe branch:
SpanMarginBreach( trader: 0x7fa3…c41d, postEquity: $12,000, requiredIM: $16,500, )
The branch is the GV-04 vector: the unwind at δ = +2,000 bps would realize bad debt, so the withdrawal is refused before it can happen. The mark used for the valuation is the more conservative of spot and entry.
Live deployment — Base Sepolia (84532)
| ClearingAquaApp | 0xB03a10C4a46B8c5A9F3a634Cf46CA8DBC4eEA8D4 |
| MockAqua (local Aqua) | 0xaA0DE110D9b521774Ffcc7bA18F6A5F09528a183 |
| ShortHedgeAdapter | 0xf540aA3E72D8a21901465bd54278b8dF77ae3f4F |
| PortfolioMarginHook | 0xdC970EF753F106Fae90e48eaD027719aC476C240 |
| Demo USDC | 0x89134651A92B3a98CF9Be5035c61064Eb73c9BE0 |
every address above is a real contract on testnet with the mined hook flag mask 0x240; the demo book, adapter binding, and keeper roles are wired exactly as the tests assert.
Sponsor proof points
where each appears: the terminal ledger (ship, push, pull on a fork), the guard panel (hook revert), /arkiv (entity table and query string)
Stated limits
- not audited — the contracts are tested, not audited; basis, venue, smart-contract, and oracle risk remain
- demo hedge adapter — the short leg settles against a pre-funded demo reserve, not a live venue
- downward shocks only — the atomic unwind executes for shocks in [−3,000, 0] bps; upward shocks are preview-only
- router withdrawals — a withdrawal through a router is not identified by the guard; direct PoolManager calls only
- single-asset scope — one WETH/USDC LP plus one WETH short; multi-asset correlation is out of scope
- SPAN-style, simplified — a 16-scenario grid, not a production SPAN algorithm
volatility assumption in every vector: 150 bps (= 1.5%); recomputed at build time from lib/spanMath.ts