Optionality Protocol Documentation
Optionality is a no-slippage, zero-liquidation options protocol on NEAR. Every option is a defined-risk vertical spread executed at the pool's published quote and backed 100% by escrowed USDT in the on-chain LP Vault—eliminating order-book slippage, margin calls, liquidation cascades, and counterparty default risk.
1. Protocol Overview Architecture
Traditional crypto options venues suffer from two structural flaws: fragmented orderbooks across dozens of strikes/expiries, and under-collateralized margin engines that liquidate traders during volatility spikes.
Optionality solves both problems by combining a Single Counterparty LP Pool Vault with Bounded Vertical Spreads on NEAR Protocol (~1.0s finality):
- For Buyers (Takers): Your maximum possible loss is strictly your upfront USDT entry cost. There are zero margin calls and zero liquidations regardless of how far spot moves before expiry.
- For Liquidity Providers (LPs): Because every ticket's maximum payout is bounded by its strike width
W = High - Low, the smart contract locks 100% of the worst-case payout insidereservedequity at the moment the ticket is written. - Dual Execution Path: Traders can buy from the LP Pool (or take a cheaper resting offer on the on-chain CLOB if a maker has posted a better price).
2. Bounded Vertical Spreads Payoff Structure
Instead of writing naked options with unbounded downside, every instrument in Optionality is a vertical spread defined by a lower strike L (low_strike) and an upper strike H (high_strike), with width W = H - L:
- Standard Widths:
$100on ETH spreads and$4,000on BTC spreads. - Call Spread (Bullish): Struck at
Strike = L, capping atH = L + W. Profits as the underlying rises aboveL + UnitCost, reaching maximum payoutWper contract at or aboveH. - Put Spread (Bearish): Struck at
Strike = H, capping atL = H - W. Profits as the underlying falls belowH - UnitCost, reaching maximum payoutWper contract at or belowL.
// Payoff per contract at expiry settlement price S_T:
CallSpreadPayoff(S_T) = clamp(S_T - L, 0, H - L)
PutSpreadPayoff(S_T) = clamp(H - S_T, 0, H - L)
// Net P&L for N contracts (fractional or whole):
NetPnL = N * PayoffPerContract(S_T) - TotalEntryCost
3. The 100% Solvency & Custody Invariant On-Chain Accounting
The `bounded_options` contract enforces a strict conservation law across all ten internal token buckets on every state transition. At any block height, `expected_custody()` equals the contract's actual NEP-141 USDT token balance (`ft_balance_of(options_contract)`):
expected_custody =
total_available // User tradable cash balances
+ total_offer_collateral // Maker CLOB offer collateral
+ total_bid_escrow // Maker CLOB bid escrow
+ total_ticket_collateral // CLOB peer-to-peer ticket collateral
+ total_ticket_premium // Escrowed ticket premiums
+ total_pending_withdrawals // In-flight async FT withdrawals
+ pool.equity // LP Vault equity (free + reserved)
+ pool.venue_locked // Escrowed venue margin on open pool tickets
+ pool.venue // Realized venue fee revenue
+ pool.consolation // Consolation bucket
q contracts of a spread with width W paying P (split into LP notional P_lp and venue margin P_venue), the vault reserves max_payout - P_lp from free_equity. If free_equity cannot cover the net worst-case exposure, the transaction reverts before any state change.
4. Expiry Schedule & Custom Expiries Tenors
Optionality supports both standardized institutional expiries and on-demand custom expiries:
| Rule | Specification | Description |
|---|---|---|
| Daily Default | 00:00 UTC Daily |
Every standard daily series settles at midnight UTC (displayed automatically in your selected timezone across the Board and Chart). |
| Any-Time Custom Expiry | ≥ 1 min (Testnet)≥ 1 day (Mainnet) |
Traders can select or drag any custom expiry timestamp and any custom strike price directly on the interactive Chart or Board. If the series does not yet exist on-chain, the gateway lists and quotes it atomically. |
5. Black-Scholes Bounded Spread Pricing Pricing Engine
Each vertical spread is priced analytically as the difference of two European options with strike-dependent skew implied volatility σ(K):
// Skew Smile Volatility:
m = ln(S / K)
sigma(K) = max(0.05, sigma_atm * (1 + 0.35 * m))
// Black-Scholes European Call (r = 0):
d1 = (ln(S / K) + 0.5 * sigma^2 * T) / (sigma * sqrt(T))
d2 = d1 - sigma * sqrt(T)
C(S, K, T) = S * N(d1) - K * N(d2)
// Bounded Call Spread [L, H] Model Mid:
Mid_CallSpread(L, H) = clamp(C(S, L, T) - C(S, H, T), 0, H - L)
6. Bounded Put-Call Parity No-Arbitrage
On any bounded interval [L, H] with width W = H - L, a long Call Spread plus a long Put Spread over the same bounds pays exactly W at expiry regardless of where spot finishes:
// Exact Bounded Spread Put-Call Parity (surface/src/pricing.rs):
Mid_PutSpread(L, H) = (H - L) - Mid_CallSpread(L, H)
This guarantees that an in-the-money Call Spread (where spot S > L) and an in-the-money Put Spread (where spot S < H) are always priced consistently with their intrinsic value, and closing an ITM position back to the pool always reflects its positive intrinsic gain.
USDT ($) Stablecoin Sizing & Fractional Contracts
All on-chain quantities and prices in `bounded_options` use a 6-decimal fixed-point scale (SCALE = 1,000,000). This means a trader does not have to buy integer contracts:
- Size in USDT ($ Stablecoin): Enter any dollar budget (e.g.,
$10.00,$25.50,$100.00 USDT) and the protocol computes the exact fractional contract quantityq = USD_Budget / UnitBuyPricedown to0.0001contracts (100on-chain micro-units). - Size in Contracts: Toggle to Contracts mode to specify any decimal or whole contract count (e.g.,
0.25,0.5,1.5, or10contracts).
7. Fee & Margin Schedule (`core::fees`) Economics
There are no separate gas surcharges or hidden ticket fees. All venue compensation is embedded transparently inside the pool quote using integer ceiling/floor arithmetic in core/src/fees.rs:
| Action | Formula | Venue Parameter | Notes |
|---|---|---|---|
| Standard Pool Buy (`Buy Price`) | ceil(q × Mid × (1 + margin_bps / 10000)) |
+50 bps (0.50%) | Includes the right to close early back to the LP Pool at any time before expiry. |
| Hold-to-Expiry Buy (`Hold Price`) | ceil(q × Mid) |
0 bps (0.00%) | Zero venue fee (`Terms::FLAT`). Position is locked until expiry settlement. |
| Early Pool Close (`Sell Price`) | floor(q × Mid × (1 - impact_bps / 10000)) |
-100 bps (1.00%) | Instant liquidity back to the LP Pool prior to expiry; protected by your 1% slippage floor. |
| Expiry Settlement (`settle_ticket`) | floor(q × Payoff(S_fixed)) |
0 bps (0.00%) | Full intrinsic payoff at the oracle committee fixed price, with zero settlement fee. |
8. Pool Vault & LP Shares Liquidity
Liquidity providers deposit USDT into the Vault (`pool_deposit_from_balance` or `ft_transfer_call` with `msg: "pool-deposit"`) and receive proportional LP shares minted against the vault's current net asset value (`equity`).
- Share Minting: If `shares == 0`, 1 share is minted per 1 USDT unit. Otherwise,
minted_shares = floor(deposit × total_shares / equity). - Withdrawal Guard: An LP can redeem shares via `pool_withdraw(shares)` whenever the redeemed value
floor(shares × equity / total_shares) ≤ free_equity. Capital backing active open tickets (`reserved`) remains locked until those tickets close or settle.
9. 4-Seat Oracle Committee & Settlement Consensus
Expiry settlement never trusts a single price feed or the venue's own operator alone. The `price_oracle` contract maintains an independent 4-seat signer committee:
- `kraken` — Independent Kraken spot signer process (`ed25519`).
- `okx` — Independent OKX spot signer process (`ed25519`).
- `pyth` — Independent Pyth Network price feed signer (`ed25519`).
- `venue-index` — The venue engine's median composite index (`ed25519`).
10. NEAR Smart Contracts Reference Rust / WASM
| Contract | Method | Type | Description |
|---|---|---|---|
bounded_options |
pool_buy(series_id, quantity, max_total_premium) |
Call | Buys `quantity` (6-decimal scaled) contracts from the LP Vault at its live quote (+50 bps entry margin), bounded by `max_total_premium`. |
bounded_options |
pool_buy_held(series_id, quantity, max_total_premium) |
Call | Buys from the LP Vault at model mid (0% fee) with a commitment to hold until expiry. |
bounded_options |
pool_close(ticket_id, min_exit_units) |
Call | Closes an open long pool ticket early at the vault's live exit quote, enforcing `min_exit_units`. |
bounded_options |
settle_ticket(ticket_id) |
Call | Claims the expiry settlement payout on a fixed or voided series and records realized proceeds. |
bounded_options |
get_pool_prices(series_ids, quantity) |
View | Returns exact integer `[mid_units, entry_units, exit_units]` for `quantity` across up to 64 series. |
price_oracle |
get_committee(feed_id) |
View | Returns all 4 oracle seats, their latest signed price, freshness, quorum status, and last fix. |
11. Confidential Copy-Trading (`OutLayer SGX`) Strategies
Optionality supports non-custodial strategy replication where followers allocate a capped USDT budget and per-trade percentage to verified leaderboard traders:
- Non-Custodial Mandates: Lead traders never custody follower funds. Followers can pause or revoke a mandate at any block.
- Enclave Execution: Signal replication is sequenced inside OutLayer SGX enclave tasks so strategy orders are not exposed to public mempool front-running prior to settlement.
12. Gateway HTTP & Streaming API REST / SSE
| Endpoint | Method | Description |
|---|---|---|
/state?asset=ETH&kind=Put&account=... |
GET |
Full venue state: option ladder, pool equity, custody reconciliation, oracle committee, active positions, and persistent `tape.closed` trade history. |
/chart-quote?asset=ETH&kind=Call&price=2300&quantity=1.5 |
GET |
Instant spread quote for any custom or listed strike, expiry, and fractional or whole contract quantity. |
/chart-candles?asset=ETH&interval=1m&limit=300 |
GET |
OHLCV candles supporting `1s`, `1m`, `5m`, `15m`, `1h`, `1D`, `7D`, and `1W` intervals. |
/action / /plan |
POST |
Executes (on sandbox) or plans unsigned NEAR transactions (on testnet) for `buy`, `close`, `settle`, `deposit`, `withdraw`, `pool-deposit`, and `pool-withdraw`. |
/stream?asset=ETH |
GET (SSE) |
Real-time sub-second Server-Sent Events stream of composite index prices and live tape prints. |