> 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.4/facets/partyb-quote-actions-facet-0.8.4.md).

# PartyB Quote Actions Facet (0.8.4)

## PartyB Quote Actions Facet (0.8.4)

The **PartyB Quote Actions Facet** provides Party B with the necessary functions to secure and manage quotes submitted by Party A. After a quote is issued, Party B may choose to lock it—thereby securing the funds required to open a position—and later unlock it if needed. Additionally, Party B can accept a cancellation request if a quote is in the cancellation-pending state.

> **Key Operations:**
>
> * **Lock Quote:**\
>   Secure a quote by locking it, after verifying the UPnL using a Muon signature.
> * **Unlock Quote:**\
>   Unlock a previously locked quote if conditions permit, returning the quote to a pending state.
> * **Accept Cancel Request:**\
>   Accept a cancellation request for a quote that is in the cancellation-pending state, updating its status and refunding the associated trading fee.

***

### lockQuote()

Locks a quote so that Party B can secure it by providing sufficient funds based on their estimated profit and loss from opening a position. This function requires a valid Muon signature (`SingleUpnlSig`) to verify the UPnL data for the quote.

**Function Signature:**

```solidity
function lockQuote(uint256 quoteId, SingleUpnlSig memory upnlSig) external whenNotPartyBActionsPaused onlyPartyB notLiquidated(quoteId);
```

**Parameters:**

* **quoteId:** The identifier of the quote to be locked.
* **upnlSig:** A `SingleUpnlSig` structure containing the Muon signature for the UPnL value used during the locking process.

```solidity
struct SingleUpnlSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnl;
	bytes gatewaySignature;
	SchnorrSign sigs;
}
```

**Example Usage:**

```solidity
// Party B locks a quote with ID 101 using a valid UPnL signature.
SingleUpnlSig memory upnlSignature = /* obtain UPnL signature data */;
diamond.lockQuote(101, upnlSignature);
```

**Events Emitted:**

* **LockQuote:**

  ```solidity
  event LockQuote(address partyB, uint256 quoteId);
  ```

  Emitted with the Party B address and the locked quote ID.

***

### unlockQuote()

Unlocks a previously locked quote. The function checks if the quote has expired based on its deadline; if so, it emits an expiration event. Otherwise, it unlocks the quote, reverts its status to PENDING, and clears the locked funds associated with Party B.

**Function Signature:**

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

**Parameters:**

* **quoteId:** The identifier of the quote to be unlocked.

**Example Usage:**

```solidity
// Party B unlocks a locked quote with ID 101.
diamond.unlockQuote(101);
```

**Events Emitted:**

* If the quote has expired:
  * **ExpireQuoteOpen:**\
    Emitted with the resulting status and the quote ID.
* If the quote is unlocked successfully:
  * **UnlockQuote:**

    ```solidity
    event UnlockQuote(address partyB, uint256 quoteId, QuoteStatus quoteStatus);
    ```

    Emitted with the Party B address, quote ID, and the new status (typically PENDING).

***

### acceptCancelRequest()

Accepts a cancellation request for a quote that is in the cancellation-pending state. This function finalizes the cancellation by updating the quote status to CANCELED, refunding the trading fee to Party A, and clearing the associated locked balances.

**Function Signature:**

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

**Parameters:**

* **quoteId:** The identifier of the quote for which the cancellation request is accepted.

**Example Usage:**

```solidity
// Party B accepts the cancellation request for a quote with ID 101.
diamond.acceptCancelRequest(101);
```

**Events Emitted:**

* **AcceptCancelRequest:**\
  This event is emitted to signal that the cancellation request for the quote has been accepted and processed.

  ```solidity
  event AcceptCancelRequest(uint256 quoteId, QuoteStatus quoteStatus);
  ```


---

# 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.4/facets/partyb-quote-actions-facet-0.8.4.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.
