// SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.20; import {Ajo} from "./Ajo.sol"; // TODO make ownable, pauseable (by owner), upgradeable /// @title Ajo Factory /// @author Charlie Andrews-Jubelt /// @custom:security-contact security@valora.xyz contract AjoFactory { mapping(string => Ajo) public publicIdToAjo; event AjoDeployed(string indexed publicId, address ajoDeployer, address ajoAddress); error AjoAlreadyExists(string publicId); function createAjo( string memory _publicId, address[] memory _participants, uint256 _contributionPerRound, uint256 _startTime, address _tokenAddress, uint256 _roundDurationSeconds ) public returns (address) { if (address(publicIdToAjo[_publicId]) != address(0)) { revert AjoAlreadyExists(_publicId); } Ajo newAjo = new Ajo( _participants, _contributionPerRound, _startTime, _tokenAddress, _roundDurationSeconds ); publicIdToAjo[_publicId] = newAjo; emit AjoDeployed(_publicId, msg.sender, address(newAjo)); return address(newAjo); } }