Skip to main content
The escrow factory is responsible for deploying escrow contracts on EVM chains and calculating their deterministic addresses using CREATE2.

EscrowFactory class

The EscrowFactory class provides methods to calculate escrow contract addresses deterministically.
import { EscrowFactory, ESCROW_FACTORY } from '@1inch/cross-chain-sdk'
import { NetworkEnum } from '@1inch/cross-chain-sdk'

const factory = new EscrowFactory(
  ESCROW_FACTORY[NetworkEnum.ETHEREUM]
)

Constructor

address
EvmAddress
required
The address of the escrow factory contract on the target chain

Methods

getEscrowAddress

Calculates the deterministic address of an escrow contract using CREATE2.
getEscrowAddress(
  immutablesHash: string,
  implementationAddress: EvmAddress
): EvmAddress
immutablesHash
string
required
The keccak256 hash of the immutables struct. See Immutables.hash()
implementationAddress
EvmAddress
required
The address of the escrow implementation contract on the same chain
Returns: The calculated escrow address

getSrcEscrowAddress

Calculates the source escrow address for given parameters.
getSrcEscrowAddress(
  srcImmutables: Immutables<EvmAddress>,
  implementationAddress: EvmAddress
): EvmAddress
srcImmutables
Immutables<EvmAddress>
required
The source immutables from the SrcEscrowCreated event (with correct timeLock.deployedAt)
implementationAddress
EvmAddress
required
The address of the source escrow implementation contract
Make sure you call this method on the source chain escrow factory instance.
Example:
import { 
  EscrowFactory, 
  ESCROW_FACTORY,
  ESCROW_SRC_IMPLEMENTATION,
  NetworkEnum 
} from '@1inch/cross-chain-sdk'

// Get source escrow address on Polygon
const factory = new EscrowFactory(
  ESCROW_FACTORY[NetworkEnum.POLYGON]
)

const srcEscrowAddress = factory.getSrcEscrowAddress(
  srcImmutables,
  ESCROW_SRC_IMPLEMENTATION[NetworkEnum.POLYGON]
)

getDstEscrowAddress

Calculates the destination escrow address for given parameters.
getDstEscrowAddress(
  srcImmutables: Immutables<EvmAddress>,
  complement: DstImmutablesComplement<EvmAddress>,
  blockTime: bigint,
  taker: EvmAddress,
  implementationAddress: EvmAddress
): EvmAddress
srcImmutables
Immutables<EvmAddress>
required
The source immutables from the SrcEscrowCreated event
complement
DstImmutablesComplement<EvmAddress>
required
The destination immutables complement from the SrcEscrowCreated event
blockTime
bigint
required
The block timestamp when the DstEscrowCreated event was produced
taker
EvmAddress
required
The taker address from the DstEscrowCreated event
implementationAddress
EvmAddress
required
The address of the destination escrow implementation contract
Make sure you call this method on the destination chain escrow factory instance.

getMultipleFillInteraction

Creates an interaction for multiple-fill orders with merkle proof.
getMultipleFillInteraction(
  proof: MerkleLeaf[],
  idx: number,
  secretHash: string
): Interaction
proof
MerkleLeaf[]
required
The merkle proof for the secret at the given index
idx
number
required
The index of the secret in the merkle tree
secretHash
string
required
The keccak256 hash of the secret
Returns: An Interaction object that can be used in order extensions

Deployment addresses

The SDK provides deployment addresses for all supported chains.

Factory addresses

import { ESCROW_FACTORY, NetworkEnum } from '@1inch/cross-chain-sdk'

const ethereumFactory = ESCROW_FACTORY[NetworkEnum.ETHEREUM]
// 0x03a25b3215a0e5c15cf23ac4d2e5cf86c0ff7efa

const zkSyncFactory = ESCROW_FACTORY[NetworkEnum.ZKSYNC]
// 0xd9085ac07da21bd6eb003a530a524ab054ca8652

Implementation addresses

import { 
  ESCROW_SRC_IMPLEMENTATION,
  ESCROW_DST_IMPLEMENTATION,
  NetworkEnum 
} from '@1inch/cross-chain-sdk'

const srcImpl = ESCROW_SRC_IMPLEMENTATION[NetworkEnum.ETHEREUM]
// 0x30476b0bf2f73f78a75488742920da7ff76c0ca0

const dstImpl = ESCROW_DST_IMPLEMENTATION[NetworkEnum.ETHEREUM]
// 0x5cd822f1c70469c36898aa98516a48f4aa04c73a

Supported chains

All deployment addresses are available for:
  • Ethereum
  • Polygon
  • Optimism
  • Binance Smart Chain
  • Avalanche
  • Coinbase (Base)
  • Fantom
  • Gnosis
  • Arbitrum
  • zkSync (uses different addresses)
  • Linea
  • Sonic
  • Unichain
zkSync uses different factory and implementation addresses due to its unique CREATE2 implementation.

Solana escrow factory

For Solana, use the SvmSrcEscrowFactory class:
import { SvmSrcEscrowFactory } from '@1inch/cross-chain-sdk'

const factory = SvmSrcEscrowFactory.DEFAULT
// Program ID: 2g4JDRMD7G3dK1PHmCnDAycKzd6e5sdhxqGBbs264zwz
The Solana factory provides:
  • createOrder() - Creates a Solana instruction to publish an order on-chain
  • parseCreateInstruction() - Parses a create instruction from transaction data
  • getOrderAccount() - Calculates the PDA for an order account
  • getEscrowAddress() - Calculates the escrow PDA
See the Solana order guide for complete Solana escrow factory usage.

See also

Build docs developers (and LLMs) love