// SPDX-License-Identifier: UNLICENSED pragma solidity =0.8.18; import "../SomaAccessControl/utils/Accessible.sol"; import "../TemplateFactory/TemplateDeployer.sol"; import "./ISomaEscrow.sol"; import "./ISomaEscrowFactory.sol"; /** * @notice Implementation of the {ISomaEscrowFactory} interface. */ contract SomaEscrowFactory is ISomaEscrowFactory, Accessible, TemplateDeployer { /** * @inheritdoc ISomaEscrowFactory */ bytes32 public constant override CREATE_ROLE = keccak256("SomaEscrow.CREATE_ROLE"); constructor(uint256 templateVersion) TemplateDeployer(bytes32("SomaEscrow"), templateVersion) {} /** * @inheritdoc ISomaEscrowFactory */ function create(address asset, address withdrawTo, address settlementFunder, uint48 minSettlementWindow) external override onlyRole(CREATE_ROLE) returns (address instance) { uint256 index = totalDeployments(); instance = _deploy(bytes32(index)); ISomaEscrow(instance).initialize(asset, withdrawTo, settlementFunder, minSettlementWindow); emit SomaEscrowCreated(index, asset, instance); } }