{
    "Function": "createMirror",
    "File": "contracts/libraries/PublishingLogic.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IReferenceModule",
        "Helpers"
    ],
    "Internal Calls": [
        "_initPubReferenceModule"
    ],
    "Library Calls": [
        "getPointedIfMirror"
    ],
    "Low-Level Calls": [],
    "Code": "function createMirror(\n        uint256 profileId,\n        uint256 profileIdPointed,\n        uint256 pubIdPointed,\n        address referenceModule,\n        bytes calldata referenceModuleData,\n        uint256 pubId,\n        mapping(uint256 => mapping(uint256 => DataTypes.PublicationStruct))\n            storage _pubByIdByProfile,\n        mapping(address => bool) storage _referenceModuleWhitelisted\n    ) external {\n        (uint256 rootProfileIdPointed, uint256 rootPubIdPointed, ) = Helpers.getPointedIfMirror(\n            profileIdPointed,\n            pubIdPointed,\n            _pubByIdByProfile\n        );\n\n        _pubByIdByProfile[profileId][pubId].profileIdPointed = rootProfileIdPointed;\n        _pubByIdByProfile[profileId][pubId].pubIdPointed = rootPubIdPointed;\n\n        // Reference module initialization\n        bytes memory referenceModuleReturnData = _initPubReferenceModule(\n            profileId,\n            pubId,\n            referenceModule,\n            referenceModuleData,\n            _pubByIdByProfile,\n            _referenceModuleWhitelisted\n        );\n\n        // Reference module validation\n        address refModule = _pubByIdByProfile[rootProfileIdPointed][rootPubIdPointed]\n            .referenceModule;\n        if (refModule != address(0)) {\n            IReferenceModule(refModule).processMirror(\n                profileId,\n                rootProfileIdPointed,\n                rootPubIdPointed\n            );\n        }\n\n        emit Events.MirrorCreated(\n            profileId,\n            pubId,\n            rootProfileIdPointed,\n            rootPubIdPointed,\n            referenceModule,\n            referenceModuleReturnData,\n            block.timestamp\n        );\n    }"
}