# Party Binding System

The **Symmio Options Protocol** features a robust **Party Binding System** that establishes exclusive trading relationships between **Party A** (traders) and **Party B** (liquidity providers). This model enables seamless integration with off-chain services to optimize performance, without compromising the integrity of on-chain settlement.

The binding mechanism defines a dedicated execution path for Party A–Party B trading pairs:

* **Party A** binds exclusively to a designated **Party B**.
* All trading intents from Party A are routed through the bound Party B.
* Off-chain infrastructure (e.g. order routers) can be used to improve trade execution, reduce latency, and lower gas costs.
* Final settlement occurs **on-chain**, ensuring transparency, auditability, and security.

**Binding States**

| State            | Description                                  | Available Actions                                |
| ---------------- | -------------------------------------------- | ------------------------------------------------ |
| **Unbound**      | Party A has no active binding                | Bind to Party B                                  |
| **Bound**        | Party A is bound to a specific Party B       | Trade, activate instant mode, initiate unbinding |
| **Unbinding**    | Unbinding process initiated, cooldown active | Complete unbinding, cancel unbinding             |
| **Instant Mode** | Enhanced trading mode with bound Party B     | Deactivate instant mode, continue trading        |

## Core Binding Operations

The Party Binding system offers a structured lifecycle for managing the exclusive relationship between **Party A** and **Party B**. Each phase of the binding and unbinding process is explicitly controlled to ensure consistency, fairness, and system stability.

### **1. Binding to Party B**

```solidity
function bindToPartyB(address partyB) external
```

**Prerequisites:**

* `partyB` must be active and whitelisted.
* Party A must not already be bound to another Party B.
* Party B must have capacity to accept new bindings.

**Process:**

* Validates Party B status via `partyB.isPartyB()`.
* Checks that Party A has no existing binding.
* Establishes the Party A → Party B relationship in storage.
* Emits a `BindingConfirmed` event.

### **2. Initiating Unbinding**

```solidity
function initiateUnbindingFromPartyB() external
```

**Prerequisites:**

* Party A must currently be bound to a Party B.
* **Instant Actions Mode** must be inactive.
* No unbinding process should already be in progress.

**Process:**

* Records a timestamp marking the unbinding request.
* Begins a protocol-defined **cooldown period**.
* Disables activation of Instant Actions Mode during the cooldown.
* Allows existing trades to remain active until closed.

### **3. Completing Unbinding**

```solidity
function completeUnbindingFromPartyB() external
```

**Prerequisites:**

* Unbinding must have been initiated previously.
* The cooldown period must have fully elapsed.
* All trades and obligations between Party A and Party B must be settled.

**Process:**

* Verifies that the cooldown period has passed.
* Removes the binding relationship from storage.
* Clears unbinding timestamps and related metadata.
* Returns Party A to the **unbound** state.

**4. Cancelling Unbinding**

```solidity
function cancelUnbindingFromPartyB() external
```

**Use Cases:**

* Party A decides to remain bound before the cooldown expires.
* Market or strategic conditions change.
* Operational issues with Party B are resolved.

**Process:**

* Cancels the unbinding request.
* Resets the binding lifecycle to an active state.

## Instant Actions Mode

**Instant Actions Mode** is a performance-optimized trading layer available only to **bound Party A accounts**. It enables gas-free, low-latency execution via off-chain signatures and a streamlined interaction model

* **Meta-transactions** using EIP-712 signatures (gas-free for users).
* **Batched operation execution** for efficiency.
* **Template-based workflows** to standardize trade intents.
* **Reduced latency** and confirmation time.
* Designed for use with advanced **off-chain services** provided by Party B.

### **Activation**

```solidity
function activateInstantActionMode() external
```

**Prerequisites:**

* Party A must be actively bound to a Party B.
* The binding must not be under unbinding cooldown.
* Instant mode must not already be active.

**Process:**

* Enables the use of meta-transactions and instant trading features.
* Updates internal account status to reflect instant mode activation.

### **Deactivation Workflow**

#### **Step 1: Propose Deactivation**

```solidity
function proposeToDeactivateInstantActionMode() external
```

* Begins the deactivation cooldown period.
* Prevents immediate toggling of trading modes.
* Ensures safe transition and handling of in-flight operations.

#### **Step 2: Complete Deactivation**

```solidity
function deactivateInstantActionMode() external
```

* Validates that the cooldown period has completed.
* Fully disables instant trading features.
* Restores the account to **standard trading mode**.
