# InstantLayer Contract

`InstantLayer` is Symmio’s **meta-transaction router**, built to allow **Party A and Party B** participants to submit pre-signed operations for **gas-free execution**. It securely bridges off-chain intent signing with on-chain execution through EIP-712 signatures and structured batching.

The contract also supports **workflow templates**, where predefined sequences of operations can be reused with dynamic inputs.

**Key Features**

* **EIP-712 meta-tx support** with salt-based replay protection
* **Nonce ordering** for increased signature safety
* **Result chaining** between template steps
* **Standalone batch execution** for unrelated ops
* **Operator & admin roles** for access control
* **Instant-mode toggling** for Party A automation

## **Core Functions**

### 🔹 **Registration**

```solidity
function registerPartyB(address partyB) external;
function unregisterPartyB(address partyB) external;
```

Manages execution privileges for Party B actors. Assigns or revokes `OPERATOR_ROLE`.

```solidity
function registerMultiAccount(address multi) external;
function unregisterMultiAccount(address multi) external;
```

Whitelists or removes a `MultiAccount` contract.

### 🔹 **Template Management**

```solidity
function addTemplate(string calldata name, Operation[] calldata ops) external;
```

Creates a reusable operation sequence (workflow template). Assigns a sequential `templateId`.

```solidity
function setTemplateActive(uint256 templateId, bool active) external;
```

Enables or disables existing templates without removing them.

### 🔹 **Execution**

```solidity
function executeTemplate(
    uint256 templateId,
    SignedOperation[] calldata signedOps
) external;
```

Executes a template-based workflow. Verifies all signatures and steps. Allows result chaining between operations. Fully reverts on failure.

```solidity
function executeBatch(SignedOperation[] calldata signedOps) external;
```

Executes unrelated, independently signed operations in a batch. All must succeed.

### 🔹 **Signature Utilities**

```solidity
function getOperationHash(SignedOperation calldata op) public view returns (bytes32);
```

Returns the EIP-712 domain-separated hash that off-chain signers must sign.

```solidity
function domainSeparator() public view returns (bytes32);
```

Exposes the domain separator used in signature generation.
