# SymmioPartyB Contract

The `SymmioPartyB` contract is the core **execution proxy** for Party B actors. It provides **secure routing**, **multi-call support**, and **fine-grained permissioning** for interactions with the Symmio core contracts.

This contract allows Party B to batch trade operations, authorize token flows, and interface with both internal and whitelisted external contracts.

## **Core Functions**

### 🔹 **Symmio Call Dispatcher**

```solidity
function _call(bytes[] calldata callDatas) external;
```

Forwards multiple encoded calls to the Symmio core (e.g., opening or closing trades). Enforces selector-level permissions:

* `restrictedSelectors[sel] == true`: requires `MANAGER_ROLE`
* otherwise: `TRUSTED_ROLE` or `InstantLayer` delegate is sufficient

Reverts if any call fails.

### 🔹 **Multicast Executor**

```solidity
function _multicastCall(
    address[] calldata dests,
    bytes[] calldata datas
) external;
```

Sends parallel external calls to approved targets. All destination contracts must be whitelisted. Requires `TRUSTED_ROLE`.

### 🔹 **Token Management**

```solidity
function _approve(address token, uint256 amount) external;
```

Sets Symmio token allowances. Callable by `TRUSTED_ROLE`.

```solidity
function withdrawERC20(address token, uint256 amount) external;
```

Withdraws tokens to the caller. Restricted to `MANAGER_ROLE`.

### 🔹 **Configuration Functions**

```solidity
function setRestrictedSelector(bytes4 sel, bool state) external;
```

Marks a core selector as restricted to `MANAGER_ROLE`.

```solidity
function setMulticastWhitelist(address addr, bool state) external;
```

Controls which external contracts can be called via `_multicastCall`.

```solidity
function setSigner(address newSigner) external;
```

Updates the ERC-1271 signer address used for off-chain validation.

### 🔹 **Signature Verification**

```solidity
function isValidSignature(
    bytes32 hash,
    bytes calldata sig
) external view returns (bytes4);
```

Returns `0x1626ba7e` if signature is valid; otherwise `0xffffffff`.

### 🔹 **Emergency Controls**

```solidity
function pause() external;
function unpause() external;
```

Enables or disables contract functions under emergency conditions. Controlled via `PAUSER_ROLE` / `UNPAUSER_ROLE`.

Once the cooldown period has elapsed, the withdrawal can be finalized:

```solidity
function completeWithdraw(uint256 id)
```


---

# Agent Instructions: 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:

```
GET https://docs.symm.io/options-protocol-architecture/technical-architecture/helper-contracts/symmiopartyb-contract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
