{
    "Function": "createProfile",
    "File": "contracts/libraries/PublishingLogic.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "keccak256(bytes)",
        "_emitProfileCreated",
        "_validateHandle",
        "revert HandleTaken()",
        "_initFollowModule"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function createProfile(\n        DataTypes.CreateProfileData calldata vars,\n        uint256 profileId,\n        mapping(bytes32 => uint256) storage _profileIdByHandleHash,\n        mapping(uint256 => DataTypes.ProfileStruct) storage _profileById,\n        mapping(address => bool) storage _followModuleWhitelisted\n    ) external {\n        _validateHandle(vars.handle);\n\n        bytes32 handleHash = keccak256(bytes(vars.handle));\n\n        if (_profileIdByHandleHash[handleHash] != 0) revert Errors.HandleTaken();\n        _profileIdByHandleHash[handleHash] = profileId;\n\n        _profileById[profileId].handle = vars.handle;\n        _profileById[profileId].imageURI = vars.imageURI;\n        _profileById[profileId].followNFTURI = vars.followNFTURI;\n\n        if (vars.followModule != address(0)) {\n            _profileById[profileId].followModule = vars.followModule;\n        }\n\n        bytes memory followModuleReturnData = _initFollowModule(\n            profileId,\n            vars.followModule,\n            vars.followModuleData,\n            _followModuleWhitelisted\n        );\n\n        _emitProfileCreated(profileId, vars, followModuleReturnData);\n    }"
}