> 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-options-v0.2.1/facets/partyb-close-facet.md).

# PartyB Close Facet

### PartyB Close Facet

The **PartyB Close Facet** is the counterpart to the PartyA Close Facet. PartyB can either fill it (fully or partially) at a price favorable to PartyA, or accept a cancellation if PartyA has asked to back out.

This is one of the leanest facets in the protocol. PartyB's close-side responsibilities reduce to just these two actions.

> **Key Concepts:**
>
> * **Fill vs. Partial Fill:** PartyB can fill the full quantity requested in the close intent, or choose to fill only part of it. A partial fill leaves the remainder of the close intent open for further fills or cancellation.
> * **Price Favorability:** The fill price must be at least as favorable to PartyA as the price they specified in the close intent. For a BUY position PartyA is closing, this means PartyB must fill at or above PartyA's requested price.
> * **CANCEL\_PENDING:** When PartyA calls `cancelCloseIntent()` while a PartyB has the intent in progress, it moves to `CANCEL_PENDING` rather than cancelling immediately. `acceptCancelCloseIntent()` is how PartyB clears that pending state.
> * **Emergency Mode:** In emergency mode, PartyBs may have access to additional close-side actions not covered in this facet. This facet covers the standard path only.

***

#### fillCloseIntent()

Executes a full or partial closure of a trade based on an existing close intent. PartyB specifies the quantity they're willing to close and the price at which they'll do it. The price must be at least as good as what PartyA requested.

**Function Signature:**

```solidity
function fillCloseIntent(
    uint256 intentId,
    uint256 quantity,
    uint256 price
) external whenPartyNotPaused(msg.sender);
```

**Parameters:**

* **intentId:** The unique identifier of the close intent to fill.
* **quantity:** The amount to close. Can be equal to or less than the quantity in the close intent — partial fills are allowed, leaving the remainder open.
* **price:** The execution price. Must be at least as favorable to PartyA as the price they specified when creating the intent — the library enforces this and will revert if the condition isn't met.

***

#### acceptCancelCloseIntent()

Acknowledges and accepts a cancellation request that PartyA has already submitted. When PartyA calls `cancelCloseIntent()` on a live (non-expired) intent, it transitions to `CANCEL_PENDING` rather than cancelling outright pending PartyB to confirm they're not in the middle of processing it.&#x20;

**Function Signature:**

```solidity
function acceptCancelCloseIntent(uint256 intentId) external whenPartyNotPaused(msg.sender);
```

**Parameters:**

* **intentId:** The unique identifier of the close intent in `CANCEL_PENDING` state to accept the cancellation of.

***

#### Events

```solidity
event FillCloseIntent(uint256 indexed intentId, uint256 quantity, uint256 price);
event AcceptCancelCloseIntent(uint256 indexed intentId);
```

***


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.symm.io/contract-documentation/symmio-options-v0.2.1/facets/partyb-close-facet.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
