Intent-Based Trading System
Intent states
PENDING
Initial state when PartyA creates the intent
LOCKED
Intent reserved by a PartyB
FILLED
Intent executed and trade created
EXPIRED
Intent passed its expiration time
CANCELLED
Intent cancelled by PartyA before filling
CANCEL_PENDING
PartyA cancelled a locked intent, awaiting PartyB confirmation
Trading lifecycle

Step 1: send open intent
PartyA opens an intent by calling:
PartyA pays three fees: the protocol fee, the affiliate fee, and the solver fee. Funds are locked depending on the side:
Buy options: PartyA locks the option premium,
premium = option_price × quantity. The premium transfers to PartyB when the trade settles.Sell options: PartyA locks the required maintenance margin.
The intent is stored with PENDING status and becomes visible to eligible PartyB accounts.
Step 2: lock open intent
A PartyB can lock the intent when:
The intent is
PENDINGand hasn't expired.PartyB's address is in
partyBsWhiteList.PartyB has enough balance to meet its obligations.
PartyB accepts the terms.
The intent moves from PENDING to LOCKED and is reserved for the locking PartyB.
Step 3: fill open intent
Buy options: the locked premium is debited from PartyA and credited to PartyB, to be paid out after settlement.
Sell options: the locked maintenance margin is added to PartyA's total maintenance margin for solvency checks, PartyB pays the premium to PartyA, a new trade is created with
OPENEDstatus, and the intent moves fromLOCKEDtoFILLED.
Step 4: close position
4.1 Early close (before expiration)
PartyA can close a position early by sending a close intent:
Buy positions: the premium is paid to PartyB, PartyA sells the option back to PartyB, and PartyB pays PartyA the PnL:
PnL = (closePrice − openPrice) × quantity. IfPnL < 0, PartyA pays the loss to PartyB.Sell positions: the maintenance margin is released to PartyA, and PartyA pays PartyB the PnL (same formula). If
PnL < 0, PartyB pays the loss to PartyA.
4.2 Settlement at expiration
PartyB keeps the premium it already received (for trades where PartyA was the buyer).
In-the-money (ITM): the settlement price comes from the oracle,
PnL = (settlementPrice − strikePrice) × quantity, and the seller pays the positive PnL to the buyer (or the reverse if negative).Out-of-the-money (OTM): the option expires worthless, and any maintenance margin locked by the PartyA seller is released.
Last updated

