Contracts

ParMarket

Cover requests with escrowed premiums, filled atomically from a Par vault.

ParMarket is the underwriting market: requesters post cover requests and escrow a premium in MUSD; a vault owner fills a request from their vault in one transaction and receives the premium.

Source: contracts/contracts/ParMarket.sol · Address: 0xb6e0aaBb4d44944b225cc697205D398DE13114e9

The constructor takes the ParFactory; MUSD is read from it. Only vaults created by that factory can fill a request.

Types#

TypeValues
RKindScheduled (0), Claim (1)
RStatusNone (0), Open (1), Filled (2), Cancelled (3)

Request fields, in getRequest order: requester, kind, status, deadline, beneficiary, start, period, arbiter, grace, count, challengeWindow, vault, expiry, installment, cap, premium, commitmentId, ref. vault and commitmentId are set when the request is filled.

Requesting#

Both functions pull premium MUSD from the caller (approve ParMarket first; a premium of 0 is allowed) and emit RequestCreated. The caller becomes the guarantee's principal.

FunctionRules (else BadParams)
requestScheduled(beneficiary, uint128 installment, uint64 start, uint32 period, uint32 grace, uint16 count, uint128 cap, uint64 expiry, uint128 premium, uint64 deadline, bytes32 ref) → idSame rules as the vault's createScheduled: non-zero beneficiary, installment, count, period and cap; cap ≤ installment × count; start ≥ now; expiry ≥ start + (count − 1) × period + grace + 300. Also: the beneficiary isn't the caller, and now ≤ deadline ≤ start, so the request can't be filled after the first payment is due.
requestClaim(beneficiary, arbiter, uint128 cap, uint64 expiry, uint32 challengeWindow, uint128 premium, uint64 deadline, bytes32 ref) → idNon-zero beneficiary and arbiter; the beneficiary isn't the caller; the arbiter is neither the caller nor the beneficiary; non-zero cap; expiry in the future; challengeWindow ≥ 60; now ≤ deadline < expiry.
cancel(uint256 id)Requester only (NotRequester), while open (NotOpen). Refunds the premium. Works after the deadline too. Emits RequestCancelled.

ref is an arbitrary reference, usually the hash of an off-chain note. It is stored, not interpreted.

Filling#

A request is filled through the underwriter's vault, never directly:

FunctionAccessDescription
ParVault.fillRequest(address market, uint256 id) → commitmentIdVault ownerReverts NotActive if the request isn't open. Reads the request, creates the matching commitment (the requester as principal), runs the stress test with the new cap (Unhealthy otherwise), then calls market.onFill(id, commitmentId). Reverts BadParams for a bond whose arbiter is the vault owner.
onFill(uint256 id, uint256 commitmentId)Factory vaults only (NotParVault)Requires the request to be open (NotOpen) and not past its deadline (Expired); the vault owner isn't the requester (SelfFill); and the commitment is active, unpaid and matches every term of the request (Mismatch). Marks it filled, records the vault and commitment, pays the premium to the vault owner and emits RequestFilled.

Everything happens in one transaction: if any check fails, no commitment is created and no premium moves.

Views#

FunctionReturns
getRequest(uint256 id) → RequestThe full request.
nextRequestId() → uint256The id the next request will get; ids start at 0.
openCount() → uint256Requests currently open (including past-deadline ones not yet cancelled).
factory() → address, musd() → addressWiring.
MIN_TRIGGER_WINDOW, MIN_CHALLENGE_WINDOW300 s and 60 s, the same as the vault's.

Events#

EventWhen
RequestCreated(id, requester, kind, beneficiary, cap, premium, deadline)A request is posted.
RequestCancelled(id)The requester cancels.
RequestFilled(id, vault, commitmentId, underwriter, premium)A vault fills it.

Errors#

ErrorMeaning
BadParams()The request's terms break a rule above.
NotRequester()Only the requester can cancel.
NotOpen()Already filled or cancelled.
Expired()Past the request's deadline.
NotParVault()onFill was not called by a factory vault.
SelfFill()The underwriter is the requester.
Mismatch()The commitment doesn't match the request exactly.
Last updated 16 November 2026Suggest an edit on GitHub