PartyB Quote Actions

The PartyB Quote Actions Facet handles PartyB's interactions with quotes before a position is opened — locking quotes, unlocking them, and accepting cancellation requests. These are the first steps in the quote lifecycle after PartyA sends a quote. The underlying logic is implemented in the PartyBQuoteActionsFacetImpl library.

When PartyA has activated instant action mode, these functions are typically called through the Instant Layer rather than directly. In the Instant Layer flow, lockQuote is commonly part of a sendQuotelockQuoteopenPosition template that executes all three steps in a single transaction using signed operations.


Overview

The PartyB Quote Actions Facet provides the following key functionalities:

  • Lock Quote: PartyB secures a pending quote by locking it, reserving the required margin from their allocated balance. Once locked, no other PartyB can act on the quote.

  • Unlock Quote: PartyB releases a previously locked quote, returning it to pending status (or expiring it if past deadline) so other PartyBs can secure it.

  • Accept Cancel Request: PartyB accepts PartyA's cancellation request for a locked quote, releasing it back to cancelled status.


lockQuote()

Locks a pending quote, securing it for this PartyB. Once locked, the quote is reserved exclusively for this PartyB to open a position. The required margin (based on PartyB's estimated PnL from the position) is reserved from PartyB's allocated balance. A Muon SingleUpnlSig is required to verify PartyB remains solvent after locking.

Any whitelisted PartyB can lock the quote (or any PartyB if no whitelist was set on the quote).

Function Signature:

function lockQuote(uint256 quoteId, SingleUpnlSig memory upnlSig) external whenNotPartyBOpenPositionsPaused onlyPartyB notLiquidated(quoteId);

Parameters:

  • quoteId: The ID of the quote to lock.

  • upnlSig: The Muon signature containing PartyB's uPnL for solvency verification.

Access: Only callable by a registered PartyB. Neither party can be in liquidation.

Events Emitted:

  • LockQuote(address partyB, uint256 quoteId)


unlockQuote()

Releases a previously locked quote. If the quote's deadline has passed, it is expired. Otherwise, it returns to PENDING status, allowing other PartyBs to lock it.

Function Signature:

Parameters:

  • quoteId: The ID of the quote to unlock.

Access: Only callable by the PartyB who locked the quote. Neither party can be in liquidation.

Events Emitted:

  • UnlockQuote(address partyB, uint256 quoteId, QuoteStatus status) — when the quote returns to PENDING

  • ExpireQuoteOpen(QuoteStatus status, uint256 quoteId) — when the quote has expired


acceptCancelRequest()

Accepts PartyA's cancellation request for a locked quote. The quote enters CANCELED status and the reserved margin is released back to both parties.

This is called when a quote is in CANCEL_PENDING status — meaning PartyA requested cancellation after PartyB had already locked the quote, and PartyB agrees to release it.

Function Signature:

Parameters:

  • quoteId: The ID of the quote whose cancellation request should be accepted.

Access: Only callable by the PartyB of the quote. Neither party can be in liquidation.

Events Emitted:

  • AcceptCancelRequest(uint256 quoteId, QuoteStatus status)

Last updated