OptionPool against collateral in the Collateral Mint.
Opening a Short
1
Check Which Strikes Need Initialization
Derive per-strike addresses with
deriveOptionSeriesLegAddresses, then pass them to findLegsNeedingSeriesInit. It returns strikes that are missing an OptionAccount or a WriterPosition for the maker.2
Mint Contracts
Call
buildOptionMintMultiTransactionWithDerivation to mint up to MAX_MINT_LEGS (4) legs per transaction. Send each chunk sequentially with version: 1.Leveraged Minting and OMLP Loans
Writers can borrow from the Collateral Mint’s OMLP vault to collateralize a Short:- Fused borrow and mint:
buildLeveragedOptionMintMultiWithBorrowTransactionborrows from OMLP and mints in one instruction, up toMAX_LEVERAGED_MINT_LEGS(4) legs per transaction. - Standalone borrow:
buildBorrowFromPoolInstructionborrows OMLP liquidity into aWriterPositionand transfers the maker’s own collateral into the shared escrow in the same instruction.PoolLoan(version = 3, 229 bytes onchain) tracksescrowedPrincipalandescrowedCollateralexplicitly per loan. - Opening margin requirement: Every minted leg must pass the program’s conservative post-fill opening margin check (
OpeningMarginNotMet,6171). CallcomputeMinimumOpeningOwnCollateralBaseUnitsbefore submitting a leveraged mint to sizemakerCollateralAmountandborrowedAmount. - Repaying a loan: Use
buildRepayPoolLoanFromWalletInstructionto repay from the maker’s wallet,buildRepayPoolLoanInstructionto repay from escrow, orbuildRepayPoolLoanFromCollateralInstructionto repay from the series collateral vault.
Multi-leg net margin (
init_strategy_margin) is refused on the current program with StrategyMarginDisabled (6168). Post collateral per leg.Unwinding Unsold Size
A Writer can unwind only Unsold Size. Sold contracts cannot be unwound until Longs close them back to the pool. Always runpreflightUnwindWriterUnsold first to compute effectiveUnwindQty and inspect active OMLP loans. Then build the unwind with automatic loan repayment:
- Single Leg
- Multi-Leg (Up to 4)
