> For the complete documentation index, see [llms.txt](https://docs.rigoblock.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rigoblock.com/solidity-api-reference/protocol/libraries/escrowfactory.md).

# EscrowFactory

## EscrowFactory

Creates escrow contracts using CREATE2 for deterministic addresses

*Escrow contracts are deployed per pool and operation type*

### EscrowDeployed

```solidity
event EscrowDeployed(address pool, enum OpType opType, address escrowContract)
```

Emitted when a new escrow contract is deployed

### DeploymentFailed

```solidity
error DeploymentFailed()
```

### getEscrowAddress

```solidity
function getEscrowAddress(address pool, enum OpType opType) internal pure returns (address escrowAddress)
```

Gets the deterministic address for an escrow contract

#### Parameters

| Name   | Type        | Description        |
| ------ | ----------- | ------------------ |
| pool   | address     | The pool address   |
| opType | enum OpType | The operation type |

#### Return Values

| Name          | Type    | Description               |
| ------------- | ------- | ------------------------- |
| escrowAddress | address | The deterministic address |

### deployEscrow

```solidity
function deployEscrow(address pool, enum OpType opType) internal returns (address escrowContract)
```

Deploys an escrow contract using CREATE2 (idempotent)

*MUST be called via delegatecall from pool context (address(this) == pool)*

#### Parameters

| Name   | Type        | Description        |
| ------ | ----------- | ------------------ |
| pool   | address     | The pool address   |
| opType | enum OpType | The operation type |

#### Return Values

| Name           | Type    | Description                          |
| -------------- | ------- | ------------------------------------ |
| escrowContract | address | The deployed escrow contract address |
