Skip to main content
A Writer opens a Short by ensuring the Option Series exists and minting contracts into the 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.
If a 4-leg mint hits the compute limit during simulation, retry with a smaller maxLegsPerTransaction (3, 2, or 1) before prompting the user to sign again.

Leveraged Minting and OMLP Loans

Writers can borrow from the Collateral Mint’s OMLP vault to collateralize a Short:
  • Fused borrow and mint: buildLeveragedOptionMintMultiWithBorrowTransaction borrows from OMLP and mints in one instruction, up to MAX_LEVERAGED_MINT_LEGS (4) legs per transaction.
  • Standalone borrow: buildBorrowFromPoolInstruction borrows OMLP liquidity into a WriterPosition and transfers the maker’s own collateral into the shared escrow in the same instruction. PoolLoan (version = 3, 229 bytes onchain) tracks escrowedPrincipal and escrowedCollateral explicitly per loan.
  • Opening margin requirement: Every minted leg must pass the program’s conservative post-fill opening margin check (OpeningMarginNotMet, 6171). Call computeMinimumOpeningOwnCollateralBaseUnits before submitting a leveraged mint to size makerCollateralAmount and borrowedAmount.
  • Repaying a loan: Use buildRepayPoolLoanFromWalletInstruction to repay from the maker’s wallet, buildRepayPoolLoanInstruction to repay from escrow, or buildRepayPoolLoanFromCollateralInstruction to 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 run preflightUnwindWriterUnsold first to compute effectiveUnwindQty and inspect active OMLP loans. Then build the unwind with automatic loan repayment: