> For the complete documentation index, see [llms.txt](https://docs.symm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/diamond-core-facets/partyb-quote-actions.md).

# 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 `sendQuote` → `lockQuote` → `openPosition` template that executes all three steps in a single transaction using signed operations.

***

#### Overview

The PartyB Quote Actions Facet provides:

* **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:**

```solidity
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:**

```solidity
function unlockQuote(uint256 quoteId) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId);
```

**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: PartyA requested cancellation after PartyB had already locked the quote, and PartyB agrees to release it.

**Function Signature:**

```solidity
function acceptCancelRequest(uint256 quoteId) external whenNotPartyBActionsPaused onlyPartyBOfQuote(quoteId) notLiquidated(quoteId);
```

**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)`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.symm.io/contract-documentation/symmio-perps-v0.8.5/diamond-core-facets/partyb-quote-actions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
