// SPDX-License-Identifier: Apache-2.0 pragma solidity 0.8.18; import "./Wallet.sol"; contract Factory { error DeployFailed(address _mainModule, bytes32 _salt); /** * @notice Will deploy a new wallet instance * @param _mainModule Address of the main module to be used by the wallet * @param _salt Salt used to generate the wallet, which is the imageHash * of the wallet's configuration. * @dev It is recommended to not have more than 200 signers as opcode repricing * could make transactions impossible to execute as all the signers must be * passed for each transaction. */ function deploy(address _mainModule, bytes32 _salt) public payable returns (address _contract) { bytes memory code = abi.encodePacked(Wallet.creationCode, uint256(uint160(_mainModule))); assembly { _contract := create2(callvalue(), add(code, 32), mload(code), _salt) } if (_contract == address(0)) revert DeployFailed(_mainModule, _salt); } }